From dee1b5dc073c5f472545a5749027f97ed3ac856e Mon Sep 17 00:00:00 2001 From: edwardsmj Date: Fri, 9 Jan 2009 10:40:11 +0000 Subject: Added Test_ASM_0007 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@733002 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/test/ASM_0002_Client.java | 2 +- .../src/main/java/test/service1Impl2.java | 43 ++++++++++++++++ .../src/main/resources/TestComposite3.composite | 49 ++++++++++++++++++ .../src/main/resources/Test_ASM_0007.composite | 60 ++++++++++++++++++++++ .../src/test/java/client/ASM_0007_TestCase.java | 45 ++++++++++++++++ .../src/test/java/client/BaseJAXWSTestCase.java | 11 +++- 6 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java create mode 100644 java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite create mode 100644 java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite create mode 100644 java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java (limited to 'java/sca/stest') diff --git a/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java b/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java index 4ad8a375b3..2518c5aa76 100644 --- a/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java +++ b/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java @@ -48,7 +48,7 @@ public class ASM_0002_Client implements TestInvocation { 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 diff --git a/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java b/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java new file mode 100644 index 0000000000..18793b5034 --- /dev/null +++ b/java/sca/stest/sampleTest/src/main/java/test/service1Impl2.java @@ -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; + } + +} diff --git a/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite b/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite new file mode 100644 index 0000000000..cc91e1eeea --- /dev/null +++ b/java/sca/stest/sampleTest/src/main/resources/TestComposite3.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite new file mode 100644 index 0000000000..7ab4d9db39 --- /dev/null +++ b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0007.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + ASM_0005 + + + + + + + + service1 + + + + + + + + + + + service2 + + + diff --git a/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java b/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java new file mode 100644 index 0000000000..44781eb87a --- /dev/null +++ b/java/sca/stest/sampleTest/src/test/java/client/ASM_0007_TestCase.java @@ -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 + * element of a component is not equal to the @name attribute of any other + * 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 diff --git a/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java b/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java index 973bfec03e..5a350dc40f 100644 --- a/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java +++ b/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java @@ -36,6 +36,8 @@ import javax.xml.namespace.QName; 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 class BaseJAXWSTestCase { 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"); -- cgit v1.2.3