Author: edwardsmj
Date: Fri Nov 28 01:43:41 2008
New Revision: 721404

URL: http://svn.apache.org/viewvc?rev=721404&view=rev
Log:
New Folder for OASIS Specification conformance tests

Added:
    tuscany/java/sca/stest/sampleTest/pom.xml
    tuscany/java/sca/stest/sampleTest/src/
    tuscany/java/sca/stest/sampleTest/src/main/
    tuscany/java/sca/stest/sampleTest/src/main/java/
    tuscany/java/sca/stest/sampleTest/src/main/java/test/
    tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java
    tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java
    tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java
    tuscany/java/sca/stest/sampleTest/src/main/java/test/Service1.java
    tuscany/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java
    tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java
    tuscany/java/sca/stest/sampleTest/src/main/resources/
    tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite
    tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite
    tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite
    tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite
    tuscany/java/sca/stest/sampleTest/src/test/
    tuscany/java/sca/stest/sampleTest/src/test/java/
    tuscany/java/sca/stest/sampleTest/src/test/java/client/
    tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTest.java
    tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseTest.java
    
tuscany/java/sca/stest/sampleTest/src/test/java/client/TestConfiguration.java
    tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0002.java
    tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0003.java
    tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0004.java

Added: tuscany/java/sca/stest/sampleTest/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/pom.xml?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/pom.xml (added)
+++ tuscany/java/sca/stest/sampleTest/pom.xml Fri Nov 28 01:43:41 2008
@@ -0,0 +1,91 @@
+<?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>tuscany-sca</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>stest-sampleTest</artifactId>
+    <name>Apache Tuscany SCA Specification Sample Testcase</name>
+
+    <repositories>
+       <repository>
+          <id>apache.incubator</id>
+          <url>http://people.apache.org/repo/m2-incubating-repository</url>
+       </repository>
+    </repositories>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-launcher-equinox</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>   
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-node-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-extensibility-equinox</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+</project>

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,49 @@
+package test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Basic test initiation class
+ * @author MikeEdwards
+ *
+ */
[EMAIL PROTECTED](TestInvocation.class)
+public class ASM_0001_Client implements TestInvocation {
+       
+       private String testName = "ASM_0001";
+       
+       /**
+        * This method is offered as a service and is 
+        * invoked by the test client to run the test
+        */
+       public String invokeTest( String input ) {
+               String response = null;
+               
+               response = runTest( input );
+               
+               return response;
+       } // end method invokeTest
+       
+       /**
+        * This method actually runs the test - and is subclassed by classes 
that run other tests.
+        * @param input - an input string
+        * @return - a response string = "ASM_0001 inputString invoked ok";
+        * 
+        */
+       public String runTest( String input ){
+               String response = null;
+               
+               response = testName + " " + input + " invoked ok";
+               
+               return response;
+       } // end method runTest
+       
+       /**
+        * Sets the name of the test
+        * @param name - the test name
+        */
+       protected void setTestName( String name ) {
+               testName = name;
+       }
+
+} // 

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,57 @@
+package test;
+
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Test initiation class with a single reference of multiplicity 1..1
+ * @author MikeEdwards
+ *
+ */
[EMAIL PROTECTED](TestInvocation.class)
+public class ASM_0002_Client implements TestInvocation {
+       
+       @Property
+       private String testName = "ASM_xxxx";
+       
+       @Reference
+       public Service1 reference1;
+       
+       /**
+        * This method is offered as a service and is 
+        * invoked by the test client to run the test
+        */
+       public String invokeTest( String input ) {
+               String response = null;
+               
+               response = runTest( input );
+               
+               return response;
+       } // end method invokeTest
+       
+       /**
+        * This method actually runs the test - and is subclassed by classes 
that run other tests.
+        * @param input - an input string
+        * @return - a response string = "ASM_0001 inputString invoked ok";
+        * 
+        */
+       public String runTest( String input ){
+               String response = null;
+               
+               String response1 = reference1.operation1(input);
+               
+               response = testName + " " + input + " " + response1;
+               
+               return response;
+       } // end method runTest
+       
+       /**
+        * Sets the name of the test
+        * @param name - the test name
+        */
+       protected void setTestName( String name ) {
+               testName = name;
+       }
+
+} // 

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,61 @@
+package test;
+
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Property;
+
+import java.util.List;
+
+/**
+ * Basic test initiation class
+ * @author MikeEdwards
+ *
+ */
[EMAIL PROTECTED](TestInvocation.class)
+public class ASM_0003_Client implements TestInvocation {
+       
+       @Property
+       private String testName = "ASM_xxxx";
+       
+       @Reference
+       public List<Service1> reference1;
+       
+       /**
+        * This method is offered as a service and is 
+        * invoked by the test client to run the test
+        */
+       public String invokeTest( String input ) {
+               String response = null;
+               
+               response = runTest( input );
+               
+               return response;
+       } // end method invokeTest
+       
+       /**
+        * This method actually runs the test - and is subclassed by classes 
that run other tests.
+        * @param input - an input string
+        * @return - a response string = "ASM_0001 inputString invoked ok";
+        * 
+        */
+       public String runTest( String input ){
+               String response = "";
+               
+               for( Service1 reference : reference1 ) {
+                       response += reference.operation1(input);
+               }  // end for
+               
+               response = testName + " " + input + " " + response;
+               
+               return response;
+       } // end method runTest
+       
+       /**
+        * Sets the name of the test
+        * @param name - the test name
+        */
+       protected void setTestName( String name ) {
+               testName = name;
+       }
+
+} // 

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/Service1.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/Service1.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/Service1.java (added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/Service1.java Fri Nov 
28 01:43:41 2008
@@ -0,0 +1,17 @@
+package test;
+
+/**
+ * A test service interface
+ * @author MikeEdwards
+ *
+ */
+public interface Service1 {
+       
+       /**
+        * Method for invoking testcase service
+        * @param input - input parameter(s) as a String
+        * @return - output data as a String
+        */
+       public String operation1( String input );
+
+}

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,17 @@
+package test;
+
+/**
+ * Basic interface to invoke testcases
+ * @author MikeEdwards
+ *
+ */
+public interface TestInvocation {
+       
+       /**
+        * Method for invoking testcase
+        * @param input - input parameter(s) as a String
+        * @return - output data as a String
+        */
+       public String invokeTest( String input );
+
+}

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java Fri 
Nov 28 01:43:41 2008
@@ -0,0 +1,20 @@
+package test;
+
+import org.osoa.sca.annotations.*;
+
+/**
+ * Simple Java component implementation for business interface Service1
+ * @author MikeEdwards
+ *
+ */
[EMAIL PROTECTED](Service1.class)
+public class service1Impl implements Service1 {
+       
+       @Property
+       public String serviceName = "service1";
+
+       public String operation1(String input) {
+               return serviceName + " operation1 invoked";
+       }
+
+}

Added: 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite?rev=721404&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,40 @@
+<?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";
+           targetNamespace="http://oasis/tests";
+           xmlns:sample="http://oasis/tests";
+           name="TEST_ASM_0001">
+           
+    <component name="TestClient">
+               <implementation.java class="test.ASM_0001_Client"/>
+               <service name="TestInvocation">
+                       <interface.java interface="test.TestInvocation"/>
+               </service>
+        <!--  reference name="testRef1" target="TestComponent1/service1" / -->
+    </component>
+
+<!--  
+    <component name="TestComponent1">
+               <implementation.java class="test.ASM_0001_Impl1"/>
+        <service name="service1"/>
+    </component>
+-->
+
+</composite>

Added: 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite?rev=721404&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,42 @@
+<?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";
+           targetNamespace="http://oasis/tests";
+           xmlns:sample="http://oasis/tests";
+           name="TEST_ASM_0002">
+           
+    <component name="TestClient">
+               <implementation.java class="test.ASM_0002_Client"/>
+               <service name="TestInvocation">
+                       <interface.java interface="test.TestInvocation"/>
+               </service>
+        <reference name="reference1" target="TestComponent1/Service1" />
+        <property name="testName">ASM_0002</property>
+    </component>
+
+ 
+    <component name="TestComponent1">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+    </component>
+
+</composite>

Added: 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite?rev=721404&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,59 @@
+<?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";
+           targetNamespace="http://oasis/tests";
+           xmlns:sample="http://oasis/tests";
+           name="TEST_ASM_0003">
+           
+    <component name="TestClient">
+               <implementation.java class="test.ASM_0003_Client"/>
+               <service name="TestInvocation">
+                       <interface.java interface="test.TestInvocation"/>
+               </service>
+        <reference name="reference1" target="TestComponent1/Service1 
TestComponent2/Service1 TestComponent3/Service1" />
+        <property name="testName">ASM_0003</property>
+    </component>
+
+ 
+    <component name="TestComponent1">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+        <property name="serviceName">service1</property>
+    </component>
+    
+    <component name="TestComponent2">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+        <property name="serviceName">service2</property>
+    </component>
+    
+    <component name="TestComponent3">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+        <property name="serviceName">service3</property>
+    </component>
+
+</composite>

Added: 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite?rev=721404&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,61 @@
+<?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.    
+-->
+<!-- Test that verifies that a reference with multiplicity 1..1 which is 
provided
+        with multiple wire targets in the component configuration is marked as 
an error  -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+           targetNamespace="http://oasis/tests";
+           xmlns:sample="http://oasis/tests";
+           name="TEST_ASM_0004">
+           
+    <component name="TestClient">
+               <implementation.java class="test.ASM_0002_Client"/>
+               <service name="TestInvocation">
+                       <interface.java interface="test.TestInvocation"/>
+               </service>
+        <reference name="reference1" target="TestComponent1/Service1 
TestComponent2/Service1 TestComponent3/Service1" />
+        <property name="testName">ASM_0004</property>
+    </component>
+
+ 
+    <component name="TestComponent1">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+        <property name="serviceName">service1</property>
+    </component>
+    
+    <component name="TestComponent2">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+        <property name="serviceName">service2</property>
+    </component>
+    
+    <component name="TestComponent3">
+               <implementation.java class="test.service1Impl"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"></interface.java>
+        </service>
+        <property name="serviceName">service3</property>
+    </component>
+
+</composite>

Added: tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTest.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTest.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTest.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTest.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,122 @@
+/*
+ * 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 client;
+
+import static org.junit.Assert.*;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.equinox.launcher.Contribution;
+import org.apache.tuscany.sca.node.equinox.launcher.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.annotations.Reference;
+
+import test.ASM_0001_Client;
+import test.TestInvocation;
+
+/**
+ * A generic test client based on JAX-WS APIs
+ */
+public class BaseJAXWSTest {
+
+    protected NodeLauncher launcher;
+    protected Node node;
+    protected TestConfiguration testConfiguration = getTestConfiguration();
+    
+    public static void main(String[] args) throws Exception {
+       BaseJAXWSTest test = new BaseJAXWSTest(); 
+       test.setUp();
+       test.tearDown();
+    }
+    
+    @Before
+    public void setUp() throws Exception {     
+       startContribution();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+       stopContribution();
+    }
+
+    @Test
+    public void testDummy() throws Exception {
+       // System.out.println("Test " + testName + " starting");
+       try {
+               String output = invokeTest( testConfiguration.getInput() );
+               assertEquals( output, testConfiguration.getExpectedOutput() );
+       } catch (Exception e) {
+               assertEquals( "exception", 
testConfiguration.getExpectedOutput() );
+               System.out.println( "Expected exception - detail: " + 
e.getMessage() );
+       }
+       System.out.println("Test " + testConfiguration.getTestName() + " 
completed successfully");
+    }
+    
+    public String invokeTest( String input ) {
+
+       TestInvocation service = (TestInvocation) getService( 
testConfiguration.getServiceInterface(), 
+                                                                               
                                  testConfiguration.getTestServiceName() );     
+       
+       return service.invokeTest( input );
+    } // end method invokeTest
+    
+    protected <T> T getService( Class<T> interfaze, String serviceName ) {
+       T service = node.getService( interfaze, serviceName );
+       return service;
+    } // end getService
+    
+    protected void startContribution() throws Exception {
+       // Tuscany specific code which starts the contribution holding the test
+        launcher = NodeLauncher.newInstance();
+        node = launcher.createNode(testConfiguration.getComposite(), 
+                                          new 
Contribution(testConfiguration.getTestName(), getContributionURI()));
+        System.out.println("SCA Node API ClassLoader: " + 
node.getClass().getClassLoader());
+        node.start();
+    } // end method startContribution
+    
+    protected void stopContribution() throws Exception {
+        if (node != null) {
+            node.stop();
+            node.destroy();
+        }
+        if (launcher != null) {
+            launcher.destroy();
+        }
+    } // end method stopContribution
+    
+    protected String getContributionURI() {
+       String location = 
ContributionLocationHelper.getContributionLocation(testConfiguration.getTestClass());
+       return location;
+    }
+    
+    protected TestConfiguration getTestConfiguration() {
+       TestConfiguration config = new TestConfiguration();
+       config.testName                 = "ASM_0001";
+       config.input                    = "request";
+       config.output                   = config.testName + " " + config.input 
+ " invoked ok";
+       config.composite                = "Test_ASM_0001.composite";
+       config.testServiceName  = "TestClient";
+       config.testClass                = ASM_0001_Client.class;
+       config.serviceInterface = TestInvocation.class;
+       return config;
+    }
+    
+} // end class BaseTest

Added: tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseTest.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseTest.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseTest.java (added)
+++ tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseTest.java Fri 
Nov 28 01:43:41 2008
@@ -0,0 +1,122 @@
+/*
+ * 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 client;
+
+import static org.junit.Assert.*;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.equinox.launcher.Contribution;
+import org.apache.tuscany.sca.node.equinox.launcher.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.annotations.Reference;
+
+import test.ASM_0001_Client;
+import test.TestInvocation;
+
+/**
+ * A generic test client based on Tuscany APIs
+ */
+public class BaseTest {
+
+    protected NodeLauncher launcher;
+    protected Node node;
+    protected TestConfiguration testConfiguration = getTestConfiguration();
+    
+    public static void main(String[] args) throws Exception {
+       BaseTest test = new BaseTest(); 
+       test.setUp();
+       test.tearDown();
+    }
+    
+    @Before
+    public void setUp() throws Exception {     
+       startContribution();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+       stopContribution();
+    }
+
+    @Test
+    public void testDummy() throws Exception {
+       // System.out.println("Test " + testName + " starting");
+       try {
+               String output = invokeTest( testConfiguration.getInput() );
+               assertEquals( output, testConfiguration.getExpectedOutput() );
+       } catch (Exception e) {
+               assertEquals( "exception", 
testConfiguration.getExpectedOutput() );
+               System.out.println( "Expected exception - detail: " + 
e.getMessage() );
+       }
+       System.out.println("Test " + testConfiguration.getTestName() + " 
completed successfully");
+    }
+    
+    public String invokeTest( String input ) {
+
+       TestInvocation service = (TestInvocation) getService( 
testConfiguration.getServiceInterface(), 
+                                                                               
                                  testConfiguration.getTestServiceName() );     
+       
+       return service.invokeTest( input );
+    } // end method invokeTest
+    
+    protected <T> T getService( Class<T> interfaze, String serviceName ) {
+       T service = node.getService( interfaze, serviceName );
+       return service;
+    } // end getService
+    
+    protected void startContribution() throws Exception {
+       // Tuscany specific code which starts the contribution holding the test
+        launcher = NodeLauncher.newInstance();
+        node = launcher.createNode(testConfiguration.getComposite(), 
+                                          new 
Contribution(testConfiguration.getTestName(), getContributionURI()));
+        System.out.println("SCA Node API ClassLoader: " + 
node.getClass().getClassLoader());
+        node.start();
+    } // end method startContribution
+    
+    protected void stopContribution() throws Exception {
+        if (node != null) {
+            node.stop();
+            node.destroy();
+        }
+        if (launcher != null) {
+            launcher.destroy();
+        }
+    } // end method stopContribution
+    
+    protected String getContributionURI() {
+       String location = 
ContributionLocationHelper.getContributionLocation(testConfiguration.getTestClass());
+       return location;
+    }
+    
+    protected TestConfiguration getTestConfiguration() {
+       TestConfiguration config = new TestConfiguration();
+       config.testName                 = "ASM_0001";
+       config.input                    = "request";
+       config.output                   = config.testName + " " + config.input 
+ " invoked ok";
+       config.composite                = "Test_ASM_0001.composite";
+       config.testServiceName  = "TestClient";
+       config.testClass                = ASM_0001_Client.class;
+       config.serviceInterface = TestInvocation.class;
+       return config;
+    }
+    
+} // end class BaseTest

Added: 
tuscany/java/sca/stest/sampleTest/src/test/java/client/TestConfiguration.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/TestConfiguration.java?rev=721404&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/test/java/client/TestConfiguration.java 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/test/java/client/TestConfiguration.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,30 @@
+package client;
+
+import test.ASM_0001_Client;
+import test.TestInvocation;
+
+/** 
+ * A class to hold the metadata about the test
+ * @author MikeEdwards
+ *
+ */
+class TestConfiguration {
+       
+       public String testName;
+       public String input;
+       public String output;
+       public String composite;
+       public String testServiceName;
+       public Class<?> testClass;              //TODO - does the client need 
this??
+       public Class<?> serviceInterface;
+
+       public TestConfiguration() { }
+       
+       public String getTestName() { return testName; }
+       public String getInput() { return input; }
+       public String getExpectedOutput() { return output; }
+       public String getComposite() { return composite; }
+       public String getTestServiceName() { return testServiceName; }
+       public Class<?> getTestClass() { return testClass; }
+       public Class<?> getServiceInterface() { return serviceInterface; }
+}
\ No newline at end of file

Added: tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0002.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0002.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0002.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0002.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,43 @@
+/*
+ * 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 client;
+
+
+import test.ASM_0002_Client;
+import test.TestInvocation;
+
+/**
+ * A generic test client based on Tuscany APIs
+ */
+public class Test_ASM_0002 extends BaseTest {
+
+ 
+    protected TestConfiguration getTestConfiguration() {
+       TestConfiguration config = new TestConfiguration();
+       config.testName                 = "ASM_0002";
+       config.input                    = "request";
+       config.output                   = config.testName + " " + config.input 
+ " service1 operation1 invoked";
+       config.composite                = "Test_ASM_0002.composite";
+       config.testServiceName  = "TestClient";
+       config.testClass                = ASM_0002_Client.class;
+       config.serviceInterface = TestInvocation.class;
+       return config;
+    }
+    
+} // end class Test_ASM_0002

Added: tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0003.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0003.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0003.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0003.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,44 @@
+/*
+ * 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 client;
+
+
+import test.ASM_0003_Client;
+import test.TestInvocation;
+
+/**
+ * A generic test client based on Tuscany APIs
+ */
+public class Test_ASM_0003 extends BaseTest {
+
+ 
+    protected TestConfiguration getTestConfiguration() {
+       TestConfiguration config = new TestConfiguration();
+       config.testName                 = "ASM_0003";
+       config.input                    = "request";
+       config.output                   = config.testName + " " + config.input 
+ " service1 operation1 invoked" +
+                                                         "service2 operation1 
invoked" + "service3 operation1 invoked";
+       config.composite                = "Test_ASM_0003.composite";
+       config.testServiceName  = "TestClient";
+       config.testClass                = ASM_0003_Client.class;
+       config.serviceInterface = TestInvocation.class;
+       return config;
+    }
+    
+} // end class Test_ASM_0003

Added: tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0004.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0004.java?rev=721404&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0004.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/test/java/client/Test_ASM_0004.java 
Fri Nov 28 01:43:41 2008
@@ -0,0 +1,43 @@
+/*
+ * 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 client;
+
+
+import test.ASM_0002_Client;
+import test.TestInvocation;
+
+/**
+ * A generic test client based on Tuscany APIs
+ */
+public class Test_ASM_0004 extends BaseTest {
+
+ 
+    protected TestConfiguration getTestConfiguration() {
+       TestConfiguration config = new TestConfiguration();
+       config.testName                 = "ASM_0004";
+       config.input                    = "request";
+       config.output                   = "exception";
+       config.composite                = "Test_ASM_0004.composite";
+       config.testServiceName  = "TestClient";
+       config.testClass                = ASM_0002_Client.class;
+       config.serviceInterface = TestInvocation.class;
+       return config;
+    }
+    
+} // end class Test_ASM_0003


Reply via email to