summaryrefslogtreecommitdiffstats
path: root/java/sca/stest/sampleTest/src/main
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java49
-rw-r--r--java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java57
-rw-r--r--java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java61
-rw-r--r--java/sca/stest/sampleTest/src/main/java/test/Service1.java17
-rw-r--r--java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java17
-rw-r--r--java/sca/stest/sampleTest/src/main/java/test/service1Impl.java20
-rw-r--r--java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite40
-rw-r--r--java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite42
-rw-r--r--java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite59
-rw-r--r--java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite61
10 files changed, 423 insertions, 0 deletions
diff --git a/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java b/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java
new file mode 100644
index 0000000000..5f35b31380
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/java/test/ASM_0001_Client.java
@@ -0,0 +1,49 @@
+package test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Basic test initiation class
+ * @author MikeEdwards
+ *
+ */
+@Service(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;
+ }
+
+} //
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
new file mode 100644
index 0000000000..1e10cc9024
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/java/test/ASM_0002_Client.java
@@ -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
+ *
+ */
+@Service(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;
+ }
+
+} //
diff --git a/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java b/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java
new file mode 100644
index 0000000000..437ded8cea
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/java/test/ASM_0003_Client.java
@@ -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
+ *
+ */
+@Service(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;
+ }
+
+} //
diff --git a/java/sca/stest/sampleTest/src/main/java/test/Service1.java b/java/sca/stest/sampleTest/src/main/java/test/Service1.java
new file mode 100644
index 0000000000..303a4f1cdd
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/java/test/Service1.java
@@ -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 );
+
+}
diff --git a/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java b/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java
new file mode 100644
index 0000000000..e33ab66bf6
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/java/test/TestInvocation.java
@@ -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 );
+
+}
diff --git a/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java b/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java
new file mode 100644
index 0000000000..98000e28f7
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/java/test/service1Impl.java
@@ -0,0 +1,20 @@
+package test;
+
+import org.osoa.sca.annotations.*;
+
+/**
+ * Simple Java component implementation for business interface Service1
+ * @author MikeEdwards
+ *
+ */
+@Service(Service1.class)
+public class service1Impl implements Service1 {
+
+ @Property
+ public String serviceName = "service1";
+
+ public String operation1(String input) {
+ return serviceName + " operation1 invoked";
+ }
+
+}
diff --git a/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite
new file mode 100644
index 0000000000..ac9bb3ea00
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0001.composite
@@ -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>
diff --git a/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite
new file mode 100644
index 0000000000..28e4b56ef3
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0002.composite
@@ -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>
diff --git a/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite
new file mode 100644
index 0000000000..577d4eb049
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0003.composite
@@ -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>
diff --git a/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.composite
new file mode 100644
index 0000000000..c5cc0494a3
--- /dev/null
+++ b/java/sca/stest/sampleTest/src/main/resources/Test_ASM_0004.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.
+-->
+<!-- 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>