tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edward...@apache.org
Subject svn commit: r733007 - in /tuscany/java/sca/stest/sampleTest/src: main/resources/TestComposite4.composite main/resources/Test_ASM_0008.composite test/java/client/ASM_0008_TestCase.java test/java/client/BaseJAXWSTestCase.java
Date Fri, 09 Jan 2009 11:05:06 GMT
Author: edwardsmj
Date: Fri Jan  9 03:05:06 2009
New Revision: 733007

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

Added:
    tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite
    tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite
    tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java
Modified:
    tuscany/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java

Added: tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite?rev=733007&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite (added)
+++ tuscany/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite Fri Jan
 9 03:05:06 2009
@@ -0,0 +1,45 @@
+<?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 has a single service and
+     a single reference   -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://oasis/tests"
+           xmlns:sample="http://oasis/tests"
+           name="TestComposite4">
+           
+	<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>
+    
+</composite>

Added: tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite?rev=733007&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite (added)
+++ tuscany/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite Fri Jan 
9 03:05:06 2009
@@ -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.    
+-->
+<!-- Tests that the @name attribute of a <reference/> element of a 
+     component is equal to the @name attribute of a <reference/> 
+     element of the <componentType/> of the <implementation/> of 
+     the <component/>  - negative test in that here there is a 
+     reference @name which does NOT match a reference name in the
+     component type -->
+<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_0008">
+           
+    <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:TestComposite4"/>
+        <service name="Service1">
+        	<interface.java interface="test.Service1"/>
+        </service>
+        <property name="serviceName">service1</property>
+        <!-- This reference has a name that does not match the name of a
+             Reference in the implementation -->
+        <reference name="InvalidName" 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_0008_TestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java?rev=733007&view=auto
==============================================================================
--- tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java (added)
+++ tuscany/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java Fri Jan
 9 03:05:06 2009
@@ -0,0 +1,46 @@
+/*
+ * 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_0008_TestCase, which Tests that the @name attribute of a 
+ * <reference/> element of a component is equal to the @name attribute of a 
+ * <reference/> element of the <componentType/> of the <implementation/>
of 
+ * the <component/>
+ */
+public class ASM_0008_TestCase extends BaseJAXWSTestCase {
+
+ 
+    protected TestConfiguration getTestConfiguration() {
+    	TestConfiguration config = new TestConfiguration();
+    	config.testName 		= "ASM_0008";
+    	config.input 			= "request";
+    	config.output 			= "exception";
+    	config.composite 		= "Test_ASM_0008.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=733007&r1=733006&r2=733007&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 03:05:06 2009
@@ -47,6 +47,7 @@
     protected NodeLauncher launcher;
     protected Node node;
     protected TestConfiguration testConfiguration = getTestConfiguration();
+    static boolean proceed = true;
     
     public static void main(String[] args) throws Exception {
     	BaseJAXWSTestCase test = new BaseJAXWSTestCase(); 
@@ -56,7 +57,17 @@
     
     @Before
     public void setUp() throws Exception {	
-    	startContribution();
+    	try {
+    		startContribution();
+    	} catch (Exception e) {
+    		// If the SCA runtime refuses to start an invalid contribution, then this is also
+    		// regarded as a successful outcome
+   			System.out.println( "Exception received - detail: " + e.getMessage() );
+    		assertEquals( testConfiguration.getExpectedOutput(), "exception" );
+    		System.out.println("Test " + testConfiguration.getTestName() + " completed successfully");
+    		// Mark this test as not to proceed further
+    		proceed = false;
+    	} // end try
     }
 
     @After
@@ -66,6 +77,9 @@
 
     @Test
     public void testDummy() throws Exception {
+    	// If an exception were thrown during initialization, let's go no further
+    	if( proceed == false ) return;
+    	
     	// System.out.println("Test " + testName + " starting");
     	try {
     		// Just requires input to proceed



Mime
View raw message