Implementation s1Impl = waitForImplByName(null,
"fr.imag.adele.apam.pax.test.impl.S1Impl_tct021");
Instance s1Inst = s1Impl.createInstance(null, null);
S1Impl_tct021 s1 = (S1Impl_tct021) s1Inst.getServiceObject();
String messageTemplace = "for a property type injected='external', the %s";
Assert.assertTrue(
String.format(messageTemplace,
"initial value declared in the xml should NOT be ignored for external"),
s1.getInjectedExternal().equals("default"));
s1Inst.setProperty("injectedExternal", "changedByApamAPI");
Assert.assertTrue(String.format(messageTemplace,
" value should be changeable by ApamInstance.setProperty"), (s1
.getInjectedExternal() == null ? "" : s1.getInjectedExternal())
.equals("changedByApamAPI"));
Assert.assertTrue(
String.format(
messageTemplace,
" value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getProperty"),
s1Inst.getProperty("injectedExternal").equals(
"changedByApamAPI"));
Assert.assertTrue(
String.format(
messageTemplace,
" value should be changeable by ApamInstance.setProperty, which is not true when checking ApamInstance.getAllProperties"),
s1Inst.getAllProperties().get("injectedExternal")
.equals("changedByApamAPI"));
s1.setInjectedExternal("changedByJavaInstance");
Assert.assertNotNull(s1.getInjectedExternal());
logger.debug("-----s1.getInjectedExternal():"
+ s1.getInjectedExternal());
// Property should remain unchanged
Assert.assertTrue(
String.format(
messageTemplace,
"value should NOT be changeable by java instance, but it changed when checking JavaInstance.myfield"),
s1.getInjectedExternal().equals("changedByApamAPI"));
Assert.assertTrue(
String.format(
messageTemplace,
"value should NOT be changeable by java instance, but it changed when checking ApamInstance.getProperty()"),