You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by kw...@apache.org on 2008/07/01 21:00:23 UTC

svn commit: r673173 - in /tuscany/java/sca/vtest/assembly: ./ component/ component/src/ component/src/main/ component/src/main/java/ component/src/main/java/org/ component/src/main/java/org/apache/ component/src/main/java/org/apache/tuscany/ component/...

Author: kwilliams
Date: Tue Jul  1 12:00:22 2008
New Revision: 673173

URL: http://svn.apache.org/viewvc?rev=673173&view=rev
Log:
First test for Assembly Model component section

Added:
    tuscany/java/sca/vtest/assembly/component/
    tuscany/java/sca/vtest/assembly/component/pom.xml   (with props)
    tuscany/java/sca/vtest/assembly/component/src/
    tuscany/java/sca/vtest/assembly/component/src/main/
    tuscany/java/sca/vtest/assembly/component/src/main/java/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java   (with props)
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java   (with props)
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java   (with props)
    tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java   (with props)
    tuscany/java/sca/vtest/assembly/component/src/main/resources/
    tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite   (with props)
    tuscany/java/sca/vtest/assembly/component/src/test/
    tuscany/java/sca/vtest/assembly/component/src/test/java/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/
    tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java   (with props)
Modified:
    tuscany/java/sca/vtest/assembly/pom.xml

Added: tuscany/java/sca/vtest/assembly/component/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/pom.xml?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/pom.xml (added)
+++ tuscany/java/sca/vtest/assembly/component/pom.xml Tue Jul  1 12:00:22 2008
@@ -0,0 +1,49 @@
+<?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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>vtest-assembly</artifactId>
+        <version>1.4-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>vtest-assembly-component</artifactId>
+
+    <name>Apache Tuscany SCA Assembly Verification Tests - Component</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+    </dependencies>
+
+
+</project>

Propchange: tuscany/java/sca/vtest/assembly/component/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/vtest/assembly/component/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java (added)
+++ tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java Tue Jul  1 12:00:22 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.    
+ */
+package org.apache.tuscany.sca.vtest.assembly.component;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+    public String getState();
+    public String getBProperty();
+    public String getB2Property();
+
+    
+}

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java (added)
+++ tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java Tue Jul  1 12:00:22 2008
@@ -0,0 +1,29 @@
+/*
+ * 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.    
+ */
+package org.apache.tuscany.sca.vtest.assembly.component;
+
+/**
+ * Simple Service
+ */
+public interface BService {
+
+    public String getState();
+    public String getSomeProperty();
+    
+}

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java (added)
+++ tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java Tue Jul  1 12:00:22 2008
@@ -0,0 +1,49 @@
+/*
+ * 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.    
+ */
+
+package org.apache.tuscany.sca.vtest.assembly.component.impl;
+
+import org.apache.tuscany.sca.vtest.assembly.component.AService;
+import org.apache.tuscany.sca.vtest.assembly.component.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+    @Reference
+    protected BService b;
+    
+    @Reference
+    protected BService b2;
+
+    public String getState() {
+        return b.getState();
+    }
+    
+    public String getBProperty() {
+        return b.getSomeProperty();
+    }
+
+    public String getB2Property() {
+        return b2.getSomeProperty();
+    }
+
+}
+

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java (added)
+++ tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java Tue Jul  1 12:00:22 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.    
+ */
+
+package org.apache.tuscany.sca.vtest.assembly.component.impl;
+
+import org.apache.tuscany.sca.vtest.assembly.component.BService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+    
+    @Property
+    protected String someProperty;
+
+    public String getState() {
+        return "SomeStateFromB";
+    }
+    
+    public String getSomeProperty() {
+        return someProperty;
+    }
+
+} 

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite (added)
+++ tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite Tue Jul  1 12:00:22 2008
@@ -0,0 +1,41 @@
+<?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-component--Composite">
+
+    <component name="AComponent">
+	    <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.AServiceImpl"/>
+	    <reference name="b" target="BComponent"/>
+	    <reference name="b2" target="B2Component"/>
+     </component>
+
+    <component name="BComponent">
+        <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+        <property name="someProperty">some b component value</property>
+    </component>
+    
+    <component name="B2Component">
+        <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+        <property name="someProperty">some b2 component value</property>
+    </component>
+    
+</composite>

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/vtest/assembly/component/src/main/resources/component.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java?rev=673173&view=auto
==============================================================================
--- tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java (added)
+++ tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java Tue Jul  1 12:00:22 2008
@@ -0,0 +1,70 @@
+/*
+ * 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.    
+ */
+
+package org.apache.tuscany.sca.vtest.assembly.component;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+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:
+     * <p>
+     * Components are configured instances of implementations. Components
+     * provide and consume services. More than one component can use and
+     * configure the same implementation, where each component configures the
+     * implementation differently.
+     */
+    @Test
+    public void component1() throws Exception {
+        Assert.assertEquals("some b component value", aService.getBProperty());
+        Assert.assertEquals("some b2 component value", aService.getB2Property());
+    }
+
+}

Propchange: tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/vtest/assembly/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/vtest/assembly/pom.xml?rev=673173&r1=673172&r2=673173&view=diff
==============================================================================
--- tuscany/java/sca/vtest/assembly/pom.xml (original)
+++ tuscany/java/sca/vtest/assembly/pom.xml Tue Jul  1 12:00:22 2008
@@ -61,6 +61,7 @@
             </activation>
             <modules>
                 <module>ctypefile</module>
+                <module>component</module>
            </modules>
         </profile>
     </profiles>