summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-01-09 11:05:06 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-01-09 11:05:06 +0000
commit919179fe81fe5f7da3f546c88664402fcebaa233 (patch)
tree722fa28547182217114fe2726040f5921fe56db3 /java
parentdee1b5dc073c5f472545a5749027f97ed3ac856e (diff)
Added Test_ASM_0008
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@733007 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite45
-rw-r--r--java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite61
-rw-r--r--java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java46
-rw-r--r--java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java16
4 files changed, 167 insertions, 1 deletions
diff --git a/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite b/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite
new file mode 100644
index 0000000000..7408a4dd97
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/resources/TestComposite4.composite
@@ -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>
diff --git a/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite
new file mode 100644
index 0000000000..9ddb8aa8cf
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0008.composite
@@ -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>
diff --git a/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java b/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java
new file mode 100644
index 0000000000..0bdc3af4a3
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/test/java/client/ASM_0008_TestCase.java
@@ -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
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 5a350dc40f..4098e94952 100644
--- a/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java
+++ b/java/sca/stest/sampleTest/src/test/java/client/BaseJAXWSTestCase.java
@@ -47,6 +47,7 @@ public class BaseJAXWSTestCase {
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 @@ public class BaseJAXWSTestCase {
@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 @@ public class BaseJAXWSTestCase {
@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