From 19e73be43d7e2ff9d75c6f6aff56abba57ff5c55 Mon Sep 17 00:00:00 2001 From: kwilliams Date: Tue, 1 Jul 2008 22:21:44 +0000 Subject: Another Assembly Model test git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@673222 13f79535-47bb-0310-9956-ffa450edef68 --- .../assembly/component/impl/BServiceImpl.java | 2 +- .../src/main/resources/zerocomponents.composite | 26 ++++++++++++ .../assembly/component/ComponentTestCase.java | 48 ++++++++++------------ 3 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 java/sca/vtest/assembly/component/src/main/resources/zerocomponents.composite (limited to 'java/sca/vtest/assembly') diff --git a/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java b/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java index ad0406daaf..424e245fea 100644 --- a/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java +++ b/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java @@ -26,7 +26,7 @@ import org.osoa.sca.annotations.Service; @Service(BService.class) public class BServiceImpl implements BService { - @Property + @Property protected String someProperty; public String getState() { diff --git a/java/sca/vtest/assembly/component/src/main/resources/zerocomponents.composite b/java/sca/vtest/assembly/component/src/main/resources/zerocomponents.composite new file mode 100644 index 0000000000..6f02d7e941 --- /dev/null +++ b/java/sca/vtest/assembly/component/src/main/resources/zerocomponents.composite @@ -0,0 +1,26 @@ + + + + + + diff --git a/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java b/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java index 7788e69381..84e141c031 100644 --- a/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java +++ b/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java @@ -31,30 +31,8 @@ import org.junit.Test; */ public class ComponentTestCase { - protected static String compositeName = "component.composite"; - protected static AService aService = null; - - @BeforeClass - public static void init() throws Exception { - try { - System.out.println("Setting up"); - ServiceFinder.init(compositeName); - aService = ServiceFinder.getService(AService.class, "AComponent/AService"); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - - System.out.println("Cleaning up"); - ServiceFinder.cleanup(); - - } - /** - * Lines 92-94: + * Lines 92-96: *

* Components are configured instances of implementations. Components * provide and consume services. More than one component can use and @@ -62,9 +40,27 @@ public class ComponentTestCase { * implementation differently. */ @Test - public void component1() throws Exception { - Assert.assertEquals("some b component value", aService.getBProperty()); - Assert.assertEquals("some b2 component value", aService.getB2Property()); + public void components1() throws Exception { + System.out.println("Setting up"); + ServiceFinder.init("component.composite"); + AService service = ServiceFinder.getService(AService.class, "AComponent/AService"); + Assert.assertEquals("some b component value", service.getBProperty()); + Assert.assertEquals("some b2 component value", service.getB2Property()); + System.out.println("Cleaning up"); + ServiceFinder.cleanup(); + } + + /** + * Lines 96-97: + *

+ * There can be zero or more component elements within a composite. + */ + @Test + public void components2() throws Exception { + System.out.println("Setting up"); + ServiceFinder.init("zerocomponents.composite"); + System.out.println("Cleaning up"); + ServiceFinder.cleanup(); } } -- cgit v1.2.3