HibernateUserAdministrationTest now based on the component mechanism.
[utils] / system / general / src / test / java / org / wamblee / system / core / ContainerTest.java
index 4c451337f7cbe027c03922687059e45f0ae88365..2104e3a94e3dbba93db6d6de0c19cfe11983cf75 100644 (file)
@@ -504,4 +504,22 @@ public class ContainerTest extends TestCase {
         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);
+    }
 }