Now basing the implementation on a component graph.
[utils] / system / general / src / test / java / org / wamblee / system / container / ContainerTest.java
similarity index 89%
rename from system/general/src/test/java/org/wamblee/system/core/ContainerTest.java
rename to system/general/src/test/java/org/wamblee/system/container/ContainerTest.java
index da8f8350918d4a6df144c4fe4f3b582c0160a35d..95d7e312f0d77ced6cc3c9eceba0d41885d7bee7 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.wamblee.system.core;
+package org.wamblee.system.container;
 
-import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import junit.framework.TestCase;
@@ -27,6 +25,16 @@ import org.easymock.classextension.ConstructorArgs;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.wamblee.general.Pair;
+import org.wamblee.system.core.Component;
+import org.wamblee.system.core.DefaultProvidedInterface;
+import org.wamblee.system.core.DefaultRequiredInterface;
+import org.wamblee.system.core.DefaultScope;
+import org.wamblee.system.core.Environment;
+import org.wamblee.system.core.ProvidedInterface;
+import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.core.Scope;
+import org.wamblee.system.core.StringComponent;
+import org.wamblee.system.core.SystemAssemblyException;
 import org.wamblee.test.AssertionUtils;
 import org.wamblee.test.EasyMockMatchers;
 import org.wamblee.test.EventTracker;
@@ -58,58 +66,6 @@ public class ContainerTest extends TestCase {
         return result;
     }
 
-    public void testFilterProvided() {
-        RequiredInterface req1 = new DefaultRequiredInterface("name",
-                Runnable.class);
-        RequiredInterface req2 = new DefaultRequiredInterface("name",
-                Serializable.class);
-        ProvidedInterface prov1 = new DefaultProvidedInterface("name",
-                Runnable.class);
-        ProvidedInterface prov2 = new DefaultProvidedInterface("name",
-                Serializable.class);
-        ProvidedInterface prov3 = new DefaultProvidedInterface("name",
-                MyMultiple.class);
-
-        Component client = new Application("client");
-        Component dummy = new Application("dummy");
-
-        InterfaceRestriction noRestriction = new InterfaceRestriction() {
-            @Override
-            public boolean isViolated(Component aClient,
-                    RequiredInterface aRequired, Component aServer,
-                    ProvidedInterface aProvided) {
-                return false;
-            }
-        };
-
-        AssertionUtils.assertEquals(new ProvidedInterface[] { prov1 },
-                Container.filterProvidedServices(client, req1,
-                        createProvidedInput(new ProvidedInterface[] { prov1 },
-                                dummy), noRestriction));
-        AssertionUtils.assertEquals(new ProvidedInterface[] { prov1 },
-                Container.filterProvidedServices(client, req1,
-                        createProvidedInput(new ProvidedInterface[] { prov1,
-                                prov2 }, dummy), noRestriction));
-        AssertionUtils.assertEquals(new ProvidedInterface[] { prov1, prov3 },
-                Container.filterProvidedServices(client, req1,
-                        createProvidedInput(new ProvidedInterface[] { prov1,
-                                prov3 }, dummy), noRestriction));
-
-        InterfaceRestriction everything = new InterfaceRestriction() {
-            @Override
-            public boolean isViolated(Component aClient,
-                    RequiredInterface aRequired, Component aServer,
-                    ProvidedInterface aProvided) {
-                return true;
-            }
-        };
-        AssertionUtils.assertEquals(new ProvidedInterface[0], Container
-                .filterProvidedServices(client, req1, createProvidedInput(
-                        new ProvidedInterface[] { prov1, prov3 }, dummy),
-                        everything));
-
-    }
-
     public void testEnvironmentApplication() {
         Environment environment = new Environment(_tracker);
         Application application = new Application(_tracker);