File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/main/java/com/linkedin/kmf Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1212import com .fasterxml .jackson .databind .ObjectMapper ;
1313import com .linkedin .kmf .services .Service ;
1414import com .linkedin .kmf .apps .App ;
15- import com .linkedin .kmf .tests .Test ;
1615import java .util .concurrent .ConcurrentHashMap ;
1716import java .util .concurrent .ConcurrentMap ;
1817import java .util .concurrent .atomic .AtomicBoolean ;
@@ -55,13 +54,15 @@ public KafkaMonitor(Map<String, Map> testProps) throws Exception {
5554 throw new IllegalArgumentException (name + " is not configured with " + CLASS_NAME_CONFIG );
5655 String className = (String ) props .get (CLASS_NAME_CONFIG );
5756
58- if ( className . startsWith ( App . class . getPackage (). getName ()) ||
59- className . startsWith ( Test .class .getPackage (). getName () )) {
57+ Class <?> cls = Class . forName ( className );
58+ if ( App .class .isAssignableFrom ( cls )) {
6059 App test = (App ) Class .forName (className ).getConstructor (Map .class , String .class ).newInstance (props , name );
6160 _apps .put (name , test );
62- } else {
61+ } else if ( Service . class . isAssignableFrom ( cls )) {
6362 Service service = (Service ) Class .forName (className ).getConstructor (Map .class , String .class ).newInstance (props , name );
6463 _services .put (name , service );
64+ } else {
65+ throw new IllegalArgumentException (className + " should implement either " + App .class .getSimpleName () + " or " + Service .class .getSimpleName ());
6566 }
6667 }
6768 _executor = Executors .newSingleThreadScheduledExecutor ();
You can’t perform that action at this time.
0 commit comments