Component module1 = MockFactory.createCompositeComponent("module1");
runtime.registerModelObject(module1);
Component module2 = MockFactory.createCompositeComponent("module2");
runtime.registerModelObject(module2);
CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1");
CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2");
Component component1 = factory.createSystemComponent("Component1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
EntryPoint entryPoint1 = MockFactory.createEPSystemBinding("EntryPoint1", ModuleScopeSystemComponent.class, "Component1", component1);
ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2");
moduleContext1.registerModelObject(component1);
moduleContext1.registerModelObject(entryPoint1);
moduleContext1.registerModelObject(externalService1);
Component component2 = factory.createSystemComponent("Component2", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
EntryPoint entryPoint2 = MockFactory.createEPSystemBinding("EntryPoint2", ModuleScopeSystemComponent.class, "Component2", component2);
ExternalService externalService2 = MockFactory.createESSystemBinding("ExternalService2", "module1/EntryPoint1");
moduleContext2.registerModelObject(component2);
moduleContext2.registerModelObject(entryPoint2);
moduleContext2.registerModelObject(externalService2);
moduleContext1.publish(new ModuleStart(this));
moduleContext2.publish(new ModuleStart(this));
Assert.assertNotNull(moduleContext2.getContext("ExternalService2").getInstance(null));
Assert.assertNotNull(moduleContext1.getContext("ExternalService1").getInstance(null));
}