@SuppressWarnings("unchecked")
public void testConfigDirLoad() throws Exception {
String dir =
this.getClass().getClassLoader().getResource( "testapp").getPath();
Config config = new Config( new File( dir));
String[] paths = { "mupd8", "application", "TestApp", "performers", "K1Updater", "class"};
String k1Updater = ( String) config.getScopedValue( paths);
assertEquals("check performer class value", "com.walmartlabs.mupd8.examples.KnUpdaterJson", k1Updater);
String[] cassPath = { "mupd8", "slate_store", "keyspace"};
assertEquals("check slate_store" , "Mupd8", ( String) config.getScopedValue( cassPath));
JSONObject performerConfig = config.workerJSONs.get("K1Updater");
assertEquals("workerJSONs defined in directory configuration", k1Updater, (String) performerConfig.get("class"));
String sys =
this.getClass().getClassLoader().getResource( "testapp/sys_old").getPath();
String app =
this.getClass().getClassLoader().getResource( "testapp/app_old").getPath();
Config newConfig = new Config(sys, app);
String[] clPath = { "mupd8", "application" };
java.util.HashMap<String, Object> testApp = ( java.util.HashMap<String, Object>) newConfig.getScopedValue( clPath);
String firstKey = ( String) testApp.keySet().toArray()[0];
assertEquals("contains TestApp", "TestApp", firstKey);
performerConfig = newConfig.workerJSONs.get("K1Updater");
assertEquals("workerJSONs defined in sys/app configuration", "com.walmartlabs.mupd8.examples.KnUpdater", (String) performerConfig.get("class"));