From c4a6a944e93fa338c196ad5c16d5c844d4b2d09c Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 17 Mar 2009 12:05:24 +0000 Subject: Copy sca trunk to sandbox area so i can get the release plugin configuration correct without messing up the live trunk git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@755209 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/test/ASM_0001_Client.java | 67 +++++++++++++++++ .../src/main/java/test/ASM_0002_Client.java | 80 +++++++++++++++++++++ .../src/main/java/test/ASM_0003_Client.java | 79 ++++++++++++++++++++ .../sampleTest/src/main/java/test/Service1.java | 39 ++++++++++ .../src/main/java/test/Service1Superset.java | 45 ++++++++++++ .../sampleTest/src/main/java/test/Service2.java | 35 +++++++++ .../src/main/java/test/TestException.java | 47 ++++++++++++ .../src/main/java/test/TestInvocation.class | Bin 0 -> 395 bytes .../src/main/java/test/TestInvocation.java | 42 +++++++++++ .../src/main/java/test/service1Impl.java | 39 ++++++++++ .../src/main/java/test/service1Impl2.java | 46 ++++++++++++ .../src/main/java/test/service1Impl3.java | 51 +++++++++++++ .../src/main/java/test/service1Impl4.java | 52 ++++++++++++++ .../src/main/java/test/service1Impl5.java | 45 ++++++++++++ .../src/main/java/test/service1Impl6.java | 50 +++++++++++++ .../src/main/java/test/service1SupersetImpl.java | 43 +++++++++++ .../src/main/java/test/service2Impl.java | 39 ++++++++++ 17 files changed, 799 insertions(+) create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0001_Client.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0002_Client.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0003_Client.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1Superset.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service2.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestException.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.class create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl2.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl3.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl4.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl5.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl6.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1SupersetImpl.java create mode 100644 sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service2Impl.java (limited to 'sandbox/ant/sca/trunk/stest/sampleTest/src/main/java') diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0001_Client.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0001_Client.java new file mode 100644 index 0000000000..dff88ce8ca --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0001_Client.java @@ -0,0 +1,67 @@ +/* + * 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.oasisopen.sca.annotation.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) throws TestException { + 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/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0002_Client.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0002_Client.java new file mode 100644 index 0000000000..673dde9590 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0002_Client.java @@ -0,0 +1,80 @@ +/* + * 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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Test initiation class with a single reference of multiplicity 1..1 + * @author MikeEdwards + * + */ +@Service(TestInvocation.class) +public class ASM_0002_Client implements TestInvocation { + + @Property + public 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) throws TestException { + String response = null; + + try { + response = runTest(input); + } catch (Exception e) { + throw new TestException("Test service got an exception during execution: " + e.getClass().getName() + + " " + + e.getMessage()); + } // end try + 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/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0003_Client.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0003_Client.java new file mode 100644 index 0000000000..f6f4f1ccb8 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/ASM_0003_Client.java @@ -0,0 +1,79 @@ +/* + * 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 java.util.List; + +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Basic test initiation class + * @author MikeEdwards + * + */ +@Service(TestInvocation.class) +public class ASM_0003_Client implements TestInvocation { + + @Property + public String testName = "ASM_xxxx"; + + @Reference + public List reference1; + + /** + * This method is offered as a service and is + * invoked by the test client to run the test + */ + public String invokeTest(String input) throws TestException { + 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/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1.java new file mode 100644 index 0000000000..713fa40563 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1.java @@ -0,0 +1,39 @@ +/* + * 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; + +// TODO: Need to change *ALL* annotations to org.oasisopen.xxxx +import org.oasisopen.sca.annotation.Remotable; + +/** + * A test service interface + * @author MikeEdwards + * + */ +@Remotable +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/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1Superset.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1Superset.java new file mode 100644 index 0000000000..7d3a2f2e9f --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service1Superset.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 test; + +/** + * A superset of the basic test service interface + * @author MikeEdwards + * + */ +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Service1Superset { + + /** + * Method for invoking testcase service + * @param input - input parameter(s) as a String + * @return - output data as a String + */ + public String operation1(String input); + + /** + * A second method for invoking a testcase service + * @param input - input parameter(s) as a String + * @return - output data as a String + */ + public String operation2(String input); + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service2.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service2.java new file mode 100644 index 0000000000..f834a4fbf1 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/Service2.java @@ -0,0 +1,35 @@ +/* + * 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; + +/** + * A test service interface, designed to be incompatible with the Service1 interface + * @author MikeEdwards + * + */ +public interface Service2 { + + /** + * Method for invoking testcase service + * @param input - input parameter(s) as a String + * @return - output data as a String + */ + public int operation2(int input); + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestException.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestException.java new file mode 100644 index 0000000000..158c5f4522 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestException.java @@ -0,0 +1,47 @@ +/* + * 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; + +/* + * Exception thrown by SCA Test services + */ +public class TestException extends Exception { + + /** + * Required serialVersionUID field + */ + private static final long serialVersionUID = -6978058912756564824L; + + public TestException() { + super(); + }; + + public TestException(String msg) { + super(msg); + }; + + public TestException(String msg, Throwable cause) { + super(msg, cause); + }; + + public TestException(Throwable cause) { + super(cause); + }; + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.class b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.class new file mode 100644 index 0000000000..64e43c20c9 Binary files /dev/null and b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.class differ diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.java new file mode 100644 index 0000000000..e5d781095f --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/TestInvocation.java @@ -0,0 +1,42 @@ +/* + * 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 javax.jws.WebMethod; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * Basic interface to invoke testcases + * @author MikeEdwards + * + */ +@Remotable +public interface TestInvocation { + + /** + * Method for invoking testcase + * @param input - input parameter(s) as a String + * @return - output data as a String + * @throws - a TestException is thrown in cases where the test service fails internally + */ + @WebMethod + public String invokeTest(String input) throws TestException; + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl.java new file mode 100644 index 0000000000..a505f895a2 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl.java @@ -0,0 +1,39 @@ +/* + * 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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +/** + * 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/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl2.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl2.java new file mode 100644 index 0000000000..0f639fbbf3 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl2.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 test; + +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * 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 with an implied multiplicity of (1..1) since required=true is the default + @Reference + public Service1 reference1 = null; + + public String operation1(String input) { + String result = reference1.operation1(input); + return serviceName + " operation1 invoked" + " " + result; + } + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl3.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl3.java new file mode 100644 index 0000000000..834dc3ddf7 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl3.java @@ -0,0 +1,51 @@ +/* + * 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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Enhanced Java component implementation for business interface Service1, + * where the implementation also has a single reference using the Service1 + * interface with mutiplicity 1..n all of which and which get called when + * operation1 is invoked + * @author MikeEdwards + * + */ +@Service(Service1.class) +public class service1Impl3 implements Service1 { + + @Property + public String serviceName = "service1"; + // Required = true + an array -> multiplicity 1..n + @Reference(required = true) + public Service1[] reference1 = null; + + public String operation1(String input) { + String result = ""; + // Call each of the references in the array, concatenating the results + for (int i = 0; i < reference1.length; i++) { + result = result.concat(reference1[i].operation1(input)); + } // end for + return serviceName + " operation1 invoked" + " " + result; + } + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl4.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl4.java new file mode 100644 index 0000000000..4799d777c7 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl4.java @@ -0,0 +1,52 @@ +/* + * 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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Enhanced Java component implementation for business interface Service1, + * where the implementation also has a single reference using the Service1 + * interface with multiplicity 0..n all of which and which get called when + * operation1 is invoked + * @author MikeEdwards + * + */ +@Service(Service1.class) +public class service1Impl4 implements Service1 { + + @Property + public String serviceName = "service1"; + // Required = false + an array -> multiplicity 0..n + @Reference(required = false) + public Service1[] reference1 = null; + + public String operation1(String input) { + String result = serviceName + " operation1 invoked"; + // Call each of the references in the array, concatenating the results + for (int i = 0; i < reference1.length; i++) { + result = result.concat(" "); + result = result.concat(reference1[i].operation1(input)); + } // end for + return result; + } + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl5.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl5.java new file mode 100644 index 0000000000..dd69308c95 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl5.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 test; + +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +/** + * Java component implementation for business interface Service1 + * - no references + * - 3 properties + * @author MikeEdwards + * + */ +@Service(Service1.class) +public class service1Impl5 implements Service1 { + + @Property + public String serviceName = "service1"; + @Property + public String serviceData1; + @Property + public String serviceData2; + + public String operation1(String input) { + return serviceName + " operation1 invoked" + serviceData1 + serviceData2; + } + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl6.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl6.java new file mode 100644 index 0000000000..1810686194 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1Impl6.java @@ -0,0 +1,50 @@ +/* + * 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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Enhanced Java component implementation for business interface Service1, + * where the implementation also has a single reference using the Service1 + * interface with multiplicity 0..1 which gets called when + * operation1 is invoked, if present + * @author MikeEdwards + * + */ +@Service(Service1.class) +public class service1Impl6 implements Service1 { + + @Property + public String serviceName = "service1"; + // Required = false -> multiplicity 0..1 + @Reference(required = false) + public Service1 reference1 = null; + + public String operation1(String input) { + String result = serviceName + " operation1 invoked"; + // Call the reference if present + if (reference1 != null) + result = result.concat(reference1.operation1(input)); + return result; + } + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1SupersetImpl.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1SupersetImpl.java new file mode 100644 index 0000000000..f137b7f1b4 --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service1SupersetImpl.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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +/** + * Simple Java component implementation for business interface Service1Superset + * @author MikeEdwards + * + */ +@Service(Service1Superset.class) +public class service1SupersetImpl implements Service1Superset { + + @Property + public String serviceName = "service1"; + + public String operation1(String input) { + return serviceName + " operation1 invoked"; + } + + public String operation2(String input) { + return serviceName + " operation2 invoked"; + } + +} diff --git a/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service2Impl.java b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service2Impl.java new file mode 100644 index 0000000000..919b33014c --- /dev/null +++ b/sandbox/ant/sca/trunk/stest/sampleTest/src/main/java/test/service2Impl.java @@ -0,0 +1,39 @@ +/* + * 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.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +/** + * Simple Java component implementation for business interface Service2 + * @author MikeEdwards + * + */ +@Service(Service2.class) +public class service2Impl implements Service2 { + + @Property + public String serviceName = "service1"; + + public int operation2(int input) { + return input + 1; + } + +} -- cgit v1.2.3