public void SubstitutionReachingMultipleNodes_tc122() {
Implementation subjectAimpl = waitForImplByName(null, "subject-a");
Implementation implementationAlpha = waitForImplByName(null,
"impl-case-12-child");
Instance instanceAlpha = implementationAlpha.createInstance(null,
new HashMap<String, String>() {
{
put("property-subject-b", "alpha(child)");
}
});
Implementation implementationBravo = waitForImplByName(null,
"impl-case-12-child");
Instance instanceBravo = implementationBravo.createInstance(null,
new HashMap<String, String>() {
{
put("property-subject-b", "bravo(child)");
}
});
Implementation implementationCharlie = waitForImplByName(null,
"impl-case-12");
Instance instanceCharlie = implementationCharlie.createInstance(null,
new HashMap<String, String>() {
{
put("property-subject-b", "charlie(parent)");
}
});
Implementation implementationDelta = waitForImplByName(null,
"impl-case-12");
Instance instanceDelta = implementationDelta.createInstance(null,
new HashMap<String, String>() {
{
put("property-subject-b", "delta(parent)");
}
});
// Instance of the subject-a (parent)
Instance subjectA = subjectAimpl.createInstance(null, null);
// Force the field to be injected
S6Impl s6parent = (S6Impl) subjectA.getServiceObject();
s6parent.getS6();
// Force the field to be injected
Instance middleInstance = auxListInstanceReferencedBy(s6parent.getS6());
S6Impl s6middle = (S6Impl) middleInstance.getServiceObject();
s6middle.getS6();
// Force the field to be injected
Instance childInstance = auxListInstanceReferencedBy(s6middle.getS6());
S6Impl s6child = (S6Impl) childInstance.getServiceObject();
s6child.getS6();
auxListProperties("\t", subjectA);
System.err.println("-->" + subjectA.getProperty("property-case-12"));
Assert.assertTrue(
String.format(
"Substitution did not find the correct value when navigating through multiple nodes (Expecting %s as property, but found %s)",
subjectA.getProperty("property-case-12"),
childInstance.getProperty("property-subject-b")),
subjectA.getProperty("property-case-12").equals(
childInstance.getProperty("property-subject-b")));
}