@Test public void testReboundConfigDoesNotContainId() throws Exception { MyEnricher policy = origApp.addEnricher(EnricherSpec.create(MyEnricher.class)); newApp = (TestApplication) rebind(); MyEnricher newEnricher = (MyEnricher) Iterables.getOnlyElement(newApp.getEnrichers()); assertNull(newEnricher.getConfig(ConfigKeys.newStringConfigKey("id"))); assertEquals(newEnricher.getId(), policy.getId()); }
@Test public void testRestoresConfig() throws Exception { origApp.addEnricher( EnricherSpec.create(MyEnricher.class) .displayName("My Enricher") .uniqueTag("tagU") .tag("tag1") .tag("tag2") .configure( MyEnricher.MY_CONFIG_WITH_SETFROMFLAG_NO_SHORT_NAME, "myVal for with setFromFlag noShortName") .configure( MyEnricher.MY_CONFIG_WITH_SETFROMFLAG_WITH_SHORT_NAME, "myVal for setFromFlag withShortName") .configure(MyEnricher.MY_CONFIG_WITHOUT_SETFROMFLAG, "myVal for witout setFromFlag")); newApp = (TestApplication) rebind(); MyEnricher newEnricher = (MyEnricher) Iterables.getOnlyElement(newApp.getEnrichers()); assertEquals(newEnricher.getDisplayName(), "My Enricher"); assertEquals(newEnricher.getUniqueTag(), "tagU"); assertEquals(newEnricher.tags().getTags(), MutableSet.of("tagU", "tag1", "tag2")); assertEquals( newEnricher.getConfig(MyEnricher.MY_CONFIG_WITH_SETFROMFLAG_NO_SHORT_NAME), "myVal for with setFromFlag noShortName"); assertEquals( newEnricher.getConfig(MyEnricher.MY_CONFIG_WITH_SETFROMFLAG_WITH_SHORT_NAME), "myVal for setFromFlag withShortName"); assertEquals( newEnricher.getConfig(MyEnricher.MY_CONFIG_WITHOUT_SETFROMFLAG), "myVal for witout setFromFlag"); }