assertEquals(env1.getString(), app.getString());
assertFalse(env2.getString().equals(app.getString()));
}
+
+ public void testProvidedInDifferentScopes() {
+ // Scoping problem occurred. Externally and internally provided components clashed
+ // because unique id generation in the scope was wrong.
+
+ StringComponent str = new StringComponent("string");
+ Application app = new Application("app");
+ Container container = new Container("top").addComponent(str).addComponent(app);
+ container.addRequiredInterface(new DefaultRequiredInterface("integer", Integer.class));
+
+ ProvidedInterface provided = new DefaultProvidedInterface("hallo", Integer.class);
+ container.getRequiredInterfaces()[0]
+ .setProvider(provided);
+
+ Scope external = new DefaultScope(new ProvidedInterface[0]);
+ external.publishInterface(provided, 100);
+ Scope scope = container.start(external);
+ }
}