X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FContainerTest.java;h=90723ed1c93c4f6271448cf19622ed0eb8166dbe;hb=177ce1a304daf669142a93b71950d676922faf96;hp=7eb66757772fb31d1746e6348855c242d1eaf94e;hpb=ce71ffcb89bd0ed7f1fc73cebec1b0e7659e6028;p=utils diff --git a/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java b/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java index 7eb66757..90723ed1 100644 --- a/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java +++ b/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java @@ -84,7 +84,6 @@ public class ContainerTest extends TestCase { 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", @@ -164,6 +163,7 @@ public class ContainerTest extends TestCase { new ProvidedInterface[] { new DefaultProvidedInterface( "float", Float.class) }, new DefaultRequiredInterface[0]); + system.validate(); } catch (SystemAssemblyException e) { return; } @@ -215,6 +215,30 @@ public class ContainerTest extends TestCase { fail(); } + + public void testDuplicateComponent() { + try { + Component comp1 = new Application(); + Component comp2 = new Application(); + Container system = new Container("top"); + system.addComponent(comp1).addComponent(comp2); + } catch (SystemAssemblyException e) { + return; + } + fail(); + } + + + public void testInconsistentHierarchy() { + try { + Component comp = new Application(); + Container system = new Container("top").addComponent(comp); + Container system2 = new Container("top2").addComponent(comp); + } catch (SystemAssemblyException e) { + return; + } + fail(); + } public void testCompositeWithExternalDependencesProvided() { @@ -309,7 +333,7 @@ public class ContainerTest extends TestCase { // application 2 will throw an exception while starting Application application2 = control.createMock(Application.class, - new ConstructorArgs(Application.class.getConstructor()), + new ConstructorArgs(Application.class.getConstructor(String.class), "application2"), Application.class.getDeclaredMethod("doStart", Scope.class)); application2.doStart(EasyMockMatchers.anyObject(Scope.class));