X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcontainer%2FContainerTest.java;fp=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcontainer%2FContainerTest.java;h=bda07b218a62d5b64c9b4ab0c0ea476e1149e0a3;hb=0d8d8f24656e585ee75558cfd6a4c661f8f14985;hp=a7589fe46250eff9561c11ec987e1a52071e0f56;hpb=da48a523c81e59fe0eac34e43d12937396161f25;p=utils diff --git a/system/general/src/test/java/org/wamblee/system/container/ContainerTest.java b/system/general/src/test/java/org/wamblee/system/container/ContainerTest.java index a7589fe4..bda07b21 100644 --- a/system/general/src/test/java/org/wamblee/system/container/ContainerTest.java +++ b/system/general/src/test/java/org/wamblee/system/container/ContainerTest.java @@ -37,12 +37,12 @@ import org.wamblee.test.EventTracker; public class ContainerTest extends TestCase { - private EventTracker _tracker; + private EventTracker tracker; @Override protected void setUp() throws Exception { super.setUp(); - _tracker = new EventTracker(); + tracker = new EventTracker(); } private static class MyMultiple implements Serializable, Runnable { @@ -63,15 +63,15 @@ public class ContainerTest extends TestCase { } public void testEnvironmentApplication() { - Environment environment = new Environment(_tracker); - Application 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]); Scope scope = container.start(); assertTrue(container.isSealed()); AssertionUtils.assertEquals(new String[] { "start.environment", - "start.application" }, _tracker.getEvents( + "start.application" }, tracker.getEvents( Thread.currentThread()).toArray(new String[0])); assertEquals(0, scope.getProvidedInterfaces().size()); @@ -81,14 +81,14 @@ public class ContainerTest extends TestCase { } public void testEnvironmentApplicationSimpleConstructor() { - Environment environment = new Environment(_tracker); - Application application = new Application(_tracker); + Environment environment = new Environment(tracker); + Application application = new Application(tracker); Container container = new Container("root").addComponent(environment) .addComponent(application); Scope scope = container.start(); AssertionUtils.assertEquals(new String[] { "start.environment", - "start.application" }, _tracker.getEvents( + "start.application" }, tracker.getEvents( Thread.currentThread()).toArray(new String[0])); assertEquals(0, scope.getProvidedInterfaces().size()); @@ -113,9 +113,9 @@ public class ContainerTest extends TestCase { } public void testComposite() { - Component environment = new Environment(_tracker); - Component application = new Application(_tracker); - assertEquals(0, _tracker.getEventCount()); + Component environment = new Environment(tracker); + Component application = new Application(tracker); + assertEquals(0, tracker.getEventCount()); Container system = new Container("all", new Component[] { environment, application }, new ProvidedInterface[0], @@ -127,13 +127,13 @@ public class ContainerTest extends TestCase { assertEquals(0, provided.size()); AssertionUtils.assertEquals(new String[] { "start.environment", - "start.application" }, _tracker.getEvents( + "start.application" }, tracker.getEvents( Thread.currentThread()).toArray(new String[0])); - _tracker.clear(); + tracker.clear(); system.stop(runtime); AssertionUtils.assertEquals(new String[] { "stop.application", - "stop.environment" }, _tracker + "stop.environment" }, tracker .getEvents(Thread.currentThread()).toArray(new String[0])); } @@ -276,7 +276,7 @@ public class ContainerTest extends TestCase { public void testEnvironmentApplicationRollbackOnException() throws Exception { - Environment environment = new Environment(_tracker); + Environment environment = new Environment(tracker); Application application = new Application() { @Override public Object doStart(Scope aScope) { @@ -292,7 +292,7 @@ public class ContainerTest extends TestCase { container.start(); } catch (RuntimeException e) { AssertionUtils.assertEquals(new String[] { "start.environment", - "stop.environment" }, _tracker.getEvents( + "stop.environment" }, tracker.getEvents( Thread.currentThread()).toArray(new String[0])); return; } @@ -302,7 +302,7 @@ public class ContainerTest extends TestCase { public void testEnvironmentApplicationRollbackOnExceptionWithExceptionOnStop() throws Exception { - Environment environment = new Environment(_tracker); + Environment environment = new Environment(tracker); // Application 1 will throw an exception while stopping. Application application1 = new Application("app1") { @Override @@ -326,7 +326,7 @@ public class ContainerTest extends TestCase { container.start(); } catch (RuntimeException e) { AssertionUtils.assertEquals(new String[] { "start.environment", - "stop.environment" }, _tracker.getEvents( + "stop.environment" }, tracker.getEvents( Thread.currentThread()).toArray(new String[0])); return; } @@ -542,7 +542,7 @@ public class ContainerTest extends TestCase { } public void testProvidedInterfaces() { - Environment env = new Environment(_tracker); + Environment env = new Environment(tracker); Container envcontainer = new Container("0").addComponent(env) .addProvidedInterface( new DefaultProvidedInterface("string", String.class)) @@ -551,21 +551,21 @@ public class ContainerTest extends TestCase { Scope scope = envcontainer.start(); AssertionUtils.assertEquals(new String[] { "start.environment" }, - _tracker.getEvents(Thread.currentThread()).toArray( + tracker.getEvents(Thread.currentThread()).toArray( new String[0])); envcontainer.stop(scope); } public void testCoupleTwoContainers() { - Environment env = new Environment(_tracker); + Environment env = new Environment(tracker); Container envcontainer = new Container("0").addComponent(env) .addProvidedInterface( new DefaultProvidedInterface("string", String.class)) .addProvidedInterface( new DefaultProvidedInterface("integer", Integer.class)); - Application app = new Application(_tracker); + Application app = new Application(tracker); Container appcontainer = new Container("1").addComponent(app) .addRequiredInterface( new DefaultRequiredInterface("string", String.class)) @@ -577,7 +577,7 @@ public class ContainerTest extends TestCase { top.start(); AssertionUtils.assertEquals(new String[] { "start.environment", - "start.application" }, _tracker.getEvents( + "start.application" }, tracker.getEvents( Thread.currentThread()).toArray(new String[0])); }