// apam.waitForIt(Constants.CONST_WAIT_TIME);
S1Impl s1 = (S1Impl) s1Inst.getServiceObject();
Eletronic lgSwitch = (Eletronic) lgInst.getServiceObject();
System.out
.println("Instances after FIRST injection request (preference cannot be resolved)");
auxListInstances("\t");
Instance injectedInstance = CST.componentBroker.getInstService(s1
.getDevicePreference110v());
System.out.println("Injected:" + injectedInstance);
Assert.assertTrue(
String.format(
"The instance injected cannot be the prefered one (currentVoltage=500), since there exist no instance in which the preference is valid."
+ " The instance %s (currentVoltage:%s) was injected instead of %s (currentVoltage:%s)",
injectedInstance.getName(), injectedInstance
.getAllProperties().get("currentVoltage"),
lgInst.getName(),
lgInst.getAllProperties().get("currentVoltage")), s1
.getDevicePreference110v() == lgSwitch);
Implementation samsungImpl = waitForImplByName(null, "SamsungSwitch");
final Instance samsungInst = samsungImpl.createInstance(null,
new HashMap<String, String>() {
{
put("currentVoltage", "500");
}
});
Eletronic samsungSwitch = (Eletronic) samsungInst.getServiceObject();
Instance injectedInstance2 = CST.componentBroker.getInstService(s1
.getDevicePreference110v());
System.out.println("Injected (new resolution) :" + injectedInstance);
Assert.assertTrue(