diff options
Diffstat (limited to 'java/sca/vtest/assembly/component')
3 files changed, 49 insertions, 27 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://assembly-tests" + name="Assemby-zero-components-Composite"> + + +</composite> 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: * <p> * 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: + * <p> + * 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(); } } |