Author: edwardsmj
Date: Fri Jan  9 02:40:11 2009
New Revision: 733002

URL: http://svn.apache.org/viewvc?rev=733002&view=rev
Log:
Added Test_ASM_0007

Added:
    tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java
    
tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite
    tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite
    
tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java
Modified:
    tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java
    
tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java

Modified: 
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=733002&r1=733001&r2=733002&view=diff
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java 
(original)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java 
Fri Jan  9 02:40:11 2009
@@ -48,7 +48,7 @@
                try {
                        response = runTest( input );
                } catch( Exception e ) {
-                       throw new TestException("Test service got an exception 
during execution: " );
+                       throw new TestException("Test service got an exception 
during execution: " + e.getClass().getName()+ " " + e.getMessage()  );
                } // end try
                return response;
        } // end method invokeTest

Added: tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java?rev=733002&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java 
(added)
+++ tuscany/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java Fri 
Jan  9 02:40:11 2009
@@ -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 test;
+
+import org.osoa.sca.annotations.*;
+
+/**
+ * Enhanced Java component implementation for business interface Service1,
+ * where the implementation also has a single reference using the Service1
+ * interface and which gets called when operation1 is invoked
+ * @author MikeEdwards
+ *
+ */
+...@service(Service1.class)
+public class service1Impl2 implements Service1 {
+       
+       @Property
+       public String serviceName = "service1";
+       @Reference
+       public Service1 reference1 = null;
+
+       public String operation1(String input) {
+               String result = reference1.operation1(input);
+               return serviceName + " operation1 invoked" + " " + result;
+       }
+
+}

Added: 
tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite?rev=733002&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite 
Fri Jan  9 02:40:11 2009
@@ -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.    
+-->
+<!-- An example of a composite which is invalid because it has two
+     composite level references with the same @name attribute  -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+           targetNamespace="http://oasis/tests";
+           xmlns:sample="http://oasis/tests";
+           name="TestComposite3">
+           
+       <service name="Service1" promote="TestComponent1/Service1">
+               <interface.java interface="test.Service1"/>
+       </service>
+
+    <property name="serviceName" type="string"/>
+ 
+    <component name="TestComponent1">
+               <implementation.java class="test.service1Impl2"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"/>
+        </service>
+        <property name="serviceName" source="$serviceName"/>
+    </component>
+    
+    <reference name="Reference1" promote="TestComponent1/Reference">
+        <interface.java interface="test.Service1"/>
+    </reference>
+    
+    <reference name="Reference1" promote="TestComponent1/Reference">
+        <interface.java interface="test.Service1"/>
+    </reference>
+   
+</composite>

Added: 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite?rev=733002&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite 
Fri Jan  9 02:40:11 2009
@@ -0,0 +1,60 @@
+<?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 the @name attribute of a <reference/> element of a 
+     component is not equal to the @name attribute of any other 
+     <reference/> element of the same component   -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+           targetNamespace="http://oasis/tests";
+           xmlns:tns="http://oasis/tests";
+           xmlns:sample="http://oasis/tests";
+           name="TEST_ASM_0007">
+           
+    <component name="TestClient">
+               <implementation.composite name="tns:TestClient_0002"/>
+               <service name="TestInvocation">
+                       <interface.java interface="test.TestInvocation"/>
+            <binding.ws/>
+               </service>
+        <reference name="reference1" target="TestComponent1/Service1" />
+        <property name="testName">ASM_0005</property>
+    </component>
+    
+    <component name="TestComponent1">
+               <implementation.composite name="tns:TestComposite3"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"/>
+        </service>
+        <property name="serviceName">service1</property>
+        <!-- Two references with the same name - the implementation also has
+             two references of the same name so that the component type
+             matches the configuration of the component -->
+        <reference name="Reference1" target="TestComponent2/Service1"/>
+        <reference name="Reference1" target="TestComponent2/Service1"/>
+    </component>
+
+    <component name="TestComponent2">
+               <implementation.composite name="tns:TestComposite1"/>
+        <service name="Service1">
+               <interface.java interface="test.Service1"/>
+        </service>
+        <property name="serviceName">service2</property>
+    </component>
+    
+</composite>

Added: 
tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java?rev=733002&view=auto
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java 
(added)
+++ 
tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java 
Fri Jan  9 02:40:11 2009
@@ -0,0 +1,45 @@
+/*
+ * 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 testClient.TestInvocation;
+
+/**
+ * Client for ASM_0007_TestCase, which tests that the @name attribute of a 
<reference/> 
+ * element of a component is not equal to the @name attribute of any other 
<reference/> 
+ * element of the same component
+ */
+public class ASM_0007_TestCase extends BaseJAXWSTestCase {
+
+ 
+    protected TestConfiguration getTestConfiguration() {
+       TestConfiguration config = new TestConfiguration();
+       config.testName                 = "ASM_0007";
+       config.input                    = "request";
+       config.output                   = "exception";
+       config.composite                = "Test_ASM_0007.composite";
+       config.testServiceName  = "TestClient";
+       config.testClass                = ASM_0002_Client.class;
+       config.serviceInterface = TestInvocation.class;
+       return config;
+    }
+    
+} // end class Test_ASM_0003

Modified: 
tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java?rev=733002&r1=733001&r2=733002&view=diff
==============================================================================
--- 
tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java 
(original)
+++ 
tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java 
Fri Jan  9 02:40:11 2009
@@ -36,6 +36,8 @@
 
 import test.ASM_0001_Client;
 import testClient.TestInvocation;
+import testClient.TestException_Exception;
+import testClient.TestException;
 
 /**
  * A generic test client based on JAX-WS APIs
@@ -66,11 +68,18 @@
     public void testDummy() throws Exception {
        // System.out.println("Test " + testName + " starting");
        try {
+               // Just requires input to proceed
+               // System.in.read();
+               //
                String output = invokeTest( testConfiguration.getInput() );
                assertEquals( testConfiguration.getExpectedOutput(), output );
+       } catch ( TestException_Exception e ) {
+               TestException exceptionContent = e.getFaultInfo();
+               System.out.println("Service fault received - detail: " + 
exceptionContent.getMessage() );
+               assertEquals( testConfiguration.getExpectedOutput(), 
"exception" );
        } catch (Throwable e) {
                e.printStackTrace();
-               System.out.println( "Exception received - detail: " + 
e.getMessage() );
+                       System.out.println( "Exception received - detail: " + 
e.getMessage() );
                assertEquals( testConfiguration.getExpectedOutput(), 
"exception" );
        }
        System.out.println("Test " + testConfiguration.getTestName() + " 
completed successfully");


Reply via email to