X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=trunk%2Fsystem%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FContainerTest.java;h=bcca8cc11bb823c37f01232e81dc78dc2767c76f;hb=f173c759786855c3d55110e37edac4a5e108a64a;hp=27a1937ff59f4f7e845022f1bb056397d3c3aa20;hpb=9dc3759548b277bdf34f1335ce540588aae8ea89;p=utils diff --git a/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java b/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java index 27a1937f..bcca8cc1 100644 --- a/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java +++ b/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java @@ -16,25 +16,16 @@ package org.wamblee.system.core; import java.io.Serializable; -import java.util.ArrayList; import java.util.Arrays; +import junit.framework.TestCase; + import org.easymock.classextension.ConstructorArgs; import org.easymock.classextension.EasyMock; import org.easymock.classextension.IMocksControl; -import org.wamblee.system.core.Component; -import org.wamblee.system.core.Container; -import org.wamblee.system.core.DefaultProvidedInterface; -import org.wamblee.system.core.DefaultRequiredInterface; -import org.wamblee.system.core.ProvidedInterface; -import org.wamblee.system.core.RequiredInterface; -import org.wamblee.system.core.SystemAssemblyException; -import org.wamblee.system.core.Component.Status; import org.wamblee.test.AssertionUtils; import org.wamblee.test.EventTracker; -import junit.framework.TestCase; - public class ContainerTest extends TestCase { private EventTracker _tracker; @@ -86,8 +77,8 @@ public class ContainerTest extends TestCase { } public void testEnvironmentApplication() { - Component environment = new Environment(_tracker); - Component application = new Application(_tracker); + Environment environment = new Environment(_tracker); + Application application = new Application(_tracker); Container container = new Container("root", new Component[] { environment, application }, new ProvidedInterface[0], new RequiredInterface[0]); @@ -100,6 +91,9 @@ public class ContainerTest extends TestCase { assertEquals(2, envServices.length); ProvidedInterface[] appServices = application.getRunningInterfaces(); assertEquals(0, appServices.length); + + assertEquals(environment.getString(), application.getString()); + assertEquals(environment.getInteger(), application.getInteger()); } @@ -122,21 +116,15 @@ public class ContainerTest extends TestCase { Component environment = new Environment(_tracker); Component application = new Application(_tracker); assertEquals(0, _tracker.getEventCount()); - assertEquals(Status.NOT_STARTED, environment.getStatus()); - assertEquals(Status.NOT_STARTED, application.getStatus()); Container system = new Container("all", new Component[] { environment, application }, new ProvidedInterface[0], new RequiredInterface[0]); - assertEquals(Status.NOT_STARTED, system.getStatus()); system.start(); RequiredInterface[] required = system.getRequiredInterfaces(); assertEquals(0, required.length); ProvidedInterface[] provided = system.getProvidedInterfaces(); assertEquals(0, provided.length); - assertEquals(Status.RUNNING, environment.getStatus()); - assertEquals(Status.RUNNING, application.getStatus()); - assertEquals(Status.RUNNING, system.getStatus()); AssertionUtils.assertEquals(new String[] { "start.environment", "start.application" }, _tracker.getEvents( @@ -144,10 +132,6 @@ public class ContainerTest extends TestCase { _tracker.clear(); system.stop(); - assertEquals(Status.STOPPED, environment.getStatus()); - assertEquals(Status.STOPPED, application.getStatus()); - assertEquals(Status.STOPPED, system.getStatus()); - AssertionUtils.assertEquals(new String[] { "stop.application", "stop.environment" }, _tracker .getEvents(Thread.currentThread()).toArray(new String[0])); @@ -161,7 +145,7 @@ public class ContainerTest extends TestCase { Container system = new Container("all", new Component[] { environment, application }, new ProvidedInterface[] { new DefaultProvidedInterface( - "string", String.class) }, + "float", Float.class) }, new DefaultRequiredInterface[0]); } catch (SystemAssemblyException e) { return; @@ -190,9 +174,9 @@ public class ContainerTest extends TestCase { Container system = new Container("all", new Component[] { environment, application }, new ProvidedInterface[0], new RequiredInterface[] { new DefaultRequiredInterface( - "string", String.class) }); + "float", Float.class) }); system.getRequiredInterfaces()[0] - .setProvider(new DefaultProvidedInterface("hallo", String.class)); + .setProvider(new DefaultProvidedInterface("hallo", Float.class)); system.start(); RequiredInterface[] required = system.getRequiredInterfaces(); assertEquals(1, required.length);