diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/old/contrib/itest |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/old/contrib/itest')
175 files changed, 12788 insertions, 0 deletions
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml b/sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml new file mode 100644 index 0000000000..bdb19eda9d --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml @@ -0,0 +1,64 @@ +<?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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.tuscany.testing.bindingstest</groupId> + <artifactId>itest-bindings-bindingsclient</artifactId> + <packaging>jar</packaging> + <name>SCA FVT Bindings Test Tool JSP Client</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.testing.bindingstest</groupId> + <artifactId>itest-bindings-bindingscomposite</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.testing.bindingstest</groupId> + <artifactId>itest-bindings-bindingsutility</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-api-r2.1</artifactId> + <version>1.0-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> + +</project> diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java new file mode 100644 index 0000000000..44801846f6 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java @@ -0,0 +1,40 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import org.osoa.sca.annotations.Remotable; + +/** + * SCA Test Tool Service + */ + +@Remotable +public interface SCATestToolService { + + public String doOneHopPing(String input); + + public String doTwoHopPing(String input); + + public String doDataTypeTest(String input); + + public String getCallbackBuffer(); + + public void clearCallbackBuffer(); +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite new file mode 100644 index 0000000000..ca3ff6494e --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite @@ -0,0 +1,47 @@ +<?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" xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:dbsdo="http://incubator.apache.org/tuscany/xmlns/databinding/sdo/1.0-incubator-M2" + name="bindingsclient"> + + <!-- + <reference name="SCATestToolSCAReference"> + <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService"/> + <binding.sca uri="SCATestToolSCAServiceComponent"/> + </reference> + --> + + <reference name="SCATestToolWSReference"> + <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService" /> + <binding.ws endpoint="http://scatesttool.scabeta1fvt#wsdl.endpoint(SCATestToolService/SCATestToolServiceSoapPort)" + location="wsdl/testtool.wsdl" /> + </reference> + + <!-- + <reference name="SCATestToolEJBReference"> + <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService"/> + <binding.ejb uri="corbaname:iiop:localhost:2811/NameServiceServerRoot#ejb/scabeta1fvt/scatesttool/SCATestToolServiceHome"/> + </reference> + + --> +</composite> + diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl new file mode 100644 index 0000000000..7dc608f063 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl @@ -0,0 +1,272 @@ +<?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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.scabeta1fvt" xmlns:impl="http://scatesttool.scabeta1fvt"
+ xmlns:tns="http://scatesttool.scabeta1fvt" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testtool"> + <wsdl:types> + <schema targetNamespace="http://scatesttool.scabeta1fvt" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <element name="doOneHopPingResponse"> + <complexType> + <sequence> + <element name="doOneHopPingReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doTwoHopPing"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doTwoHopPingResponse"> + <complexType> + <sequence> + <element name="doTwoHopPingReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doDataTypeTest"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doDataTypeTestResponse"> + <complexType> + <sequence> + <element name="doDataTypeTestReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="getCallbackBuffer"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="getCallbackBufferResponse"> + <complexType> + <sequence> + <element name="getCallbackBufferReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="clearCallbackBuffer"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="clearCallbackBufferResponse"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="doOneHopPing"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + + <wsdl:message name="doOneHopPingResponse"> + <wsdl:part element="tns:doOneHopPingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doDataTypeTestResponse"> + <wsdl:part element="tns:doDataTypeTestResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="clearCallbackBufferResponse"> + <wsdl:part element="tns:clearCallbackBufferResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="getCallbackBufferRequest"> + <wsdl:part element="tns:getCallbackBuffer" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doTwoHopPingRequest"> + <wsdl:part element="tns:doTwoHopPing" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doTwoHopPingResponse"> + <wsdl:part element="tns:doTwoHopPingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="getCallbackBufferResponse"> + <wsdl:part element="tns:getCallbackBufferResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="clearCallbackBufferRequest"> + <wsdl:part element="tns:clearCallbackBuffer" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doDataTypeTestRequest"> + <wsdl:part element="tns:doDataTypeTest" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doOneHopPingRequest"> + <wsdl:part element="tns:doOneHopPing" name="parameters" /> + + </wsdl:message> + + <wsdl:portType name="SCATestToolService"> + <wsdl:operation name="doOneHopPing"> + <wsdl:input message="tns:doOneHopPingRequest" name="doOneHopPingRequest" /> + + <wsdl:output message="tns:doOneHopPingResponse" name="doOneHopPingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="doTwoHopPing"> + <wsdl:input message="tns:doTwoHopPingRequest" name="doTwoHopPingRequest" /> + + <wsdl:output message="tns:doTwoHopPingResponse" name="doTwoHopPingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="doDataTypeTest"> + <wsdl:input message="tns:doDataTypeTestRequest" name="doDataTypeTestRequest" /> + + <wsdl:output message="tns:doDataTypeTestResponse" name="doDataTypeTestResponse" /> + + </wsdl:operation> + + <wsdl:operation name="getCallbackBuffer"> + <wsdl:input message="tns:getCallbackBufferRequest" name="getCallbackBufferRequest" /> + + <wsdl:output message="tns:getCallbackBufferResponse" name="getCallbackBufferResponse" /> + + </wsdl:operation> + + <wsdl:operation name="clearCallbackBuffer"> + <wsdl:input message="tns:clearCallbackBufferRequest" name="clearCallbackBufferRequest" /> + + <wsdl:output message="tns:clearCallbackBufferResponse" name="clearCallbackBufferResponse" /> + + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="SCATestToolServiceSoapBinding" type="tns:SCATestToolService"> + <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> --> + + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="doOneHopPing"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="doOneHopPingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="doOneHopPingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="doTwoHopPing"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="doTwoHopPingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="doTwoHopPingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="doDataTypeTest"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="doDataTypeTestRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="doDataTypeTestResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="getCallbackBuffer"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="getCallbackBufferRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="getCallbackBufferResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="clearCallbackBuffer"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="clearCallbackBufferRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="clearCallbackBufferResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="SCATestToolService"> + <wsdl:port binding="tns:SCATestToolServiceSoapBinding" name="SCATestToolServiceSoapPort"> + <wsdlsoap:address location="http://localhost:8085/services/SCATestToolWSService" /> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp new file mode 100644 index 0000000000..eb219e4cef --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp @@ -0,0 +1,130 @@ +<%--/*
+ * 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.
+ */
+ --%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ * SCATestService.java
+ * written by Chris Ortiz
+ * interface class for basic test service
+ * version .1 9/22/2006
+ *
+ *
+ --%>
+
+
+<HTML>
+<HEAD>
+ <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1" session="true" autoFlush="true"
+ isThreadSafe="true" isErrorPage="false"
+ import="org.apache.tuscany.sca.itest.SCATestToolService"
+ import="java.io.PrintWriter"
+ import="java.io.StringWriter"
+ import="org.osoa.sca.CurrentCompositeContext"
+ import="org.osoa.sca.CompositeContext"
+ %>
+ <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <META name="GENERATOR" content="IBM Software Development Platform">
+ <TITLE>SCA FVT Test Service Driver</TITLE>
+</HEAD>
+
+<BODY bgcolor="#c8d8f8">
+<H2>SCA FVT Test Tool Client</H2>
+
+<form action="SCATestTool.jsp" method="get"><HR><BR>Choose Binding type:<BR><BR>
+ <INPUT type="radio" name="bind" value="WS"> WS Binding
+ <INPUT type="radio" name="bind" value="EJB"> EJB Binding
+ <INPUT type="radio" name="bind" value="SCA" checked> Default Binding<BR><BR><HR>
+ <BR>Check Tests to run:<BR><BR>
+ <INPUT type="checkbox" name="test" value="Ping First Composite" checked> Ping First Composite
+ <INPUT type="checkbox" name="test" value="Ping Second Composite"> Ping Second Composite<BR><BR>
+ <INPUT type="checkbox" name="test" value="Data Type Test"> Data Type Test<BR><BR>
+ <INPUT type="checkbox" name="test" value="Async One Way"> Async One Way
+ <INPUT type="checkbox" name="test" value="Async Callback"> Async Call Back<BR><BR>
+
+
+ <BR>
+ <INPUT type="submit" value="Run Test"></FORM>
+<BR>
+
+ <%
+
+ String bindingchoice = request.getParameter("bind");
+ String[] selected = request.getParameterValues("test");
+
+ try {
+ SCATestToolService scaTestTool;
+ if (bindingchoice.equals("WS")) {
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolWSReference");
+ } else if (bindingchoice.equals("EJB")) {
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolEJBReference");
+ } else {
+ // assume default binding
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolSCAReference");
+ }
+ if (selected != null && selected.length != 0) {
+ for (int i = 0; i < selected.length; i++) {
+ String value = null;
+ if (null != selected[i] && selected[i].equals("Ping First Composite")) {
+ value = scaTestTool.doOneHopPing("brio");
+ } else if (null != selected[i] && selected[i].equals("Ping Second Composite")){
+ value = scaTestTool.doTwoHopPing("brio");
+ } else if (null != selected[i] && selected[i].equals("Data Type Test")){
+ value = scaTestTool.doDataTypeTest("brio");
+ } else if (null != selected[i] && selected[i].equals("Async One Way")){
+ value = "Ut Oh! Test tool not complete for oneway testing";
+ } else if (null != selected[i] && selected[i].equals("Async Callback")){
+ value = "Ut Oh! Test tool not complete for async testing";
+ } else {
+ value = "Ut Oh! unknown test";
+ }
+
+%>
+
+<HR>
+Results from <%=selected[i]%> test with <%=bindingchoice%> binding:
+<P><%=value%>
+ <%
+ } //for
+ } //if
+
+ }catch(Exception e){
+ e.printStackTrace();
+ StringWriter sw= new StringWriter();
+ PrintWriter pw= new PrintWriter(sw);
+
+ e.printStackTrace(pw);
+ pw.flush();
+
+%>
+ Whoops!<BR clear="all">
+<PRE>
+ Exception "<%=e.getClass().getName()%>" Exception message: "<%=e.getMessage()%>"<BR clear="all">
+ <%=sw.toString() %>
+</PRE>
+<% } //catch
+
+%>
+
+</BODY>
+</HTML>
\ No newline at end of file diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..fd58cb8b0e --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,31 @@ +<!-- + * + * 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. + */ + --> + +<!DOCTYPE web-app PUBLIC + "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd" > + +<web-app> + <display-name>SCA Test Service Driver</display-name> + <welcome-file-list id="WelcomeFileList"> + <welcome-file>SCATestTool.jsp</welcome-file> + </welcome-file-list> +</web-app> diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java new file mode 100644 index 0000000000..6cc72c99a2 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.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 org.apache.tuscany.sca.itest; + + +import java.io.IOException; +import java.net.Socket; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; + +public class SCATestToolServerTest extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java new file mode 100644 index 0000000000..b5f076b7e8 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.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 org.apache.tuscany.sca.itest; + +import java.lang.reflect.UndeclaredThrowableException; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.core.test.SCATestCaseRunner; +import org.apache.tuscany.sca.util.SCATestUtilityServerTest; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class WSBindingsClientTestCase extends TestCase { + private SCATestToolService scaTestTool; + + private SCATestCaseRunner toolServer; + private SCATestCaseRunner utilityServer; + + // Hops over one composite + public void testOneHopPing() throws Throwable { + try { + assertTrue(scaTestTool.doOneHopPing("brio").contains("brio")); + } catch (UndeclaredThrowableException e) { + throw (e.getCause()); + } + } + + // Hops over two composites + public void testTwoHopPing() { + assertTrue(scaTestTool.doTwoHopPing("brio").contains("brio")); + } + + protected void setUp() throws Exception { + SCARuntime.start("bindingsclient.composite"); + + toolServer = new SCATestCaseRunner(SCATestToolServerTest.class); + toolServer.setUp(); + utilityServer = new SCATestCaseRunner(SCATestUtilityServerTest.class); + utilityServer.setUp(); + + CompositeContext cc = CurrentCompositeContext.getContext(); + System.out.println("Composite Name = " + cc.getName()); + System.out.println(CurrentCompositeContext.getContext()); + scaTestTool = + (SCATestToolService)CurrentCompositeContext.getContext().locateService(SCATestToolService.class, + "SCATestToolWSReference"); + if (scaTestTool == null) { + System.out.println("Yo Yo It is null"); + } else { + System.out.println("Yo Yo It is not null: " + scaTestTool); + } + + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + toolServer.tearDown(); + utilityServer.tearDown(); + } +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java new file mode 100644 index 0000000000..0f6cb912a7 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.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 org.apache.tuscany.sca.util; + + + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; + +import junit.framework.TestCase; + +public class SCATestUtilityServerTest extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8081); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml b/sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml new file mode 100644 index 0000000000..9b99bc8134 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml @@ -0,0 +1,58 @@ +<?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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.tuscany.testing.bindingstest</groupId> + <artifactId>itest-bindings-bindingscomposite</artifactId> + <packaging>jar</packaging> + <name>SCA FVT Bindings Test Tool Service Composite</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-api-r2.1</artifactId> + <version>1.0-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <!-- SDO's XXXHelper.INSTANCE pattern requires the implementation --> + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + +</project> diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java new file mode 100644 index 0000000000..efe30c4f4e --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java @@ -0,0 +1,341 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Random; +import java.util.Vector; + +import org.apache.tuscany.sca.util.SCATestUtilityService; + +public class SCADataTypeHelper { + + Date date; + Random ran; + SCATestUtilityService scaUtil; // change this to be the service provider + + public SCADataTypeHelper(SCATestUtilityService util) { + date = new Date(); + ran = new Random(date.getTime()); + scaUtil = util; + } + + public StringBuffer test_char() throws SCADataTypeHelperException { + + char x = 'a'; + x += ran.nextInt(26); // get a char a-z + StringBuffer rc = new StringBuffer("\nchar datatype test sending ==> " + x); + try { + char y = scaUtil.echo_char(x); + if (x == y) { + rc.append("\nchar successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: char ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_char\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_String() throws SCADataTypeHelperException { + + String x = date.toString(); + StringBuffer rc = new StringBuffer("\nString datatype test sending ==> " + x); + try { + String y = scaUtil.echo_String(x); + if (x.equals(y)) { + rc.append("\nString successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: String ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_String\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_int() throws SCADataTypeHelperException { + + int x = ran.nextInt(); + StringBuffer rc = new StringBuffer("\nint datatype test sending ==> " + x); + try { + int y = scaUtil.echo_int(x); + if (x == y) { + rc.append("\nint successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: int ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_int\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_boolean() throws SCADataTypeHelperException { + + boolean x = ran.nextBoolean(); + StringBuffer rc = new StringBuffer("\nboolean datatype test sending ==> " + x); + try { + boolean y = scaUtil.echo_boolean(x); + if (x == y) { + rc.append("\nboolean successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: boolean ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_boolean\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_long() throws SCADataTypeHelperException { + + long x = ran.nextLong(); + StringBuffer rc = new StringBuffer("\nlong datatype test sending ==> " + x); + try { + long y = scaUtil.echo_long(x); + if (x == y) { + rc.append("\nlong successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: long ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_long\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_short() throws SCADataTypeHelperException { + + short x = (short)ran.nextInt(); + StringBuffer rc = new StringBuffer("\nshort datatype test sending ==> " + x); + try { + short y = scaUtil.echo_short(x); + if (x == y) { + rc.append("\nshort successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: short ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_short\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_float() throws SCADataTypeHelperException { + + float x = ran.nextFloat(); + StringBuffer rc = new StringBuffer("\nfloat datatype test sending ==> " + x); + try { + float y = scaUtil.echo_float(x); + if (x == y) { + rc.append("\nfloat successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: float ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_float " + e.toString()); + } + return rc; + } + + public StringBuffer test_double() throws SCADataTypeHelperException { + + double x = ran.nextDouble(); + StringBuffer rc = new StringBuffer("\ndouble datatype test sending ==> " + x); + try { + double y = scaUtil.echo_double(x); + if (x == y) { + rc.append("\ndouble successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException(rc + "\nDatatype exception: double ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_double\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_BigInteger() throws SCADataTypeHelperException { + + BigInteger x = new BigInteger(ran.nextInt(32) + 32, ran); // between + // 32 - 64 + // bitLength + StringBuffer rc = new StringBuffer("\nBigInteger datatype test sending ==> " + x); + try { + BigInteger y = scaUtil.echo_BigInteger(x); + if (x.equals(y)) { + rc.append("\nBigInteger successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: BigInteger ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_BigInteger\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_BigDecimal() throws SCADataTypeHelperException { + + BigDecimal x = new BigDecimal(ran.nextDouble()); + StringBuffer rc = new StringBuffer("\nBigDecimal datatype test sending ==> " + x); + try { + BigDecimal y = scaUtil.echo_BigDecimal(x); + if (x.equals(y)) { + rc.append("\nBigDecimal successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: BigDecimal ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_BigDecimal\n" + e.toString()); + } + return rc; + } + + private StringBuffer test_Vector() throws SCADataTypeHelperException { + + Vector vector = new Vector(); + vector.addElement("DanW"); + vector.addElement(new Float(2000F)); + vector.addElement(new Short((short)11)); + StringBuffer rc = new StringBuffer("\nVector datatype test sending ==> " + vector.toString()); + boolean passed = true; + try { + Vector y = scaUtil.echo_Vector(vector); + if (((String)y.elementAt(0)).equals("DanW")) { + rc.append("\nVector element 0 string " + y.elementAt(0) + " successfully recieved"); + } else { + passed = false; + } + if ((((Float)y.elementAt(1)).equals((Float)vector.elementAt(1)))) { + rc.append("\nVector element 1 Float " + y.elementAt(1) + " successfully recieved"); + } else { + passed = false; + } + if (y.elementAt(2).equals(vector.elementAt(2))) { + rc.append("\nVector element 2 (Short) " + y.elementAt(2) + " successfully received"); + } else { + passed = false; + } + if (!passed) { + // + // one of the tests failed + // + rc.append("\nVector element 0 (String) " + y.elementAt(0) + " should be \"DanW\""); + rc.append("\nVector element 1 (Float) " + y.elementAt(1) + " should be \"2000F\""); + rc.append("\nVector element 2 (Short) " + y.elementAt(2) + " should be \"11\""); + throw new SCADataTypeHelperException("\n" + rc + "\nDataType exception: Vector ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_Vector\n" + e.toString()); + } + return rc; + } + + public StringBuffer test_GregorianCalendar() throws SCADataTypeHelperException { + + GregorianCalendar x = new GregorianCalendar(); + StringBuffer rc = new StringBuffer("\nGregorianCalendar datatype test sending ==> " + x.toString()); + try { + GregorianCalendar y = scaUtil.echo_GregorianCalendar(x); + if (x.equals(y)) { + rc.append("\nGregorianCalendar successfully received ==> " + y); + } else { + throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: GregorianCalendar ==> " + y); + } + } catch (Exception e) { + throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_GregorianCalendar\n" + e + .toString()); + } + return rc; + } + + public StringBuffer doDataType() { + + StringBuffer rc = new StringBuffer(); + try { + rc.append(test_boolean()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_char()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_String()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_int()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString()); + } + try { + rc.append(test_long()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_short()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_float()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_double()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_BigInteger()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_BigDecimal()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_Vector()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } + try { + rc.append(test_GregorianCalendar()); + } catch (SCADataTypeHelperException e) { + rc.append("\n" + e.toString() + "\n"); + } catch (Exception e) { + rc.append("\n" + e.toString() + "\n"); + } + + return rc; + } +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java new file mode 100644 index 0000000000..074fba8057 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +public class SCADataTypeHelperException extends Exception { + + public SCADataTypeHelperException() { + } + + public SCADataTypeHelperException(String msg) { + super(msg); + } +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java new file mode 100644 index 0000000000..c55e22c905 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +/** + * SCA Test Tool Callback Service + */ +public interface SCATestToolCallbackService { + + public void pingCallBack(String reply); +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java new file mode 100644 index 0000000000..44e799a566 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.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 org.apache.tuscany.sca.itest; + + +import java.io.IOException; + +import org.apache.tuscany.api.SCARuntime; + +public class SCATestToolServer { + + /** + * @param args + */ + public static void main(String[] args) { + + SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite"); + + try { + System.out.println("SCATestTool server started"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + SCARuntime.stop(); + System.out.println("SCATestTool server stopped"); + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java new file mode 100644 index 0000000000..67b7e8eb64 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.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 org.apache.tuscany.sca.itest; + +import org.osoa.sca.annotations.Remotable; + +/** + * SCA Test Tool Service + */ + +@Remotable +public interface SCATestToolService { + + public String doOneHopPing(String input); + + public String doTwoHopPing(String input); + + public String doDataTypeTest(String input); + + public String getCallbackBuffer(); + + public void clearCallbackBuffer(); +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java new file mode 100644 index 0000000000..e207a23927 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java @@ -0,0 +1,76 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import org.apache.tuscany.sca.util.SCATestUtilityService; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * SCA Test Service Implementation + */ + +@Service(SCATestToolService.class) +public class SCATestToolServiceImpl implements SCATestToolService, SCATestToolCallbackService { + @Reference + public SCATestUtilityService scaTestUtil; + + private String callbackBuffer = null; + + public String doOneHopPing(String input) { + System.out.println("Invoking SCATestToolServiceImpl.doOneHopPing()"); + StringBuffer rc = new StringBuffer(); + rc.append("doOneHopPing(): "); + rc.append(input); + return rc.toString(); + } + + public String doTwoHopPing(String input) { + System.out.println("Invoking SCATestToolServiceImpl.doTwoHopPing()"); + StringBuffer rc = new StringBuffer(); + rc.append("doTwoHopPing(): "); + rc.append(input); + rc.append(" --> "); + rc.append(scaTestUtil.ping(input)); + return rc.toString(); + } + + public String doDataTypeTest(String input) { + StringBuffer rc = new StringBuffer(); + rc.append("doDataTypeTest(): "); + rc.append(input); + rc.append(" --> "); + SCADataTypeHelper dataHelper = new SCADataTypeHelper(scaTestUtil); + rc.append(dataHelper.doDataType()); + return rc.toString(); + } + + public void pingCallBack(String reply) { + callbackBuffer = reply; + } + + public String getCallbackBuffer() { + return callbackBuffer; + } + + public void clearCallbackBuffer() { + callbackBuffer = null; + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java new file mode 100644 index 0000000000..0ceb553727 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java @@ -0,0 +1,64 @@ +/* + * 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 org.apache.tuscany.sca.util; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Vector; +import java.util.GregorianCalendar; + +import org.apache.tuscany.sca.itest.SCATestToolCallbackService; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +/** + * SCA Test Utility Service + */ + +@Remotable +public interface SCATestUtilityService { + public String ping(String input); + + @Callback(SCATestToolCallbackService.class) + public void asyncping(); + + public int echo_int(int input); + + public short echo_short(short input); + + public long echo_long(long input); + + public float echo_float(float input); + + public double echo_double(double input); + + public boolean echo_boolean(boolean input); + + public char echo_char(char input); + + public String echo_String(String input); + + public BigDecimal echo_BigDecimal(BigDecimal input); + + public BigInteger echo_BigInteger(BigInteger input); + + public Vector echo_Vector(Vector input); + + public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input); +} diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite new file mode 100644 index 0000000000..0b894bf701 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite @@ -0,0 +1,36 @@ +<?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.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+ + <component name="httpserver"> + <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" /> + <property name="httpPort">8085</property> + </component> +
+</composite>
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite new file mode 100644 index 0000000000..9b2bb51b9c --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite @@ -0,0 +1,49 @@ +<?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" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0" xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" + name="bindingscomposite"> + + <!-- dbsdo:import.sdo location="wsdl/testtool.wsdl" / --> + <!-- dbsdo:import.sdo location="wsdl/testutility.wsdl" / --> + + <service name="SCATestToolWSService"> + <interface.wsdl interface="http://scatesttool.scabeta1fvt#wsdl.interface(SCATestToolService)" + wsdli:wsdlLocation="http://scatesttool.scabeta1fvt wsdl/testtool.wsdl" /> + <reference>SCATestToolWSServiceComponent</reference> + <binding.ws endpoint="http://scatesttool.scabeta1fvt#wsdl.endpoint(SCATestToolService/SCATestToolServiceSoapPort)" + location="wsdl/testtool.wsdl" uri="testtool" /> + </service> + + <component name="SCATestToolWSServiceComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.SCATestToolServiceImpl" /> + <reference name="scaTestUtil">SCATestUtilityWSReference</reference> + </component> + + <reference name="SCATestUtilityWSReference"> + <interface.java interface="org.apache.tuscany.sca.util.SCATestUtilityService" /> + <binding.ws endpoint="http://scatestutil.scabeta1fvt#wsdl.endpoint(SCATestUtilityService/SCATestUtilityServiceSoapPort)" + location="wsdl/testutility.wsdl" /> + </reference> + + +</composite> + diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl new file mode 100644 index 0000000000..870af6ac2e --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl @@ -0,0 +1,272 @@ +<?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.
+--> +<wsdl:definitions targetNamespace="http://scatesttool.scabeta1fvt" xmlns:impl="http://scatesttool.scabeta1fvt"
+ xmlns:tns="http://scatesttool.scabeta1fvt" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testtool"> + <wsdl:types> + <schema targetNamespace="http://scatesttool.scabeta1fvt" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <element name="doOneHopPingResponse"> + <complexType> + <sequence> + <element name="doOneHopPingReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doTwoHopPing"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doTwoHopPingResponse"> + <complexType> + <sequence> + <element name="doTwoHopPingReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doDataTypeTest"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="doDataTypeTestResponse"> + <complexType> + <sequence> + <element name="doDataTypeTestReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="getCallbackBuffer"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="getCallbackBufferResponse"> + <complexType> + <sequence> + <element name="getCallbackBufferReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="clearCallbackBuffer"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="clearCallbackBufferResponse"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="doOneHopPing"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + + <wsdl:message name="doOneHopPingResponse"> + <wsdl:part element="tns:doOneHopPingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doDataTypeTestResponse"> + <wsdl:part element="tns:doDataTypeTestResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="clearCallbackBufferResponse"> + <wsdl:part element="tns:clearCallbackBufferResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="getCallbackBufferRequest"> + <wsdl:part element="tns:getCallbackBuffer" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doTwoHopPingRequest"> + <wsdl:part element="tns:doTwoHopPing" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doTwoHopPingResponse"> + <wsdl:part element="tns:doTwoHopPingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="getCallbackBufferResponse"> + <wsdl:part element="tns:getCallbackBufferResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="clearCallbackBufferRequest"> + <wsdl:part element="tns:clearCallbackBuffer" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doDataTypeTestRequest"> + <wsdl:part element="tns:doDataTypeTest" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="doOneHopPingRequest"> + <wsdl:part element="tns:doOneHopPing" name="parameters" /> + + </wsdl:message> + + <wsdl:portType name="SCATestToolService"> + <wsdl:operation name="doOneHopPing"> + <wsdl:input message="tns:doOneHopPingRequest" name="doOneHopPingRequest" /> + + <wsdl:output message="tns:doOneHopPingResponse" name="doOneHopPingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="doTwoHopPing"> + <wsdl:input message="tns:doTwoHopPingRequest" name="doTwoHopPingRequest" /> + + <wsdl:output message="tns:doTwoHopPingResponse" name="doTwoHopPingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="doDataTypeTest"> + <wsdl:input message="tns:doDataTypeTestRequest" name="doDataTypeTestRequest" /> + + <wsdl:output message="tns:doDataTypeTestResponse" name="doDataTypeTestResponse" /> + + </wsdl:operation> + + <wsdl:operation name="getCallbackBuffer"> + <wsdl:input message="tns:getCallbackBufferRequest" name="getCallbackBufferRequest" /> + + <wsdl:output message="tns:getCallbackBufferResponse" name="getCallbackBufferResponse" /> + + </wsdl:operation> + + <wsdl:operation name="clearCallbackBuffer"> + <wsdl:input message="tns:clearCallbackBufferRequest" name="clearCallbackBufferRequest" /> + + <wsdl:output message="tns:clearCallbackBufferResponse" name="clearCallbackBufferResponse" /> + + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="SCATestToolServiceSoapBinding" type="tns:SCATestToolService"> + <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> --> + + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="doOneHopPing"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="doOneHopPingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="doOneHopPingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="doTwoHopPing"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="doTwoHopPingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="doTwoHopPingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="doDataTypeTest"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="doDataTypeTestRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="doDataTypeTestResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="getCallbackBuffer"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="getCallbackBufferRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="getCallbackBufferResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="clearCallbackBuffer"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="clearCallbackBufferRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="clearCallbackBufferResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="SCATestToolService"> + <wsdl:port binding="tns:SCATestToolServiceSoapBinding" name="SCATestToolServiceSoapPort"> + <wsdlsoap:address location="http://localhost:8085/services/SCATestToolWSService" /> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl new file mode 100644 index 0000000000..32d9050a61 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl @@ -0,0 +1,704 @@ +<?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.
+--> +<wsdl:definitions targetNamespace="http://scatestutil.scabeta1fvt" xmlns:impl="http://scatestutil.scabeta1fvt"
+ xmlns:tns="http://scatestutil.scabeta1fvt" xmlns:tns2="http://xml.apache.org/xml-soap" xmlns:tns3="http://util.java"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testutility"> + <wsdl:types> + + <schema elementFormDefault="qualified" targetNamespace="http://scatestutil.scabeta1fvt"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://xml.apache.org/xml-soap"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <import namespace="http://xml.apache.org/xml-soap" /> + <element name="pingResponse"> + <complexType> + <sequence> + <element name="pingReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="asyncping"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="asyncpingResponse"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="echo_int"> + <complexType> + <sequence> + <element name="input" type="xsd:int" /> + </sequence> + </complexType> + </element> + <element name="echo_intResponse"> + <complexType> + <sequence> + <element name="echo_intReturn" type="xsd:int" /> + </sequence> + </complexType> + </element> + <element name="echo_short"> + <complexType> + <sequence> + <element name="input" type="xsd:short" /> + </sequence> + </complexType> + </element> + <element name="echo_shortResponse"> + <complexType> + <sequence> + <element name="echo_shortReturn" type="xsd:short" /> + </sequence> + </complexType> + </element> + <element name="echo_long"> + <complexType> + <sequence> + <element name="input" type="xsd:long" /> + </sequence> + </complexType> + </element> + <element name="echo_longResponse"> + <complexType> + <sequence> + <element name="echo_longReturn" type="xsd:long" /> + </sequence> + </complexType> + </element> + <element name="echo_float"> + <complexType> + <sequence> + <element name="input" type="xsd:float" /> + </sequence> + </complexType> + </element> + <element name="echo_floatResponse"> + <complexType> + <sequence> + <element name="echo_floatReturn" type="xsd:float" /> + </sequence> + </complexType> + </element> + <element name="echo_double"> + <complexType> + <sequence> + <element name="input" type="xsd:double" /> + </sequence> + </complexType> + </element> + <element name="echo_doubleResponse"> + <complexType> + <sequence> + <element name="echo_doubleReturn" type="xsd:double" /> + </sequence> + </complexType> + </element> + <element name="echo_boolean"> + <complexType> + <sequence> + <element name="input" type="xsd:boolean" /> + </sequence> + </complexType> + </element> + <element name="echo_booleanResponse"> + <complexType> + <sequence> + <element name="echo_booleanReturn" type="xsd:boolean" /> + </sequence> + </complexType> + </element> + <element name="echo_char"> + <complexType> + <sequence> + <element name="input" type="tns2:char" /> + </sequence> + </complexType> + </element> + <element name="echo_charResponse"> + <complexType> + <sequence> + <element name="echo_charReturn" type="tns2:char" /> + </sequence> + </complexType> + </element> + <element name="echo_String"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="echo_StringResponse"> + <complexType> + <sequence> + <element name="echo_StringReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="echo_BigDecimal"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:decimal" /> + </sequence> + </complexType> + </element> + <element name="echo_BigDecimalResponse"> + <complexType> + <sequence> + <element name="echo_BigDecimalReturn" minOccurs="0" type="xsd:decimal" /> + </sequence> + </complexType> + </element> + <element name="echo_BigInteger"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:integer" /> + </sequence> + </complexType> + </element> + <element name="echo_BigIntegerResponse"> + <complexType> + <sequence> + <element name="echo_BigIntegerReturn" minOccurs="0" type="xsd:integer" /> + </sequence> + </complexType> + </element> + <element name="echo_Vector"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="tns2:Vector" /> + </sequence> + </complexType> + </element> + <element name="echo_VectorResponse"> + <complexType> + <sequence> + <element name="echo_VectorReturn" minOccurs="0" type="tns2:Vector" /> + </sequence> + </complexType> + </element> + <element name="echo_GregorianCalendar"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:anyType" /> + </sequence> + </complexType> + </element> + <element name="echo_GregorianCalendarResponse"> + <complexType> + <sequence> + <element name="echo_GregorianCalendarReturn" minOccurs="0" type="xsd:anyType" /> + </sequence> + </complexType> + </element> + <element name="ping"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + </schema> + <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <simpleType name="char"> + <restriction base="xsd:string"> + <length value="1" /> + </restriction> + </simpleType> + <complexType name="Vector"> + <sequence> + <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" /> + </sequence> + </complexType> + </schema> + </wsdl:types> + + <wsdl:message name="echo_StringRequest"> + <wsdl:part element="tns:echo_String" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_shortResponse"> + <wsdl:part element="tns:echo_shortResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="asyncpingRequest"> + <wsdl:part element="tns:asyncping" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="asyncpingResponse"> + <wsdl:part element="tns:asyncpingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_doubleResponse"> + <wsdl:part element="tns:echo_doubleResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigDecimalResponse"> + <wsdl:part element="tns:echo_BigDecimalResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_shortRequest"> + <wsdl:part element="tns:echo_short" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigIntegerRequest"> + <wsdl:part element="tns:echo_BigInteger" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_VectorRequest"> + <wsdl:part element="tns:echo_Vector" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="pingResponse"> + <wsdl:part element="tns:pingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_charResponse"> + <wsdl:part element="tns:echo_charResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_VectorResponse"> + <wsdl:part element="tns:echo_VectorResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_longRequest"> + <wsdl:part element="tns:echo_long" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_doubleRequest"> + <wsdl:part element="tns:echo_double" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigDecimalRequest"> + <wsdl:part element="tns:echo_BigDecimal" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_GregorianCalendarRequest"> + <wsdl:part element="tns:echo_GregorianCalendar" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_floatResponse"> + <wsdl:part element="tns:echo_floatResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_booleanRequest"> + <wsdl:part element="tns:echo_boolean" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_booleanResponse"> + <wsdl:part element="tns:echo_booleanResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_StringResponse"> + <wsdl:part element="tns:echo_StringResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_floatRequest"> + <wsdl:part element="tns:echo_float" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_GregorianCalendarResponse"> + <wsdl:part element="tns:echo_GregorianCalendarResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_intResponse"> + <wsdl:part element="tns:echo_intResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_longResponse"> + <wsdl:part element="tns:echo_longResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_charRequest"> + <wsdl:part element="tns:echo_char" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="pingRequest"> + <wsdl:part element="tns:ping" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_intRequest"> + <wsdl:part element="tns:echo_int" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigIntegerResponse"> + <wsdl:part element="tns:echo_BigIntegerResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:portType name="SCATestUtilityService"> + <wsdl:operation name="ping"> + <wsdl:input message="tns:pingRequest" name="pingRequest" /> + + <wsdl:output message="tns:pingResponse" name="pingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="asyncping"> + <wsdl:input message="tns:asyncpingRequest" name="asyncpingRequest" /> + + <wsdl:output message="tns:asyncpingResponse" name="asyncpingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_int"> + <wsdl:input message="tns:echo_intRequest" name="echo_intRequest" /> + + <wsdl:output message="tns:echo_intResponse" name="echo_intResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_short"> + <wsdl:input message="tns:echo_shortRequest" name="echo_shortRequest" /> + + <wsdl:output message="tns:echo_shortResponse" name="echo_shortResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_long"> + <wsdl:input message="tns:echo_longRequest" name="echo_longRequest" /> + + <wsdl:output message="tns:echo_longResponse" name="echo_longResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_float"> + <wsdl:input message="tns:echo_floatRequest" name="echo_floatRequest" /> + + <wsdl:output message="tns:echo_floatResponse" name="echo_floatResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_double"> + <wsdl:input message="tns:echo_doubleRequest" name="echo_doubleRequest" /> + + <wsdl:output message="tns:echo_doubleResponse" name="echo_doubleResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_boolean"> + <wsdl:input message="tns:echo_booleanRequest" name="echo_booleanRequest" /> + + <wsdl:output message="tns:echo_booleanResponse" name="echo_booleanResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_char"> + <wsdl:input message="tns:echo_charRequest" name="echo_charRequest" /> + + <wsdl:output message="tns:echo_charResponse" name="echo_charResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_String"> + <wsdl:input message="tns:echo_StringRequest" name="echo_StringRequest" /> + + <wsdl:output message="tns:echo_StringResponse" name="echo_StringResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_BigDecimal"> + <wsdl:input message="tns:echo_BigDecimalRequest" name="echo_BigDecimalRequest" /> + + <wsdl:output message="tns:echo_BigDecimalResponse" name="echo_BigDecimalResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_BigInteger"> + <wsdl:input message="tns:echo_BigIntegerRequest" name="echo_BigIntegerRequest" /> + + <wsdl:output message="tns:echo_BigIntegerResponse" name="echo_BigIntegerResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_Vector"> + <wsdl:input message="tns:echo_VectorRequest" name="echo_VectorRequest" /> + + <wsdl:output message="tns:echo_VectorResponse" name="echo_VectorResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_GregorianCalendar"> + <wsdl:input message="tns:echo_GregorianCalendarRequest" name="echo_GregorianCalendarRequest" /> + + <wsdl:output message="tns:echo_GregorianCalendarResponse" name="echo_GregorianCalendarResponse" /> + + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="SCATestUtilityServiceSoapBinding" type="tns:SCATestUtilityService"> + <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> --> + + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="ping"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="pingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="pingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="asyncping"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="asyncpingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="asyncpingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_int"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_intRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_intResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_short"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_shortRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_shortResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_long"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_longRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_longResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_float"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_floatRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_floatResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_double"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_doubleRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_doubleResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_boolean"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_booleanRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_booleanResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_char"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_charRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_charResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_String"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_StringRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_StringResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_BigDecimal"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_BigDecimalRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_BigDecimalResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_BigInteger"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_BigIntegerRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_BigIntegerResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_Vector"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_VectorRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_VectorResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_GregorianCalendar"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_GregorianCalendarRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_GregorianCalendarResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="SCATestUtilityService"> + <wsdl:port binding="tns:SCATestUtilityServiceSoapBinding" name="SCATestUtilityServiceSoapPort"> + <wsdlsoap:address location="http://localhost:8081/services/SCATestUtilityWSService" /> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java new file mode 100644 index 0000000000..727eb2332f --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.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 org.apache.tuscany.sca.itest; + + +import java.io.IOException; +import java.net.Socket; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; + +public class SCATestToolServerTestCase extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml b/sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml new file mode 100644 index 0000000000..3f63e5d2eb --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml @@ -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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.tuscany.testing.bindingstest</groupId> + <artifactId>itest-bindings-bindingsutility</artifactId> + <packaging>jar</packaging> + <name>SCA FVT Bindings Test Tool Utility Composite</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-api-r2.1</artifactId> + <version>1.0-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <!-- SDO's XXXHelper.INSTANCE pattern requires the implementation --> + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + +</project> diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java new file mode 100644 index 0000000000..664fb06930 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java @@ -0,0 +1,28 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +/** + * SCA Test Tool Callback Service + */ + +public interface SCATestToolCallbackService { + + public void pingCallBack(String reply); +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java new file mode 100644 index 0000000000..cd967e275a --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.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 org.apache.tuscany.sca.util; + + +import java.io.IOException; + +import org.apache.tuscany.api.SCARuntime; + +public class SCATestUtilityServer { + + /** + * @param args + */ + public static void main(String[] args) { + + SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite"); + + try { + System.out.println("SCATestUtility server started"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + SCARuntime.stop(); + System.out.println("SCATestUtility server stopped"); + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java new file mode 100644 index 0000000000..0ceb553727 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java @@ -0,0 +1,64 @@ +/* + * 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 org.apache.tuscany.sca.util; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Vector; +import java.util.GregorianCalendar; + +import org.apache.tuscany.sca.itest.SCATestToolCallbackService; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +/** + * SCA Test Utility Service + */ + +@Remotable +public interface SCATestUtilityService { + public String ping(String input); + + @Callback(SCATestToolCallbackService.class) + public void asyncping(); + + public int echo_int(int input); + + public short echo_short(short input); + + public long echo_long(long input); + + public float echo_float(float input); + + public double echo_double(double input); + + public boolean echo_boolean(boolean input); + + public char echo_char(char input); + + public String echo_String(String input); + + public BigDecimal echo_BigDecimal(BigDecimal input); + + public BigInteger echo_BigInteger(BigInteger input); + + public Vector echo_Vector(Vector input); + + public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input); +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java new file mode 100644 index 0000000000..e752e4d6e6 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java @@ -0,0 +1,157 @@ +/* + * 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 org.apache.tuscany.sca.util; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.InetAddress; +import java.util.GregorianCalendar; +import java.util.Properties; +import java.util.Vector; + +import org.osoa.sca.annotations.Service; + +@Service(SCATestUtilityService.class) +public class SCATestUtilityServiceImpl implements SCATestUtilityService { + + // private SCATestToolCallbackService utilCallBack; + + /** + * The setter used by the runtime to set the callback reference + * + * @param myServiceCallback + */ + + // @Callback + // public void setCallback(SCATestToolCallbackService utilCallBack) { + // this.utilCallBack = utilCallBack; + // } + public String ping(String input) { + System.out.println("Invoking SCATestUtilityServiceImpl.ping()"); + StringBuffer rc = new StringBuffer(); + + try { + // get a systems property object + Properties sp = System.getProperties(); + rc.append("Pinged SCA Test Utility Service on: "); + // get operating system info + rc.append(sp.getProperty("os.name")); + rc.append(", " + sp.getProperty("os.version")); + // get network info + rc.append(" - " + InetAddress.getLocalHost().toString()); + } catch (Exception e) { + System.out.println("\nException preparing system infomation for ping service reply\n" + e.toString()); + e.printStackTrace(); + } + return rc.toString(); + } + + public void asyncping() { + + StringBuffer rc = new StringBuffer(); + + try { + // get a systems property object + Properties sp = System.getProperties(); + rc.append("Pinged SCA Test Utility Service on: "); + // get operating system info + rc.append(sp.getProperty("os.name")); + rc.append(", " + sp.getProperty("os.version")); + // get network info + rc.append(" - " + InetAddress.getLocalHost().toString()); + } catch (Exception e) { + System.out.println("\nException preparing system infomation for ping service reply\n" + e.toString()); + e.printStackTrace(); + } + // utilCallBack.pingCallBack(rc.toString()); + } + + public int echo_int(int input) { + int local; + local = input; + return local; + } + + public short echo_short(short input) { + short local; + local = input; + return local; + } + + public long echo_long(long input) { + long local; + local = input; + return local; + } + + public float echo_float(float input) { + float local; + local = input; + return local; + } + + public double echo_double(double input) { + double local; + local = input; + return local; + } + + public boolean echo_boolean(boolean input) { + boolean local; + local = input; + return local; + } + + public char echo_char(char input) { + char local; + local = input; + return local; + } + + public String echo_String(String input) { + String local; + local = input; + return local; + } + + public BigDecimal echo_BigDecimal(BigDecimal input) { + BigDecimal local; + local = input; + return local; + } + + public BigInteger echo_BigInteger(BigInteger input) { + BigInteger local; + local = input; + return local; + } + + public Vector echo_Vector(Vector input) { + Vector local; + local = input; + return local; + } + + public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input) { + GregorianCalendar local; + local = input; + return local; + } + +} diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite new file mode 100644 index 0000000000..7126b78572 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite @@ -0,0 +1,36 @@ +<?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.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+ + <component name="httpserver"> + <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" /> + <property name="httpPort">8081</property> + </component> +
+</composite>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite new file mode 100644 index 0000000000..4d3d9bc523 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite @@ -0,0 +1,39 @@ +<?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" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0" + xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="bindingsutility">
+
+ <!-- dbsdo:import.sdo location="wsdl/testutility.wsdl" / -->
+
+ <service name="SCATestUtilityWSService">
+ <interface.wsdl interface="http://scatestutil.scabeta1fvt#wsdl.interface(SCATestUtilityService)"
+ wsdli:wsdlLocation="http://scatestutil.scabeta1fvt wsdl/testutility.wsdl" />
+ <reference>SCATestUtilityWSServiceComponent</reference>
+ <binding.ws endpoint="http://scatestutil.scabeta1fvt#wsdl.endpoint(SCATestUtilityService/SCATestUtilityServiceSoapPort)"
+ location="wsdl/testutility.wsdl" uri="testutil" />
+ </service>
+
+ <component name="SCATestUtilityWSServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.util.SCATestUtilityServiceImpl" />
+ </component>
+</composite>
+
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl new file mode 100644 index 0000000000..32d9050a61 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl @@ -0,0 +1,704 @@ +<?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.
+--> +<wsdl:definitions targetNamespace="http://scatestutil.scabeta1fvt" xmlns:impl="http://scatestutil.scabeta1fvt"
+ xmlns:tns="http://scatestutil.scabeta1fvt" xmlns:tns2="http://xml.apache.org/xml-soap" xmlns:tns3="http://util.java"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testutility"> + <wsdl:types> + + <schema elementFormDefault="qualified" targetNamespace="http://scatestutil.scabeta1fvt"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://xml.apache.org/xml-soap"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <import namespace="http://xml.apache.org/xml-soap" /> + <element name="pingResponse"> + <complexType> + <sequence> + <element name="pingReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="asyncping"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="asyncpingResponse"> + <complexType> + <sequence /> + </complexType> + </element> + <element name="echo_int"> + <complexType> + <sequence> + <element name="input" type="xsd:int" /> + </sequence> + </complexType> + </element> + <element name="echo_intResponse"> + <complexType> + <sequence> + <element name="echo_intReturn" type="xsd:int" /> + </sequence> + </complexType> + </element> + <element name="echo_short"> + <complexType> + <sequence> + <element name="input" type="xsd:short" /> + </sequence> + </complexType> + </element> + <element name="echo_shortResponse"> + <complexType> + <sequence> + <element name="echo_shortReturn" type="xsd:short" /> + </sequence> + </complexType> + </element> + <element name="echo_long"> + <complexType> + <sequence> + <element name="input" type="xsd:long" /> + </sequence> + </complexType> + </element> + <element name="echo_longResponse"> + <complexType> + <sequence> + <element name="echo_longReturn" type="xsd:long" /> + </sequence> + </complexType> + </element> + <element name="echo_float"> + <complexType> + <sequence> + <element name="input" type="xsd:float" /> + </sequence> + </complexType> + </element> + <element name="echo_floatResponse"> + <complexType> + <sequence> + <element name="echo_floatReturn" type="xsd:float" /> + </sequence> + </complexType> + </element> + <element name="echo_double"> + <complexType> + <sequence> + <element name="input" type="xsd:double" /> + </sequence> + </complexType> + </element> + <element name="echo_doubleResponse"> + <complexType> + <sequence> + <element name="echo_doubleReturn" type="xsd:double" /> + </sequence> + </complexType> + </element> + <element name="echo_boolean"> + <complexType> + <sequence> + <element name="input" type="xsd:boolean" /> + </sequence> + </complexType> + </element> + <element name="echo_booleanResponse"> + <complexType> + <sequence> + <element name="echo_booleanReturn" type="xsd:boolean" /> + </sequence> + </complexType> + </element> + <element name="echo_char"> + <complexType> + <sequence> + <element name="input" type="tns2:char" /> + </sequence> + </complexType> + </element> + <element name="echo_charResponse"> + <complexType> + <sequence> + <element name="echo_charReturn" type="tns2:char" /> + </sequence> + </complexType> + </element> + <element name="echo_String"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="echo_StringResponse"> + <complexType> + <sequence> + <element name="echo_StringReturn" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + <element name="echo_BigDecimal"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:decimal" /> + </sequence> + </complexType> + </element> + <element name="echo_BigDecimalResponse"> + <complexType> + <sequence> + <element name="echo_BigDecimalReturn" minOccurs="0" type="xsd:decimal" /> + </sequence> + </complexType> + </element> + <element name="echo_BigInteger"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:integer" /> + </sequence> + </complexType> + </element> + <element name="echo_BigIntegerResponse"> + <complexType> + <sequence> + <element name="echo_BigIntegerReturn" minOccurs="0" type="xsd:integer" /> + </sequence> + </complexType> + </element> + <element name="echo_Vector"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="tns2:Vector" /> + </sequence> + </complexType> + </element> + <element name="echo_VectorResponse"> + <complexType> + <sequence> + <element name="echo_VectorReturn" minOccurs="0" type="tns2:Vector" /> + </sequence> + </complexType> + </element> + <element name="echo_GregorianCalendar"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:anyType" /> + </sequence> + </complexType> + </element> + <element name="echo_GregorianCalendarResponse"> + <complexType> + <sequence> + <element name="echo_GregorianCalendarReturn" minOccurs="0" type="xsd:anyType" /> + </sequence> + </complexType> + </element> + <element name="ping"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + </element> + </schema> + <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <simpleType name="char"> + <restriction base="xsd:string"> + <length value="1" /> + </restriction> + </simpleType> + <complexType name="Vector"> + <sequence> + <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" /> + </sequence> + </complexType> + </schema> + </wsdl:types> + + <wsdl:message name="echo_StringRequest"> + <wsdl:part element="tns:echo_String" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_shortResponse"> + <wsdl:part element="tns:echo_shortResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="asyncpingRequest"> + <wsdl:part element="tns:asyncping" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="asyncpingResponse"> + <wsdl:part element="tns:asyncpingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_doubleResponse"> + <wsdl:part element="tns:echo_doubleResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigDecimalResponse"> + <wsdl:part element="tns:echo_BigDecimalResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_shortRequest"> + <wsdl:part element="tns:echo_short" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigIntegerRequest"> + <wsdl:part element="tns:echo_BigInteger" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_VectorRequest"> + <wsdl:part element="tns:echo_Vector" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="pingResponse"> + <wsdl:part element="tns:pingResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_charResponse"> + <wsdl:part element="tns:echo_charResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_VectorResponse"> + <wsdl:part element="tns:echo_VectorResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_longRequest"> + <wsdl:part element="tns:echo_long" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_doubleRequest"> + <wsdl:part element="tns:echo_double" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigDecimalRequest"> + <wsdl:part element="tns:echo_BigDecimal" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_GregorianCalendarRequest"> + <wsdl:part element="tns:echo_GregorianCalendar" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_floatResponse"> + <wsdl:part element="tns:echo_floatResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_booleanRequest"> + <wsdl:part element="tns:echo_boolean" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_booleanResponse"> + <wsdl:part element="tns:echo_booleanResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_StringResponse"> + <wsdl:part element="tns:echo_StringResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_floatRequest"> + <wsdl:part element="tns:echo_float" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_GregorianCalendarResponse"> + <wsdl:part element="tns:echo_GregorianCalendarResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_intResponse"> + <wsdl:part element="tns:echo_intResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_longResponse"> + <wsdl:part element="tns:echo_longResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_charRequest"> + <wsdl:part element="tns:echo_char" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="pingRequest"> + <wsdl:part element="tns:ping" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_intRequest"> + <wsdl:part element="tns:echo_int" name="parameters" /> + + </wsdl:message> + + <wsdl:message name="echo_BigIntegerResponse"> + <wsdl:part element="tns:echo_BigIntegerResponse" name="parameters" /> + + </wsdl:message> + + <wsdl:portType name="SCATestUtilityService"> + <wsdl:operation name="ping"> + <wsdl:input message="tns:pingRequest" name="pingRequest" /> + + <wsdl:output message="tns:pingResponse" name="pingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="asyncping"> + <wsdl:input message="tns:asyncpingRequest" name="asyncpingRequest" /> + + <wsdl:output message="tns:asyncpingResponse" name="asyncpingResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_int"> + <wsdl:input message="tns:echo_intRequest" name="echo_intRequest" /> + + <wsdl:output message="tns:echo_intResponse" name="echo_intResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_short"> + <wsdl:input message="tns:echo_shortRequest" name="echo_shortRequest" /> + + <wsdl:output message="tns:echo_shortResponse" name="echo_shortResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_long"> + <wsdl:input message="tns:echo_longRequest" name="echo_longRequest" /> + + <wsdl:output message="tns:echo_longResponse" name="echo_longResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_float"> + <wsdl:input message="tns:echo_floatRequest" name="echo_floatRequest" /> + + <wsdl:output message="tns:echo_floatResponse" name="echo_floatResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_double"> + <wsdl:input message="tns:echo_doubleRequest" name="echo_doubleRequest" /> + + <wsdl:output message="tns:echo_doubleResponse" name="echo_doubleResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_boolean"> + <wsdl:input message="tns:echo_booleanRequest" name="echo_booleanRequest" /> + + <wsdl:output message="tns:echo_booleanResponse" name="echo_booleanResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_char"> + <wsdl:input message="tns:echo_charRequest" name="echo_charRequest" /> + + <wsdl:output message="tns:echo_charResponse" name="echo_charResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_String"> + <wsdl:input message="tns:echo_StringRequest" name="echo_StringRequest" /> + + <wsdl:output message="tns:echo_StringResponse" name="echo_StringResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_BigDecimal"> + <wsdl:input message="tns:echo_BigDecimalRequest" name="echo_BigDecimalRequest" /> + + <wsdl:output message="tns:echo_BigDecimalResponse" name="echo_BigDecimalResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_BigInteger"> + <wsdl:input message="tns:echo_BigIntegerRequest" name="echo_BigIntegerRequest" /> + + <wsdl:output message="tns:echo_BigIntegerResponse" name="echo_BigIntegerResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_Vector"> + <wsdl:input message="tns:echo_VectorRequest" name="echo_VectorRequest" /> + + <wsdl:output message="tns:echo_VectorResponse" name="echo_VectorResponse" /> + + </wsdl:operation> + + <wsdl:operation name="echo_GregorianCalendar"> + <wsdl:input message="tns:echo_GregorianCalendarRequest" name="echo_GregorianCalendarRequest" /> + + <wsdl:output message="tns:echo_GregorianCalendarResponse" name="echo_GregorianCalendarResponse" /> + + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="SCATestUtilityServiceSoapBinding" type="tns:SCATestUtilityService"> + <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> --> + + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="ping"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="pingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="pingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="asyncping"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="asyncpingRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="asyncpingResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_int"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_intRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_intResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_short"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_shortRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_shortResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_long"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_longRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_longResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_float"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_floatRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_floatResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_double"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_doubleRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_doubleResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_boolean"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_booleanRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_booleanResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_char"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_charRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_charResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_String"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_StringRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_StringResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_BigDecimal"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_BigDecimalRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_BigDecimalResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_BigInteger"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_BigIntegerRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_BigIntegerResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_Vector"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_VectorRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_VectorResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + <wsdl:operation name="echo_GregorianCalendar"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="echo_GregorianCalendarRequest"> + <wsdlsoap:body use="literal" /> + + </wsdl:input> + + <wsdl:output name="echo_GregorianCalendarResponse"> + <wsdlsoap:body use="literal" /> + + </wsdl:output> + + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="SCATestUtilityService"> + <wsdl:port binding="tns:SCATestUtilityServiceSoapBinding" name="SCATestUtilityServiceSoapPort"> + <wsdlsoap:address location="http://localhost:8081/services/SCATestUtilityWSService" /> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java new file mode 100644 index 0000000000..66246fc006 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.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 org.apache.tuscany.sca.util; + + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; + +import junit.framework.TestCase; + +public class SCATestUtilityServerTestCase extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8081); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sandbox/old/contrib/itest/bindings/pom.xml b/sandbox/old/contrib/itest/bindings/pom.xml new file mode 100644 index 0000000000..e85f560bf2 --- /dev/null +++ b/sandbox/old/contrib/itest/bindings/pom.xml @@ -0,0 +1,41 @@ +<?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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <version>1.1-incubating-SNAPSHOT</version> + <artifactId>bindingstest</artifactId> + <packaging>pom</packaging> + <name>SCA FVT Test Tool Suite</name> + + + <modules> + <module>bindingscomposite</module> + <module>bindingsutility</module> + <module>bindingsclient</module> + </modules> +</project> diff --git a/sandbox/old/contrib/itest/conversations/pom.xml b/sandbox/old/contrib/itest/conversations/pom.xml new file mode 100644 index 0000000000..481485efeb --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/pom.xml @@ -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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-conversations</artifactId> + <name>Apache Tuscany SCA Conversations Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java new file mode 100644 index 0000000000..640ec22a4f --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.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 org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java new file mode 100644 index 0000000000..dbe51bcbea --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java @@ -0,0 +1,48 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java new file mode 100644 index 0000000000..8f008fa711 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java @@ -0,0 +1,36 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java new file mode 100644 index 0000000000..546382cfd1 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java @@ -0,0 +1,62 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java new file mode 100644 index 0000000000..9deef312ac --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java @@ -0,0 +1,75 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational.impl; + +import org.apache.tuscany.sca.itest.conversational.ConversationalService; +import org.osoa.sca.annotations.ConversationAttributes; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationalService.class) +@Scope("CONVERSATION") +@ConversationAttributes(maxAge="1 seconds") +public class ConversationAgeComponentImpl implements ConversationalService { + + private int count; + + public void businessException() throws Exception { + } + + public void businessExceptionCallback() throws Exception { + } + + public void destroy() { + } + + public String endConversation() { + return null; + } + + public String endConversationCallback() { + return null; + } + + public void incrementCount() { + } + + public void incrementCountCallback() { + } + + public void init() { + } + + public void initializeCount(int count) { + this.count = count; + } + + public void initializeCountCallback(int count) { + } + + public int retrieveCount() { + return count; + } + + public int retrieveCountCallback() { + return 0; + } + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java new file mode 100644 index 0000000000..1196b6ac0d --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.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 org.apache.tuscany.sca.itest.conversational.impl; + +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationIdService.class) +@Scope("CONVERSATION") +public class ConversationIdComponentImpl implements ConversationIdService { + + @ConversationID + public String cid; + + private String setterCid; + + public String getCIDField() { + return cid; + } + public String getCIDSetter() { + return setterCid; + } + + + @ConversationID + public void setCID(String cid) { + this.setterCid = cid; + } +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java new file mode 100644 index 0000000000..11d5ea186b --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational.impl; + +import org.osoa.sca.annotations.Conversational; + +@Conversational +public interface ConversationIdService { + + String getCIDField(); + String getCIDSetter(); +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java new file mode 100644 index 0000000000..1272c7ab7f --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java @@ -0,0 +1,75 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational.impl; + +import org.apache.tuscany.sca.itest.conversational.ConversationalService; +import org.osoa.sca.annotations.ConversationAttributes; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationalService.class) +@Scope("CONVERSATION") +@ConversationAttributes(maxIdleTime="1 seconds") +public class ConversationMaxIdleComponentImpl implements ConversationalService { + + private int count; + + public void businessException() throws Exception { + } + + public void businessExceptionCallback() throws Exception { + } + + public void destroy() { + } + + public String endConversation() { + return null; + } + + public String endConversationCallback() { + return null; + } + + public void incrementCount() { + } + + public void incrementCountCallback() { + } + + public void init() { + } + + public void initializeCount(int count) { + this.count = count; + } + + public void initializeCountCallback(int count) { + } + + public int retrieveCount() { + return count; + } + + public int retrieveCountCallback() { + return 0; + } + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java new file mode 100644 index 0000000000..4e2c721040 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java @@ -0,0 +1,249 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java new file mode 100644 index 0000000000..1470c699c0 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java @@ -0,0 +1,243 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java new file mode 100644 index 0000000000..8fe7c5b6ba --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.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 org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java new file mode 100644 index 0000000000..efcbdff06f --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java @@ -0,0 +1,117 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java new file mode 100644 index 0000000000..dca0596b87 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java @@ -0,0 +1,121 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java new file mode 100644 index 0000000000..b1332833bb --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java @@ -0,0 +1,93 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.sca.itest.conversational.ConversationalService; +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Service; + +@Service(ConversationalService.class) +public class ConversationalServiceStatelessScope implements ConversationalService { + + @ConversationID + protected String cid; + + static Map<String, Integer> state = new HashMap<String, Integer>(); + + public void destroy() { + // TODO Auto-generated method stub + + } + + public String endConversation() { + state.remove(cid); + return cid; + } + + public String endConversationCallback() { + // TODO Auto-generated method stub + return null; + + } + + public void incrementCount() { + state.put(cid, Integer.valueOf(state.get(cid)+1)); + } + + public void businessException() throws Exception { + throw new Exception("Business Exception"); + } + + public void incrementCountCallback() { + // TODO Auto-generated method stub + + } + + public void init() { + // TODO Auto-generated method stub + + } + + public void initializeCount(int count) { + state.put(cid, Integer.valueOf(count)); + } + + public void initializeCountCallback(int count) { + // TODO Auto-generated method stub + + } + + public void businessExceptionCallback() throws Exception { + throw new Exception("Business Exception"); + } + + public int retrieveCount() { + return state.get(cid); + } + + public int retrieveCountCallback() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java new file mode 100644 index 0000000000..90c674c6ac --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java @@ -0,0 +1,37 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Conversational +/** + * + */ +public interface AnotherService { + + public void setService(ServiceReference aServiceReference); + public void add(int anInt); + public int getCount(); + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java new file mode 100644 index 0000000000..027109787a --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java @@ -0,0 +1,69 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import junit.framework.Assert; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(AnotherService.class) +@Scope("CONVERSATION") + +public class AnotherServiceImpl implements AnotherService { + + // This is a simple pass-thru service used to test propogation + // of ServiceReference and maintenance of Session state. + + private ServiceReference aServiceReference; + + public void add(int anInt) { + + Assert.assertNotNull("AnotherServiceImpl - add ", aServiceReference); + ((ConversationsService) aServiceReference).add(anInt); + + } + + + public void initializeCount() { + + Assert.assertNotNull("AnotherServiceImpl - initializeCount ", aServiceReference); + ((ConversationsService) aServiceReference).initializeCount(); + + } + + + public void setService(ServiceReference aRef) { + + Assert.assertNotNull("AnotherServiceImpl - setService ", aRef); + aServiceReference = aRef; + + } + + + public int getCount() { + + Assert.assertNotNull("AnotherServiceImpl - getCount ", aServiceReference); + return ((ConversationsService) aServiceReference).getLocalCount(); + } + + +} + diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java new file mode 100644 index 0000000000..18e935e089 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java @@ -0,0 +1,34 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import org.osoa.sca.annotations.Conversational; + +@Conversational +/** + * + * + */ +public interface ConversationsCallback { + + public void callBackMessage(String aString); + public void callBackIncrement(String aString); + public void callBackEndSession(); + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java new file mode 100644 index 0000000000..ff677db74d --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Conversational +public interface ConversationsClient { + + public void run(); + public int count(); + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java new file mode 100644 index 0000000000..389b1f4d93 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Conversational +public interface ConversationsClient2 { + public String getDateTime(); + + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java new file mode 100644 index 0000000000..54a437e66a --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java @@ -0,0 +1,496 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import java.io.File; +import java.text.DateFormat; + +import junit.framework.Assert; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ConversationEndedException; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.ConversationAttributes; +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(interfaces={ConversationsClient.class,ConversationsClient2.class}) + + +@Scope("CONVERSATION") +@ConversationAttributes(maxIdleTime="10 minutes", + singlePrincipal=false) + + +public class ConversationsClientImpl implements ConversationsClient, ConversationsClient2, ConversationsCallback { + + @Reference + protected ConversationsService aService; + @Reference + protected AnotherService anotherService; + @Reference + protected ConversationsLifeCycleService aLifeCycleService; + @Context + protected ComponentContext myContext; + @ConversationID + protected String conversationID; + + private Object monitor = new Object(); + private int count=0; + private String message; + private String initialState; + private int initialCount = 56; + private String dateTime; + private final static String markerFileName = "target/testConversations_test3_marker"; + + public ConversationsClientImpl() { + System.out.println("xxxxxxxxxx"); + } + + public void run() { + + // This tests various aspects of session lifecycle and maintenance of session state. + // None of these test are working due to various issues. + + /* test0() + This test verifies annotations and API's for ConversationID. + */ + test0(); // - Tuscany-1001. + + /* test1() + Test stateful callbacks. Verify that the client�s state is maintained throughout the execution of + all callback methods. + */ + test1(); // This test is working for MODULE scope. Cant claim succcess because it needs Conversation scope. + + /* test2() + Test each method of starting a session. Test @Init. + */ + test2(); // Tuscany-965, Tuscany-1001 + + /* test3() + Test each method of ending a session. Test @Destroy. + */ + test3(); // Tuscany-965, Tuscany-1001 + + /* test4() + Pass an existing service reference with an active session to another service. Verify the session is maintained + */ + test4(); // Tuscany-964, Tuscant-1001 + + /* test5() + Call the createServiceReferenceForSession() API to get a service reference for the active session. + Pass the service reference to another service. Verify the session is maintained. + */ + test5(); + + /* test6() + * Allow a session to timeout. + */ + test6(); // Tuscany-965, Tuscany-1001 + + + return; + } + + private void test0() + { + + // Verify that conversationID was injected. + Assert.assertNotNull("test0 - conversationID injected", conversationID); + System.out.println("ConversationID: " + conversationID); + + // + // The client may access the ConversationID by calling getConversationID on a Service Reference. + // This also verifies a session was created during injection of this Service Reference. + // + // TODO: this fails as the cid is null as a conversation has not been started yet (which seems expected to me) +// ServiceReference<ConversationsService> aServiceserviceRef = myContext.getServiceReference(ConversationsService.class, "aService"); +// System.out.println("aServices cid: " + aServiceserviceRef.getConversationID()); +// Assert.assertNotNull("test0 - ConversationID from service reference", aServiceserviceRef.getConversationID()); + + //FIXME Port to the 1.0 spec API + //Object aLifeCycleServicesSessionID =((ServiceReference)aLifeCycleService).getSessionID(); + //Assert.assertNotNull("test0 - ConversationID from LifeCycleService service reference", aLifeCycleServicesSessionID); + + // This will verify the @Init() is working for a session created during injection. See test2(). + aLifeCycleService.knockKnock("Hello"); + + } + + private void test1() + { + + // + // This test verifies that the state of the client is preserved across method calls. Each + // call to the service results in 2 callbacks. One to increment a count and the other to set a string. + // At the end of the test the count should equal 5 and the string should be set. Also the original strings + // values should be preserved. + // + // + initialState = "Initial State"; + + int numCalls = 0; + + for(int i=0; i < 10; i++) + { + aService.knockKnock("Knock Knock " + ++numCalls); + } + + // I want to drive multiple callbacks and then give them time to complete. Don't want to + // force serialization. After 20 seconds check the assertions. + + synchronized(monitor) + { + try + { + monitor.wait(2000L); + } + catch (Exception ex) + {ex.printStackTrace();} + } + + // Here we test for the expected state of several different variables. State needs to be maintained + // across method calls to the service. If the same client instance is used then the state should match + // the following assertions. + + // instance variable count should equal the number of calls to the backend service. count is incremented + // during callback processing. + Assert.assertEquals("Conversations - Test1 count", numCalls, count); + // The returned message should be like the following. + Assert.assertEquals("Conversations - Test1 message", true, message.startsWith("Who's There")); + // any initial state set prior to running the callbacks should be maintained. + Assert.assertEquals("Conversations - Test1 initialState", "Initial State", initialState); + Assert.assertEquals("Conversations - Test1 initialCount", 56, initialCount); + + return; + + } + + private void test2() + { + + // Verify the various methods to create a new Session. + // Sesssions can be started: + // + // 1) When a service reference is injected into a client. This is verified in test0(). + // 2) By the client calling newSession() API with and without a ConversationID. + // + // Verify init() is called prior to any business methods. This is performed in the Service when any + // business methos is called. + + Assert.assertNotNull("current composite context",myContext); + + // This tests creating a conversational session. And that @Init is run prior to business method. + ServiceReference aServRef = null; + //FIXME Port to the 1.0 spec API + //aServRef = myContext.newSession("ConversationsLifeCycleService"); +// Assert.assertNotNull("Conversations - Test2 Service Reference 1 not returned", aServRef); + + //FIXME Port to the 1.0 spec API + //Get the session ID. + //Object aConversationID = aServRef.getSessionID(); + ConversationsLifeCycleService aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef; + aConversationsLifeCycleService.knockKnock("Hello"); + + //Create a new session this time specifying a session ID. Verify the seesion id is what was specified. + //FIXME Port to the 1.0 spec API + //aServRef = myContext.newSession("ConversationsLifeCycleService","Test2-12345"); + Assert.assertNotNull("Conversations - Test2 Service Reference 2 not returned", aServRef); + //FIXME Port to the 1.0 spec API + //Get the session ID. + //Object aConversationID2 = aServRef.getSessionID(); + //Assert.assertEquals("Conversations - Test2 Session not created with specified ConversationID", "Test2-12345", aConversationID2); + aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef; + aConversationsLifeCycleService.knockKnock("Hello"); + + //FIXME Port to the 1.0 spec API + //Assert.assertNotSame("Conversations - Test2 sessions are not different", aConversationID, aConversationID2); + + } + + private void test3() + { + + // Note: The @EndSesion and @EndsConversation anotations are not implemented. + // So #1 an #2 cannot be done. + + // + // Verify the various methods to end a session. + // Sesssions can be ended: + // + // 1) Server operation annotated with @EndsConversation. + // 2) Server operation calls an @EndSession annotated callback method. + // 3) Servers conversation lifetime times out. This is test6() so its not implimented in the test3 method. + // 4) The client calls ServiceReference.endSession(); + // + // Verify @Destroy annotated method get called after completion of the business + // method that called the endSession. + // + + ConversationsLifeCycleService aConversationsLifeCycleService; +//FIXME Port to the 1.0 spec API +// Object aConversationID; + Assert.assertNotNull("current composite context",myContext); + ServiceReference aServRef; + this.removeMarkerFile(); + + // + // test3 variation #1 - Cannot be done annotation not implimented yet. 12/15/2006 + // + + //FIXME Port to the 1.0 spec API + //aServRef = myContext.newSession("ConversationsLifeCycleService"); + aServRef = null; + Assert.assertNotNull("Conversations - Test3-1 Service Reference not returned", aServRef); + + aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef; + aConversationsLifeCycleService.knockKnock("Hello"); + //FIXME Port to the 1.0 spec API + //aConversationID = aServRef.getSessionID(); + //Assert.assertNotNull("Conversations - Test3-1 ConversationID not found", aConversationID); + + //Call the business method annotated with @EndsConversation. + aConversationsLifeCycleService.endThisSession(); // This should also drive @Destroy method. + + // Verify session has ended. The ConversationID should be null; + //FIXME Port to the 1.0 spec API + //aConversationID = aServRef.getSessionID(); + //Assert.assertNull("Conversations - Test3-1 session not null after endSession()", aConversationID); + + // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run. + Assert.assertEquals("Conversations - Test3-1 @Destroy method not invoked", true, this.isMarkerFilePresent()); + this.removeMarkerFile(); + + // + // test3 variation #2 - Cannot be done annotation not implimented yet. 12/15/2006 + // + + //FIXME Port to the 1.0 spec API + //aServRef = myContext.newSession("ConversationsLifeCycleService"); + Assert.assertNotNull("Conversations - Test3-2 Service Reference not returned", aServRef); + + aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef; + aConversationsLifeCycleService.knockKnock("Hello"); + //FIXME Port to the 1.0 spec API + //aConversationID = aServRef.getSessionID(); + //Assert.assertNotNull("Conversations - Test3-2 ConversationID not found", aConversationID); + + //Call the business method that will invoke my @EndSession callback method. + aConversationsLifeCycleService.endThisSessionUsingCallback(); // This should also drive @Destroy method. + + // Verify session has ended. The ConversationID should be null; + //FIXME Port to the 1.0 spec API + //aConversationID = aServRef.getSessionID(); + //Assert.assertNull("Conversations - Test3-2 session not null after endSession()", aConversationID); + + // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run. + Assert.assertEquals("Conversations - Test3-2 @Destroy method not invoked", true, this.isMarkerFilePresent()); + this.removeMarkerFile(); + + // + // test3 variation #4 - Client calls endSession() + // + + //FIXME Port to the 1.0 spec API + //aServRef = myContext.newSession("ConversationsLifeCycleService"); + aServRef = null; + Assert.assertNotNull("Conversations - Test3-4 Service Reference not returned", aServRef); + + aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef; + aConversationsLifeCycleService.knockKnock("Hello"); + //FIXME Port to the 1.0 spec API + //aConversationID = aServRef.getSessionID(); + //Assert.assertNotNull("Conversations - Test3-4 ConversationID not found", aConversationID); + + //Call the endSession() API on the Service Reference. + //FIXME Port to the 1.0 spec API + //aServRef.endSession(); // This should also drive @Destroy method. + + // Verify session has ended. The ConversationID should be null; + //FIXME Port to the 1.0 spec API + //aConversationID = aServRef.getSessionID(); + //Assert.assertNull("Conversations - Test3-4 session not null after endSession()", aConversationID); + + // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run. + Assert.assertEquals("Conversations - Test3-4 @Destroy method not invoked", true, this.isMarkerFilePresent()); + this.removeMarkerFile(); + } + + public void test4() + { + + // + // This test uses the injected active session for the ConversationsService. It starts a conversation + // in this method building up state with a counter. It then passes this reference to another backend service adding + // additional state. It then returns and adds more state using original service and then performs the Assertions. + // + + aService.initializeCount(); + aService.add(1); + anotherService.setService((ServiceReference)aService); + anotherService.add(1); + anotherService.add(1); + aService.add(1); + aService.add(1); + int count = anotherService.getCount(); + + Assert.assertEquals("test4 - ConversationsClientImpl ", 5, count); + + return; + } + + + public void test5() + { + + // The first test verifies that the createServiceReferenceForSession(this) API is functioning. + // This is done in the backend serviced as it needs a single interface defined. The 2nd test + // uses the variant of this API when > 1 interfaces are implemented. + // + // The 2nd test obtains a service reference for myself and passes that reference to a backend service. + // The backend service then invokes the count() method on my service reference. It then returns + // the count that it retrieved. The test then asserts that the count returned from the backend + // service matches the client services internal state. + // + + Assert.assertNotNull("current composite context",myContext); + + boolean result = aService.createServiceReferenceForSelf(); + System.out.println("Laa: returned from createServiceReferenceForSelf() " + result); + Assert.assertEquals("test5 - createServiceReferenceForSelf",true,result); + + count = 6; + int returnCount = 0; + //FIXME Port to the 1.0 spec API + //ServiceReference myServiceReference = myContext.createServiceReferenceForSession(this,"ConversationsClient2"); + ServiceReference myServiceReference = null; + Assert.assertNotNull("test5 - createServiceReferenceForSession - myContext.createServiceReferenceForSession(this,ConversationsClient);", myServiceReference); + returnCount = aService.getCount(myServiceReference); + + Assert.assertEquals("test5 - createServiceReferenceForSession(this,ConversationsClient2)",count,returnCount); + String aRemoteDateTime = aService.getDateTime(myServiceReference); + Assert.assertEquals("test5 - createServiceReferenceForSession(this,ConversationsClient2 - dateTime)", dateTime, aRemoteDateTime); + + return; + } + + public void test6() + { + + // + // Create a session and allow it to timeout and verify that it did. + // Invoking a business method on a service that has timed out should result in + // a SessionEndedException. + // + + Assert.assertNotNull("current composite context",myContext); + + // This tests creating a conversational session. This service has a maxAge="5 seconds". + ServiceReference aServRef; + //FIXME Port to the 1.0 spec API + //aServRef = myContext.newSession("ConversationsLifeCycleService"); + aServRef = null; + Assert.assertNotNull("Conversations - Test6 Service Reference not returned", aServRef); + + // Run a business method. + ConversationsLifeCycleService aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef; + aConversationsLifeCycleService.knockKnock("Hello"); + + // + // wait 10 seconds so session will time out. + // + try { + Thread.sleep(10000L); + } + catch (InterruptedException ex) + { + ex.printStackTrace(); + } + + // Run a busineess method after timeout period has elapsed. + boolean sessionEnded = false; + try + { + aConversationsLifeCycleService.knockKnock("Hello"); + } + catch (ConversationEndedException sex) + { + sessionEnded = true; + } + + Assert.assertEquals("Conversations - Test6 Session did not timeout ", true, sessionEnded); + + return; + } + + + public synchronized void callBackIncrement(String aString) { + + count++; + System.out.println("Laa: callBackIncrement invoked on client. count = " + count); + + } + + public synchronized void callBackMessage(String aString) { + + message = aString; + System.out.println("Laa: callBackIMessage invoked on client. message = " + message); + + } + + // @EndSession - This is for test3() variation #2. + public void callBackEndSession() { + + System.out.println("Laa: callBackEndSession method invoked on client."); + + } + + public int count() + { + return this.count; + } + + public String getDateTime() { + + dateTime = DateFormat.getDateTimeInstance().toString(); + return dateTime; + + } + + private void removeMarkerFile() + { + // Make sure the marker file is not present before starting the test. + File aFile = new File(markerFileName); + if (aFile.exists()) + aFile.delete(); + } + + private boolean isMarkerFilePresent() + { + File aFile = new File(markerFileName); + return aFile.exists(); + } + + + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java new file mode 100644 index 0000000000..26dfcd9a38 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java @@ -0,0 +1,38 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(ConversationsCallback.class) +@Conversational + +/** + * + */ +public interface ConversationsLifeCycleService { + + public String knockKnock(String aString); + public void endThisSession(); + public void endThisSessionUsingCallback(); + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java new file mode 100644 index 0000000000..7f38e356f6 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java @@ -0,0 +1,97 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import java.io.File; + +import junit.framework.Assert; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.ConversationAttributes; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationsLifeCycleService.class) +@Scope("CONVERSATION") +@ConversationAttributes(maxAge="5 seconds") + +// This is a short-lived conversational service. + +public class ConversationsLifeCycleServiceImpl implements ConversationsLifeCycleService { + + @Callback + protected ConversationsCallback callback; + + private String state = "NOT READY"; + private final static String markerFileName = "target/testConversations_test3_marker"; + + + public String knockKnock(String aString) { + + // Prior to any business methods being invoked the state must have been set to READY using the @Init. + System.out.println("ConversationsLifeCycleServiceImpl.knockKnock - State = " + state); + Assert.assertEquals("ConversationsLifeCycleServiceImpl.knockKnock - not in READY state ", "READY", state); + + return "Who's There!"; + } + + @Init + public void init() + { + state = "READY"; + System.out.println("ConversationsLifeCycleServiceImpl.init()"); + } + + + @Destroy + public void destroy() + { + state = "DESTROYED"; + + File aFile = new File(markerFileName); + try + { + aFile.createNewFile(); + } + catch (Exception ex) + { + System.out.println("Error Creating " + markerFileName); + ex.printStackTrace(); + } + System.out.println("ConversationsLifeCycleServiceImpl.destroy()"); + } + +// @EndsConversation + public void endThisSession() { + //This method will end the current session by annotation. + System.out.println("ConversationsLifeCycleServiceImpl.endThisSession()"); + + } + + public void endThisSessionUsingCallback() { + + //This method will end the current session by a callback method annotated with @EndSession. + callback.callBackEndSession(); + System.out.println("ConversationsLifeCycleServiceImpl.endThisSessionUsingCallback()"); + } + +} + diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java new file mode 100644 index 0000000000..f878e22bf8 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.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 org.apache.tuscany.sca.test; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(ConversationsCallback.class) +@Conversational + +/** + * + */ +public interface ConversationsService { + + public void knockKnock(String aString); + public void add(int anInt); + public void initializeCount(); + public int getCount(ServiceReference aServiceReference); + public int getLocalCount(); + public String getDateTime(ServiceReference aServiceReference); + public boolean createServiceReferenceForSelf(); + +} diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java new file mode 100644 index 0000000000..45fc68308b --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java @@ -0,0 +1,147 @@ +/* + * 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 org.apache.tuscany.sca.test; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationsService.class) +@Scope("CONVERSATION") + +public class ConversationsServiceImpl implements ConversationsService { + + @Context + protected ComponentContext context; + + @Callback + protected ConversationsCallback callback; + private int count=0; + + public void knockKnock(String aString) { + + try + { + count++; + //System.out.println("ConversationsServiceImpl message received: " + aString); + callback.callBackMessage("Who's There " + count); + callback.callBackIncrement("Add one please"); + //System.out.println("ConversationsServiceImpl responses sent"); + return; + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + } + + public int getCount(ServiceReference aServiceReference) + { + + // + // Invoke a method on the service reference and return back the result. + // + + int count=0; + try + { + count = ((ConversationsClient) aServiceReference).count(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + return count; + + } + + public int getLocalCount() + { + + // + // Return my localc instance count. This is used for test4. + // + + return count; + + } + + public String getDateTime(ServiceReference aServiceReference) + { + + // + // Invoke a method on the service reference and return back the result. + // + + String dateTime; + dateTime = ((ConversationsClient2) aServiceReference).getDateTime(); + return dateTime; + + } + + public void add(int anInt) { + + count +=anInt; + + } + + public void initializeCount() { + + count =0; + + } + + public boolean createServiceReferenceForSelf() { + + // This is done here because we need to test getting a ServiceReference + // from a component that implements a single interface. The client in this test + // impliments 2 interfaces to test the variant of this that takes interface name as an argumnet. + + boolean aBoolean = false; + + ServiceReference myServiceReference = null; + + try + { + myServiceReference = context.createSelfReference(ConversationsService.class); + System.out.println("Laa: Created Service Reference for Session:" + myServiceReference); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + + if (myServiceReference != null) + { + aBoolean = true; + System.out.println("Laa: Service Reference is not null"); + } + + return aBoolean; + } + + +} + diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite new file mode 100644 index 0000000000..abd1c35ced --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite @@ -0,0 +1,31 @@ +<?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"
+ name="ConversationalIdTest">
+
+ <component name="ConversationAgeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationAgeComponentImpl"/>
+ </component>
+
+ <component name="ConversationIdleComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationMaxIdleComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite new file mode 100644 index 0000000000..93b44c260f --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite @@ -0,0 +1,43 @@ +<?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://conversations" + name="ConversationsTest"> + + <component name="ConversationsClient"> + <implementation.java class="org.apache.tuscany.sca.test.ConversationsClientImpl"/> + <reference name="aService" target="ConversationsService"/> + <reference name="anotherService" target="AnotherService"/> + <reference name="aLifeCycleService" target="ConversationLifeCycleService"/> + </component> + + <component name="ConversationsService"> + <implementation.java class="org.apache.tuscany.sca.test.ConversationsServiceImpl"/> + </component> + + <component name="AnotherService"> + <implementation.java class="org.apache.tuscany.sca.test.AnotherServiceImpl"/> + </component> + + <component name="ConversationLifeCycleService"> + <implementation.java class="org.apache.tuscany.sca.test.ConversationsLifeCycleServiceImpl"/> + </component> + +</composite> diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite new file mode 100644 index 0000000000..e61eb08194 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite @@ -0,0 +1,27 @@ +<?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"
+ name="ConversationalIdTest">
+
+ <component name="ConversationIdComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationIdComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite new file mode 100644 index 0000000000..43259f67c3 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite @@ -0,0 +1,64 @@ +<?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://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScope"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java new file mode 100644 index 0000000000..1138d2e1f0 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java @@ -0,0 +1,55 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational; + + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.itest.conversational.impl.ConversationIdService; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class ConversationIdTestCase { + + private SCADomain domain; + + @Before + public void setUp() throws Exception { + domain = SCADomain.newInstance("conversationId.composite"); + + } + + @After + public void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } + + @Test + public void testConversationId() { + ConversationIdService service = + domain.getService(ConversationIdService.class, "ConversationIdComponent"); + Assert.assertNotNull(service.getCIDField()); + Assert.assertNotNull(service.getCIDSetter()); + } + +} diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java new file mode 100644 index 0000000000..d7c6a0ed41 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java @@ -0,0 +1,95 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.osoa.sca.ConversationEndedException; + +public class ConversationalAgeTestCase { + + private SCADomain domain; + + @Before + public void setUp() throws Exception { + System.setProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval", "2"); + domain = SCADomain.newInstance("ConversationAge.composite"); + + } + + @After + public void tearDown() throws Exception { + System.clearProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval"); + if (domain != null) { + domain.close(); + } + } + + @Test + public void testMaxAge() throws InterruptedException { + + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationAgeComponent"); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + conversationalService.initializeCount(42); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Thread.sleep(3100); + Assert.assertEquals(0, conversationalService.retrieveCount()); + } + + @Test + public void testAgeExpired() throws InterruptedException { + + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationAgeComponent"); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + conversationalService.initializeCount(42); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Thread.sleep(1100); + try { + Assert.assertEquals(0, conversationalService.retrieveCount()); + Assert.fail(); + } catch (ConversationEndedException e) { + // expected + } + } + + @Test + public void testMaxIdle() throws InterruptedException { + + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationIdleComponent"); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + conversationalService.initializeCount(42); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Thread.sleep(3100); + Assert.assertEquals(0, conversationalService.retrieveCount()); + } + +} diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java new file mode 100644 index 0000000000..8480e04028 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java @@ -0,0 +1,84 @@ +/* + * 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 org.apache.tuscany.sca.itest.conversational; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class ConversationalJ2SETestCase { + + private SCADomain domain; + + @Before + public void setUp() throws Exception { + domain = SCADomain.newInstance("conversational.composite"); + + } + + @After + public void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } + + @Test + public void testStatefulConversation() { + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationalServiceStateful"); + + conversationalService.initializeCount(1); + Assert.assertEquals(1, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(2, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + + conversationalService.initializeCount(4); + Assert.assertEquals(4, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(5, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + } + + @Test + public void testStatelessConversation() { + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationalServiceStateless"); + + conversationalService.initializeCount(1); + Assert.assertEquals(1, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(2, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + conversationalService.initializeCount(4); + Assert.assertEquals(4, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(5, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + } +} diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java new file mode 100644 index 0000000000..245f0a5597 --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java @@ -0,0 +1,322 @@ +/*
+ * 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 org.apache.tuscany.sca.itest.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationalTestCase {
+
+ private SCADomain domain;
+ private ConversationalClient conversationalStatelessClientStatelessService;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+ private ConversationalClient conversationalStatefulClientStatelessService;
+ private ConversationalClient conversationalStatefulClientStatefulService;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.java new file mode 100644 index 0000000000..fdbb1f9dca --- /dev/null +++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.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 org.apache.tuscany.sca.test; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +//FIXME Fix this test case +public class ConversationsTestCaseFIXME extends TestCase { + + private SCADomain domain; + private ConversationsClient aConversationsClient; + + public void testConversations() { + aConversationsClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("ConversationsTest.composite"); + + aConversationsClient = + domain.getService(ConversationsClient.class, + "ConversationsClient/ConversationsClient"); + + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sandbox/old/contrib/itest/interop-xsq-client/pom.xml b/sandbox/old/contrib/itest/interop-xsq-client/pom.xml new file mode 100644 index 0000000000..c31cce8fc3 --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/pom.xml @@ -0,0 +1,60 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.testing</groupId> + <artifactId>tuscany-interop-clients</artifactId> + <version>0.1-integration-incubating-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>interop-client-webserviceXSQ</artifactId> + <packaging>jar</packaging> + <name>Tuscany Interop Testing - Clients - webserviceXSQ</name> + <properties> + <ws.type>axis2</ws.type> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkMode>always</forkMode> + <argLine>-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y</argLine> + </configuration> + </plugin> + </plugins> + </build> + + + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca.services.idl</groupId> + <artifactId>tuscany-wsdl</artifactId> + <version>${sca.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + + +</project> diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt b/sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java b/sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java new file mode 100644 index 0000000000..f2a7b198a1 --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java @@ -0,0 +1,77 @@ +/* + * 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 interop; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to create an SCA runtime, start it, locate a + * simple HelloWorld service component and invoke it. + */ +public class ClientTestCase extends SCATestCase { + private Object serviceProxy; + + // old tc + // public void testGetQuote() throws ConfigurationException, + // SecurityException, NoSuchMethodException, IllegalArgumentException, + // IllegalAccessException, InvocationTargetException { + // + // TuscanyRuntime tuscany = new TuscanyRuntime("getQuote", null); + // tuscany.start(); + // ModuleContext moduleContext = CurrentModuleContext.getContext(); + // + // Object serviceProxy = moduleContext.locateService("webserviceXSQ"); + // Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] { + // String.class }); + // + // String sqResponse = (String) m.invoke(serviceProxy, "IBM"); + // + // assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>")); + // + // tuscany.stop(); + // } + + public void testGetQuote() throws IllegalArgumentException, IllegalAccessException, + InvocationTargetException, SecurityException, NoSuchMethodException { + Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] {String.class}); + + String sqResponse = (String)m.invoke(serviceProxy, "IBM"); + + assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>")); + + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(getClass(), "META-INF/sca/test.scdl"); + + addExtension("test.exts", getClass().getClassLoader() + .getResource("META-INF/tuscany/test-extensions.scdl")); + + super.setUp(); + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + serviceProxy = compositeContext.locateService(Object.class, "webserviceXSQ"); + } + +} diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl new file mode 100644 index 0000000000..22b3b90623 --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl @@ -0,0 +1,31 @@ +<?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" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + name="composite.webserviceXSQ"> + <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" location="wsdl/sq.wsdl"/> + + <reference name="webserviceXSQ"> + <interface.wsdl interface="http://www.webserviceX.NET/#wsdl.interface(StockQuoteSoap)" wsdli:wsdlLocation="http://www.webserviceX.NET/ wsdl/sq.wsdl" /> + <binding.ws endpoint="http://www.webserviceX.NET/#wsdl.endpoint(StockQuote/StockQuoteSoap)" + location="wsdl/sq.wsdl" /> + </reference> + +</composite> diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl new file mode 100644 index 0000000000..fb208f56ab --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl @@ -0,0 +1,39 @@ +<?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. +--> +<!-- Axis2 based WebService binding extension --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" + name="org.apache.tuscany.binding.axis2.WebServiceBinding"> + + <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"> + <group>axis2</group> + <name>axis2-kernel</name> + <version>SNAPSHOT</version> + </dependency> + + <component name="webservice.bindingLoader"> + <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/> + </component> + + <component name="webservice.axis2.bindingBuilder"> + <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/> + </component> + +</composite> diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl new file mode 100644 index 0000000000..e4fe956e61 --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl @@ -0,0 +1,52 @@ +<?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" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl new file mode 100644 index 0000000000..61753384b4 --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl @@ -0,0 +1,60 @@ +<?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. +--> +<!-- + import.sdo configuration + + $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $ +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" + name="org.apache.tuscany.databinding.sdo"> + + <!-- import.sdo element loader implementations --> + <component name="elementLoader.import.sdo"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/> + </component> + + <component name="databinding.sdo"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" /> + </component> + + <component name="transformer.DataObject2String"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/> + </component> + <component name="transformer.DataObject2XMLStreamReader"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/> + </component> + <component name="transformer.XMLDocument2String"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/> + </component> + <component name="transformer.String2DataObject"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/> + </component> + <component name="transformer.XMLDocument2XMLStreamReader"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/> + </component> + <component name="transformer.XMLStreamReader2DataObject"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/> + </component> + <component name="transformer.XMLStreamReader2XMLDocument"> + <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/> + </component> + +</composite> diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl new file mode 100644 index 0000000000..84538dab8b --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl @@ -0,0 +1,55 @@ +<?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. +--> +<!-- + Default system configuration for the launcher environment. + + $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $ +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" + name="org.apache.tuscany.idl.WSDL"> + + <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"> + <group>wsdl4j</group> + <name>wsdl4j</name> + <version>1.5.2</version> + </dependency> + <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"> + <group>org.apache.ws.commons</group> + <name>XmlSchema</name> + <version>SNAPSHOT</version> + </dependency> + + <component name="interface.wsdl.Loader"> + <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" /> + </component> + + <component name="wsdl.Registry"> + <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" /> + </component> + + <component name="xmlSchema.registry"> + <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" /> + </component> + + <component name="interface.wsdl.Introspector"> + <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" /> + </component> + +</composite>
\ No newline at end of file diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl new file mode 100644 index 0000000000..355b663a1b --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl @@ -0,0 +1,29 @@ +<?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" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlLocation="binding.axis2.scdl"/>
+
+
+</composite>
\ No newline at end of file diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl new file mode 100644 index 0000000000..0408a60297 --- /dev/null +++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl @@ -0,0 +1,142 @@ +<?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. +--> +<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:tns="http://www.webserviceX.NET/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" + xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.webserviceX.NET/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> + <wsdl:types> + <s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET/"> + <s:element name="GetQuote"> + <s:complexType> + <s:sequence> + <s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string" /> + </s:sequence> + </s:complexType> + + </s:element> + <s:element name="GetQuoteResponse"> + <s:complexType> + <s:sequence> + <s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult" type="s:string" /> + </s:sequence> + </s:complexType> + </s:element> + <s:element name="string" nillable="true" type="s:string" /> + + </s:schema> + </wsdl:types> + <wsdl:message name="GetQuoteSoapIn"> + <wsdl:part name="parameters" element="tns:GetQuote" /> + </wsdl:message> + <wsdl:message name="GetQuoteSoapOut"> + <wsdl:part name="parameters" element="tns:GetQuoteResponse" /> + </wsdl:message> + <wsdl:message name="GetQuoteHttpGetIn"> + + <wsdl:part name="symbol" type="s:string" /> + </wsdl:message> + <wsdl:message name="GetQuoteHttpGetOut"> + <wsdl:part name="Body" element="tns:string" /> + </wsdl:message> + <wsdl:message name="GetQuoteHttpPostIn"> + <wsdl:part name="symbol" type="s:string" /> + </wsdl:message> + <wsdl:message name="GetQuoteHttpPostOut"> + + <wsdl:part name="Body" element="tns:string" /> + </wsdl:message> + <wsdl:portType name="StockQuoteSoap"> + <wsdl:operation name="GetQuote"> + <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation> + <wsdl:input message="tns:GetQuoteSoapIn" /> + <wsdl:output message="tns:GetQuoteSoapOut" /> + </wsdl:operation> + + </wsdl:portType> + <wsdl:portType name="StockQuoteHttpGet"> + <wsdl:operation name="GetQuote"> + <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation> + <wsdl:input message="tns:GetQuoteHttpGetIn" /> + <wsdl:output message="tns:GetQuoteHttpGetOut" /> + </wsdl:operation> + </wsdl:portType> + + <wsdl:portType name="StockQuoteHttpPost"> + <wsdl:operation name="GetQuote"> + <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation> + <wsdl:input message="tns:GetQuoteHttpPostIn" /> + <wsdl:output message="tns:GetQuoteHttpPostOut" /> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="StockQuoteSoap" type="tns:StockQuoteSoap"> + + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> + <wsdl:operation name="GetQuote"> + <soap:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="StockQuoteHttpGet" type="tns:StockQuoteHttpGet"> + <http:binding verb="GET" /> + <wsdl:operation name="GetQuote"> + <http:operation location="/GetQuote" /> + <wsdl:input> + <http:urlEncoded /> + </wsdl:input> + + <wsdl:output> + <mime:mimeXml part="Body" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="StockQuoteHttpPost" type="tns:StockQuoteHttpPost"> + <http:binding verb="POST" /> + <wsdl:operation name="GetQuote"> + <http:operation location="/GetQuote" /> + + <wsdl:input> + <mime:content type="application/x-www-form-urlencoded" /> + </wsdl:input> + <wsdl:output> + <mime:mimeXml part="Body" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="StockQuote"> + + <wsdl:port name="StockQuoteSoap" binding="tns:StockQuoteSoap"> + <soap:address location="http://www.webservicex.net/stockquote.asmx" /> + </wsdl:port> + <wsdl:port name="StockQuoteHttpGet" binding="tns:StockQuoteHttpGet"> + <http:address location="http://www.webservicex.net/stockquote.asmx" /> + </wsdl:port> + <wsdl:port name="StockQuoteHttpPost" binding="tns:StockQuoteHttpPost"> + <http:address location="http://www.webservicex.net/stockquote.asmx" /> + </wsdl:port> + + </wsdl:service> +</wsdl:definitions> diff --git a/sandbox/old/contrib/itest/pom.xml.off b/sandbox/old/contrib/itest/pom.xml.off new file mode 100644 index 0000000000..fd23410e10 --- /dev/null +++ b/sandbox/old/contrib/itest/pom.xml.off @@ -0,0 +1,84 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany</groupId> + <artifactId>sca</artifactId> + <version>1.0-incubating</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>integration-test</artifactId> + <version>2.0-alpha-incubating-SNAPSHOT</version> + <packaging>pom</packaging> + <name>Apache Tuscany Integration Tests</name> + <description>Integration tests for SCA.</description> + + <modules> + <module>specTest</module> + <module>propertyTest</module> + </modules> + + <properties> + <!-- version the SCA API that we implement --> + <scaSpecVersion>1.0</scaSpecVersion> + + <!-- version the Apache Tuscany kernel that the runtimes work with --> + <kernelVersion>2.0-alpha-incubating</kernelVersion> + </properties> + + <dependencies> + <!-- org.osoa.sca API --> + <dependency> + <groupId>org.osoa</groupId> + <artifactId>sca-api-r${scaSpecVersion}</artifactId> + <version>1.0-incubating</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <defaultGoal>verify</defaultGoal> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-itest-plugin</artifactId> + <version>${kernelVersion}</version> + <executions> + <execution> + <goals> + <goal>test</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> diff --git a/sandbox/old/contrib/itest/propertyTest/pom.xml.off b/sandbox/old/contrib/itest/propertyTest/pom.xml.off new file mode 100644 index 0000000000..a8af8b28ea --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/pom.xml.off @@ -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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>integration-test</artifactId>
+ <version>2.0-alpha-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.integration-test</groupId>
+ <artifactId>propertyTest</artifactId>
+ <packaging>jar</packaging>
+ <name>Integration Test Suite for SCA Properties</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java new file mode 100644 index 0000000000..7d7360f678 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +public interface ABComponent { + + String getA(); + String getB(); + String getZ(); + int getIntValue(); + String getF(); +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java new file mode 100644 index 0000000000..dc45dbf035 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java @@ -0,0 +1,82 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +import org.osoa.sca.annotations.Property; + +public class ABComponentImpl implements ABComponent { + + private String aProperty; + private String bProperty; + private int intValue; + // private Collection manyProp; + private String zProperty; + private String fProperty; + + @Property(name="xpath") + public void setZProperty(final String value) { + this.zProperty = value; + } + +// @Property(name="foobar") +// public void setCollectionProperty(final Collection value) { +// this.manyProp = value; +// } + + @Property + public void setA(final String A) { + this.aProperty = A; + } + + @Property + public void setB(final String B) { + this.bProperty = B; + } + + @Property + public void setF(final String F) { + this.fProperty = F; + } + + @Property + public void setOne(final int value) { + this.intValue = value; + } + + public String getA() { + return this.aProperty; + } + + public String getB() { + return this.bProperty; + } + + public int getIntValue() { + return this.intValue; + } + + public String getZ() { + return this.zProperty; + } + + public String getF() { + return this.fProperty; + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java new file mode 100644 index 0000000000..b2b776346e --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +public interface CDComponent { + + String getC(); + String getC2(); + String getD(); + String getNoSource(); + String getFileProperty(); + int getOverrideValue(); +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java new file mode 100644 index 0000000000..f1bf91ef8e --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java @@ -0,0 +1,85 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +import org.osoa.sca.annotations.Property; + +public class CDComponentImpl implements CDComponent { + + private String cProperty; + private String dProperty; + private String nosource; + private String fileProperty; + private int overrideNumber; + private String cProperty2; + + @Property(name="nonFileProperty") + public void setC2(final String value) { + this.cProperty2 = value; + } + @Property(name="two") + public void setOverrideNumber(final int value) { + this.overrideNumber = value; + } + + @Property(name="fileProperty") + public void setFileProp(final String value) { + this.fileProperty = value; + } + @Property + public void setC(final String C) { + this.cProperty = C; + } + + @Property + public void setD(final String D) { + this.dProperty = D; + } + + @Property + public void setNosource(final String value) { + this.nosource = value; + } + + public String getFileProperty() { + return this.fileProperty; + } + + public String getC() { + return this.cProperty; + } + + public String getC2() { + return this.cProperty2; + } + + public String getD() { + return this.dProperty; + } + + public String getNoSource() { + return this.nosource; + } + + public int getOverrideValue() { + return this.overrideNumber; + } +} + diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java new file mode 100644 index 0000000000..c346b69c30 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java @@ -0,0 +1,69 @@ +package org.apache.tuscany.sca.test.property;
+
+public class ComplexPropertyBean {
+
+ protected int integerNumber = 25;
+ public float floatNumber = 50;
+ public double doubleNumber = 75;
+ public int[] intArray = null;
+ public double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ public ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ public String toString() {
+ return Double.toString(integerNumber) + " - " +
+ Double.toString(floatNumber) + " - " +
+ Double.toString(doubleNumber) + " \n" +
+ ((intArray == null ) ? "no int array" : intArray[0] + " - " + intArray[1] + " \n " ) +
+ ((doubleArray == null ) ? "no double array" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) +
+ ((stringArray == null ) ? "no string array" : stringArray[0] + " - " + stringArray[1] + " \n " ) +
+ ((numberSetArray == null ) ? "no numberset array" : numberSetArray[0] + " - " + numberSetArray[1] + " \n " ) +
+ ((numberSet == null ) ? "" : numberSet.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java new file mode 100644 index 0000000000..7516c61836 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java @@ -0,0 +1,25 @@ + +/* + * 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 org.apache.tuscany.sca.test.property; + +public interface OverrideService { + +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java new file mode 100644 index 0000000000..f44263c3f4 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java @@ -0,0 +1,24 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +public class OverrideServiceImpl implements OverrideService { + +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java new file mode 100644 index 0000000000..3a77c1fe2f --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java @@ -0,0 +1,28 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + + +public interface PropertyComponent { + public String getLocation(); + public String getYear(); + public ComplexPropertyBean getComplexPropertyOne(); + public ComplexPropertyBean getComplexPropertyTwo(); +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.java new file mode 100644 index 0000000000..e2b331f693 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.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 org.apache.tuscany.sca.test.property; + +import org.osoa.sca.annotations.Property; + +public class PropertyComponentImpl implements PropertyComponent { + @Property + protected ComplexPropertyBean complexPropertyOne; + + @Property + protected ComplexPropertyBean complexPropertyTwo; + + @Property(name = "location") + protected String location = "RTP"; + + @Property(name = "year") + protected String year = "2006"; + + public String getLocation(){ + return location; + } + + public String getYear(){ + return year; + } + + public ComplexPropertyBean getComplexPropertyOne() { + return complexPropertyOne; + } + + public ComplexPropertyBean getComplexPropertyTwo() { + return complexPropertyTwo; + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java new file mode 100644 index 0000000000..6110283c80 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java @@ -0,0 +1,24 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +public interface PropertyService { + +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java new file mode 100644 index 0000000000..e21b31f90d --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java @@ -0,0 +1,90 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +import org.osoa.sca.annotations.Property; + +/** + * Implementation where all primitive properties are passed in the constructor. + * + * @version $Rev$ $Date$ + */ +public class ConstructorPrimitives implements PrimitiveService { + private boolean booleanValue; + + private byte byteValue; + + private short shortValue; + + private int intValue; + + private long longValue; + + private float floatValue; + + private double doubleValue; + + public ConstructorPrimitives(@Property(name = "booleanValue") boolean booleanValue, + @Property(name = "byteValue") byte byteValue, + @Property(name = "shortValue") short shortValue, + @Property(name = "intValue") int intValue, + @Property(name = "longValue") long longValue, + @Property(name = "floatValue") float floatValue, + @Property(name = "doubleValue") double doubleValue) { + this.booleanValue = booleanValue; + this.byteValue = byteValue; + this.shortValue = shortValue; + this.intValue = intValue; + this.longValue = longValue; + this.floatValue = floatValue; + this.doubleValue = doubleValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public byte getByteValue() { + return byteValue; + } + + public short getShortValue() { + return shortValue; + } + + public int getIntValue() { + return intValue; + } + + public long getLongValue() { + return longValue; + } + + public float getFloatValue() { + return floatValue; + } + + public double getDoubleValue() { + return doubleValue; + } + + public String getImplementationName() { + return getClass().getSimpleName(); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java new file mode 100644 index 0000000000..1d599c70a3 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java @@ -0,0 +1,57 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +/** + * Service interface for primitive property tests. + * This defines the methods and the values typically returned from a test. + * + * @version $Rev$ $Date$ + */ +public interface PrimitiveService { + String getImplementationName(); + + boolean BOOLEAN_VALUE = true; + + boolean isBooleanValue(); + + byte BYTE_VALUE = 123; + + byte getByteValue(); + + short SHORT_VALUE = 12345; + + short getShortValue(); + + int INT_VALUE = 12345678; + + int getIntValue(); + + long LONG_VALUE = 9876543210L; + + long getLongValue(); + + float FLOAT_VALUE = 1.234e12f; + + float getFloatValue(); + + double DOUBLE_VALUE = 1.23456789e87; + + double getDoubleValue(); +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java new file mode 100644 index 0000000000..c2cd13b831 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java @@ -0,0 +1,72 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +/** + * Implementation where all primitive properties are private fields. + * + * @version $Rev$ $Date$ + */ +public class ProtectedFieldPrimitives implements PrimitiveService { + protected boolean booleanValue; + + protected byte byteValue; + + protected short shortValue; + + protected int intValue; + + protected long longValue; + + protected float floatValue; + + protected double doubleValue; + + public boolean isBooleanValue() { + return booleanValue; + } + + public byte getByteValue() { + return byteValue; + } + + public short getShortValue() { + return shortValue; + } + + public int getIntValue() { + return intValue; + } + + public long getLongValue() { + return longValue; + } + + public float getFloatValue() { + return floatValue; + } + + public double getDoubleValue() { + return doubleValue; + } + + public String getImplementationName() { + return getClass().getSimpleName(); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java new file mode 100644 index 0000000000..7cbb0c1371 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java @@ -0,0 +1,100 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +/** + * Implementation where all primitive properties are passed in using protected setter methods. + * + * @version $Rev$ $Date$ + */ +public class ProtectedSetterPrimitives implements PrimitiveService { + protected boolean booleanValue; + + protected byte byteValue; + + protected short shortValue; + + protected int intValue; + + protected long longValue; + + protected float floatValue; + + protected double doubleValue; + + public void setBooleanValue(boolean booleanValue) { + this.booleanValue = booleanValue; + } + + public void setByteValue(byte byteValue) { + this.byteValue = byteValue; + } + + public void setShortValue(short shortValue) { + this.shortValue = shortValue; + } + + public void setIntValue(int intValue) { + this.intValue = intValue; + } + + public void setLongValue(long longValue) { + this.longValue = longValue; + } + + public void setFloatValue(float floatValue) { + this.floatValue = floatValue; + } + + public void setDoubleValue(double doubleValue) { + this.doubleValue = doubleValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public byte getByteValue() { + return byteValue; + } + + public short getShortValue() { + return shortValue; + } + + public int getIntValue() { + return intValue; + } + + public long getLongValue() { + return longValue; + } + + public float getFloatValue() { + return floatValue; + } + + public double getDoubleValue() { + return doubleValue; + } + + public String getImplementationName() { + return getClass().getSimpleName(); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java new file mode 100644 index 0000000000..a38875b82a --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java @@ -0,0 +1,72 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +/** + * Implementation where all primitive properties are private fields. + * + * @version $Rev$ $Date$ + */ +public class PublicFieldPrimitives implements PrimitiveService { + public boolean booleanValue; + + public byte byteValue; + + public short shortValue; + + public int intValue; + + public long longValue; + + public float floatValue; + + public double doubleValue; + + public boolean isBooleanValue() { + return booleanValue; + } + + public byte getByteValue() { + return byteValue; + } + + public short getShortValue() { + return shortValue; + } + + public int getIntValue() { + return intValue; + } + + public long getLongValue() { + return longValue; + } + + public float getFloatValue() { + return floatValue; + } + + public double getDoubleValue() { + return doubleValue; + } + + public String getImplementationName() { + return getClass().getSimpleName(); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java new file mode 100644 index 0000000000..e7b527ba63 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java @@ -0,0 +1,100 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +/** + * Implementation where all primitive properties are passed in using public setter methods. + * + * @version $Rev$ $Date$ + */ +public class PublicSetterPrimitives implements PrimitiveService { + private boolean booleanValue; + + private byte byteValue; + + private short shortValue; + + private int intValue; + + private long longValue; + + private float floatValue; + + private double doubleValue; + + public void setBooleanValue(boolean booleanValue) { + this.booleanValue = booleanValue; + } + + public void setByteValue(byte byteValue) { + this.byteValue = byteValue; + } + + public void setShortValue(short shortValue) { + this.shortValue = shortValue; + } + + public void setIntValue(int intValue) { + this.intValue = intValue; + } + + public void setLongValue(long longValue) { + this.longValue = longValue; + } + + public void setFloatValue(float floatValue) { + this.floatValue = floatValue; + } + + public void setDoubleValue(double doubleValue) { + this.doubleValue = doubleValue; + } + + public boolean isBooleanValue() { + return booleanValue; + } + + public byte getByteValue() { + return byteValue; + } + + public short getShortValue() { + return shortValue; + } + + public int getIntValue() { + return intValue; + } + + public long getLongValue() { + return longValue; + } + + public float getFloatValue() { + return floatValue; + } + + public double getDoubleValue() { + return doubleValue; + } + + public String getImplementationName() { + return getClass().getSimpleName(); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..9eb0b0f126 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,117 @@ +<?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" + xmlns:foo="http://foo" + name="PropertyTestComposite"> + + <include name="PrimitivesTestComposite" scdlLocation="primitives.scdl"/> + + <!-- + <property name="number" type="xsd:int">1</property> + + <property name="complex" type="foo:MyComplexType"> + <foo:a>a</foo:a> + <foo:b>b</foo:b> + <foo:c>c</foo:c> + <foo:d>d</foo:d> + <foo:x> + <y>y</y> + <z>z</z> + </foo:x> + </property> + + <property name="moreComplex" type="foo:MyMoreComplexType"> + <foo:stringArray>TestString_1</foo:stringArray> + <foo:stringArray>TestString_2</foo:stringArray> + <foo:intArray>10</foo:intArray> + <foo:integerNumber>27</foo:integerNumber> + <foo:floatNumber>79.34</foo:floatNumber> + <foo:doubleArray>25.52</foo:doubleArray> + <foo:doubleNumber>184.52</foo:doubleNumber> + <foo:doubleArray>50.05</foo:doubleArray> + <foo:intArray>20</foo:intArray> + <foo:numberSetArray> + <foo:integerNumber>1</foo:integerNumber> + <foo:floatNumber>11</foo:floatNumber> + <foo:doubleNumber>111</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSetArray> + <foo:integerNumber>2</foo:integerNumber> + <foo:floatNumber>22</foo:floatNumber> + <foo:doubleNumber>222</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSet> + <foo:integerNumber>54</foo:integerNumber> + <foo:floatNumber>158.68</foo:floatNumber> + <foo:doubleNumber>369.04</foo:doubleNumber> + </foo:numberSet> + </property> + + <component name="ABComponent"> + <implementation.java class="org.apache.tuscany.sca.test.property.ABComponentImpl"/> + <property name="a" source="$complex/foo:a"/> + <property name="b" source="$complex/foo:b"/> + <property name="f" source="$complex/foo:a">f</property> + <property name="xpath" source="$complex/foo:x/*[local-name()='z']"/> + <property name="one" source="$number"/> + </component> + + <component name="CDComponent"> + <implementation.java class="org.apache.tuscany.sca.test.property.CDComponentImpl"/> + <property name="c" source="$complex/foo:c"/> + <property name="d" source="$complex/foo:d"/> + <property name="nosource">aValue</property> + <property name="fileProperty" file="META-INF/sca/fileProperty.txt"/> + <property name="nonFileProperty" file="META-INF/sca/fileProperty.txt" source="$complex/foo:c"/> + <property name="two" source="$number">2</property> + </component> + + <component name="PropertyComponent"> + <implementation.java class="org.apache.tuscany.sca.test.property.PropertyComponentImpl"/> + <property name="complexPropertyOne" source="$moreComplex"></property> + <property name="complexPropertyTwo"> + <foo:stringArray>TestString_1</foo:stringArray> + <foo:stringArray>TestString_2</foo:stringArray> + <foo:intArray>10</foo:intArray> + <foo:integerNumber>27</foo:integerNumber> + <foo:floatNumber>79.34</foo:floatNumber> + <foo:doubleArray>25.52</foo:doubleArray> + <foo:doubleNumber>184.52</foo:doubleNumber> + <foo:doubleArray>50.05</foo:doubleArray> + <foo:intArray>20</foo:intArray> + <foo:numberSetArray> + <foo:integerNumber>1</foo:integerNumber> + <foo:floatNumber>11</foo:floatNumber> + <foo:doubleNumber>111</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSetArray> + <foo:integerNumber>2</foo:integerNumber> + <foo:floatNumber>22</foo:floatNumber> + <foo:doubleNumber>222</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSet> + <foo:integerNumber>54</foo:integerNumber> + <foo:floatNumber>158.68</foo:floatNumber> + <foo:doubleNumber>369.04</foo:doubleNumber> + </foo:numberSet> + </property> + </component> +--> +</composite> diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt new file mode 100644 index 0000000000..c530ae892d --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt @@ -0,0 +1 @@ +<filePropertyTest>fileValue</filePropertyTest> diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl new file mode 100644 index 0000000000..9a47ffc74b --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl @@ -0,0 +1,78 @@ +<?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" + xmlns:foo="http://foo" + name="PrimitivesTestComposite"> + + <component name='ConstructorPrimitives'> + <implementation.java class='org.apache.tuscany.sca.test.property.primitives.ConstructorPrimitives'/> + <property name='booleanValue'>true</property> + <property name='byteValue'>123</property> + <property name='shortValue'>12345</property> + <property name='intValue'>12345678</property> + <property name='longValue'>9876543210</property> + <property name='floatValue'>1.234e12</property> + <property name='doubleValue'>1.23456789e87</property> + </component> + + <component name='PublicFieldPrimitives'> + <implementation.java class='org.apache.tuscany.sca.test.property.primitives.PublicFieldPrimitives'/> + <property name='booleanValue'>true</property> + <property name='byteValue'>123</property> + <property name='shortValue'>12345</property> + <property name='intValue'>12345678</property> + <property name='longValue'>9876543210</property> + <property name='floatValue'>1.234e12</property> + <property name='doubleValue'>1.23456789e87</property> + </component> + + <component name='ProtectedFieldPrimitives'> + <implementation.java class='org.apache.tuscany.sca.test.property.primitives.ProtectedFieldPrimitives'/> + <property name='booleanValue'>true</property> + <property name='byteValue'>123</property> + <property name='shortValue'>12345</property> + <property name='intValue'>12345678</property> + <property name='longValue'>9876543210</property> + <property name='floatValue'>1.234e12</property> + <property name='doubleValue'>1.23456789e87</property> + </component> + + <component name='PublicSetterPrimitives'> + <implementation.java class='org.apache.tuscany.sca.test.property.primitives.PublicSetterPrimitives'/> + <property name='booleanValue'>true</property> + <property name='byteValue'>123</property> + <property name='shortValue'>12345</property> + <property name='intValue'>12345678</property> + <property name='longValue'>9876543210</property> + <property name='floatValue'>1.234e12</property> + <property name='doubleValue'>1.23456789e87</property> + </component> + + <component name='ProtectedSetterPrimitives'> + <implementation.java class='org.apache.tuscany.sca.test.property.primitives.ProtectedSetterPrimitives'/> + <property name='booleanValue'>true</property> + <property name='byteValue'>123</property> + <property name='shortValue'>12345</property> + <property name='intValue'>12345678</property> + <property name='longValue'>9876543210</property> + <property name='floatValue'>1.234e12</property> + <property name='doubleValue'>1.23456789e87</property> + </component> +</composite> diff --git a/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java new file mode 100644 index 0000000000..954fd456d7 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java @@ -0,0 +1,100 @@ +/* + * 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 org.apache.tuscany.sca.test.property; + +import junit.framework.TestCase; +import org.osoa.sca.annotations.Reference; + +public class PropertyTestComponent extends TestCase { + @Reference + public ABComponent abService; + @Reference + public CDComponent cdService; + @Reference + public PropertyComponent propertyService; + + + public void testA() { + assertEquals("a", abService.getA()); + } + + public void testB() { + assertEquals("b", abService.getB()); + } + + public void testC() { + assertEquals("c", cdService.getC()); + } + + public void testC2() { + assertEquals("c", cdService.getC2()); + } + + public void testD() { + assertEquals("d", cdService.getD()); + } + + public void testF() { + assertEquals("a", abService.getF()); + } + + public void testZ() { + assertEquals("z", abService.getZ()); + } + + + public void testIntValue() { + assertEquals(1, abService.getIntValue()); + } + + public void testDefaultValue() { + assertEquals(1, abService.getIntValue()); + } + + public void testDefaultValueOverride() { + assertEquals(1, cdService.getOverrideValue()); + } + + public void testNoSource() { + assertEquals("aValue", cdService.getNoSource()); + } + + public void testFileProperty() { + assertEquals("fileValue", cdService.getFileProperty()); + } + + public void testDefaultProperty() { + assertEquals("RTP", propertyService.getLocation()); + assertEquals("2006", propertyService.getYear()); + + } + + public void testComplexProperty() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyOne(); + assertNotNull(propBean); + assertEquals("TestString_1", propBean.getStringArray()[0]); + assertEquals(2, propBean.numberSetArray[1].integerNumber); + + propBean = propertyService.getComplexPropertyTwo(); + assertNotNull(propBean); + assertEquals(10, propBean.intArray[0]); + assertEquals((float) 22, propBean.numberSetArray[1].floatNumber); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java new file mode 100644 index 0000000000..f26e1d341a --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java @@ -0,0 +1,68 @@ +/* + * 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 org.apache.tuscany.sca.test.property.primitives; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Property; +import junit.framework.TestCase; + +/** + * Test component for checking primitive property values. + * + * @version $Rev$ $Date$ + */ +public class PrimitiveTestComponent extends TestCase { + @Reference + public PrimitiveService primitives; + + @Property + public String expectedImplementation; + + public void testExpectedImplementation() { + assertEquals(expectedImplementation, primitives.getImplementationName()); + } + + public void testBoolean() { + assertEquals(PrimitiveService.BOOLEAN_VALUE, primitives.isBooleanValue()); + } + + public void testByte() { + assertEquals(PrimitiveService.BYTE_VALUE, primitives.getByteValue()); + } + + public void testShort() { + assertEquals(PrimitiveService.SHORT_VALUE, primitives.getShortValue()); + } + + public void testInt() { + assertEquals(PrimitiveService.INT_VALUE, primitives.getIntValue()); + } + + public void testLong() { + assertEquals(PrimitiveService.LONG_VALUE, primitives.getLongValue()); + } + + public void testFloat() { + assertEquals(PrimitiveService.FLOAT_VALUE, primitives.getFloatValue()); + } + + public void testDouble() { + assertEquals(PrimitiveService.DOUBLE_VALUE, primitives.getDoubleValue()); + } +} diff --git a/sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl b/sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl new file mode 100644 index 0000000000..cfc9c11351 --- /dev/null +++ b/sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl @@ -0,0 +1,65 @@ +<?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" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha" + name="PropertyTestHarnessComposite"> + + <include name="PropertyTestComposite" scdlResource="META-INF/sca/default.scdl"/> + + <component name="testConstructorPrimitives"> + <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/> + <reference name="primitives" target="ConstructorPrimitives"/> + <property name='expectedImplementation'>ConstructorPrimitives</property> + </component> + + <component name="testPublicFieldPrimitives"> + <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/> + <reference name="primitives" target="PublicFieldPrimitives"/> + <property name='expectedImplementation'>PublicFieldPrimitives</property> + </component> + + <component name="testProtectedFieldPrimitives"> + <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/> + <reference name="primitives" target="ProtectedFieldPrimitives"/> + <property name='expectedImplementation'>ProtectedFieldPrimitives</property> + </component> + + <component name="testPublicSetterPrimitives"> + <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/> + <reference name="primitives" target="PublicSetterPrimitives"/> + <property name='expectedImplementation'>PublicSetterPrimitives</property> + </component> + + <component name="testProtectedSetterPrimitives"> + <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/> + <reference name="primitives" target="ProtectedSetterPrimitives"/> + <property name='expectedImplementation'>ProtectedSetterPrimitives</property> + </component> + + <!-- + <component name="testComponent"> + <tuscany:junit class="org.apache.tuscany.sca.test.property.PropertyTestComponent"/> + <reference name="abService" target="ABComponent"/> + <reference name="cdService" target="CDComponent"/> + <reference name="abcdService" target="ABCDComponent"/> + <reference name="propertyService" target="PropertyComponent"/> + </component> +--> +</composite> diff --git a/sandbox/old/contrib/itest/spec-api/pom.xml b/sandbox/old/contrib/itest/spec-api/pom.xml new file mode 100644 index 0000000000..fa0f618820 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/pom.xml @@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-spec-api</artifactId>
+ <name>Apache Tuscany SCA Spec API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+ + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies>
+</project>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java new file mode 100644 index 0000000000..ba9dd59c46 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java @@ -0,0 +1,26 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+public interface BasicService {
+
+ int negate(int theInt);
+ int delegateNegate(int theInt);
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java new file mode 100644 index 0000000000..0f46725adf --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java @@ -0,0 +1,25 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+public interface MathService {
+
+ int negate(int theInt);
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java new file mode 100644 index 0000000000..7fe9fa4909 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java @@ -0,0 +1,28 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java new file mode 100644 index 0000000000..a381fc62dc --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java @@ -0,0 +1,27 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ //FIXME renaming method due to TUSCANY-1173. Original name getHolidays
+ String[] getHolidaysByYear(int year);
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java new file mode 100644 index 0000000000..fbb2161df3 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java @@ -0,0 +1,29 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService {
+ Date nextHoliday();
+
+ String getLocation();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java new file mode 100644 index 0000000000..98490c4e3d --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java @@ -0,0 +1,29 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ //FIXME renaming method due to TUSCANY-1173. Original name nextHoliday
+ Date nextHolidayByDate(Date date);
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java new file mode 100644 index 0000000000..6a4cfc1f79 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java @@ -0,0 +1,23 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate {
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java new file mode 100644 index 0000000000..c2d107ef28 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java @@ -0,0 +1,25 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+
+public interface SCAComponentService {
+ String getComponentName();
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java new file mode 100644 index 0000000000..083307234a --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java @@ -0,0 +1,49 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import org.apache.tuscany.sca.test.spec.BasicService;
+import org.apache.tuscany.sca.test.spec.MathService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(BasicService.class)
+public class BasicServiceImpl implements BasicService {
+
+ @Context
+ protected ComponentContext context;
+
+ //The reference anntation is used in lieu of a component type definition
+ //This makes the call to getService redundant since the reference is injected
+ //but it serves the purpose to demonstrate that getService is working.
+ @Reference
+ protected MathService mathServiceReference;
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+ public int delegateNegate(int theInt) {
+ mathServiceReference = context.getService(MathService.class, "mathServiceReference");
+ return mathServiceReference.negate(theInt);
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java new file mode 100644 index 0000000000..d3dc1585fc --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java @@ -0,0 +1,31 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import org.apache.tuscany.sca.test.spec.MathService;
+import org.osoa.sca.annotations.Service;
+
+@Service(MathService.class)
+public class MathServiceImpl implements MathService {
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java new file mode 100644 index 0000000000..5170c32cd2 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java @@ -0,0 +1,73 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyListService.class, MyListServiceByYear.class})
+public class MyListServiceImpl implements MyListService, MyListServiceByYear {
+
+ // This is multiplicity=1:n
+ @Reference(name = "myListServiceList", required = false)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name = "myListServiceArray", required = false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name = "serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays() {
+ return getHolidaysByYear(new Integer(year).intValue());
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ MyListService myService;
+ if (myListServicesList != null) {
+ for (int i = 0; i < myListServicesList.size(); i++) {
+ myService = myListServicesList.get(i);
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ if (myListServicesArray != null) {
+ for (int i = 0; i < myListServicesArray.length; i++) {
+ myService = myListServicesArray[i];
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java new file mode 100644 index 0000000000..b81c2c2120 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java @@ -0,0 +1,112 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class})
+public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear {
+ static String[][] holidays =
+ {
+ {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23",
+ "2006/11/24", "2006/12/25"},
+ {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}};
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ private String componentName;
+
+ public MyServiceImpl() {
+ //System.out.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHolidayByDate(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHolidayByDate(Date today) {
+ Date d1;
+ String[] days = getHolidays();
+ for (int j = 0; j < days.length; j++) {
+ d1 = new Date(days[j]);
+ if (d1.after(today))
+ return d1;
+ }
+ return null;
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ int index = year - 2006;
+ if (index >= 0 && index < holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays() {
+
+ Integer theYear;
+ if (year == null || year.length() == 0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidaysByYear(theYear.intValue());
+ }
+
+ @Init
+ public void start() {
+ //System.out.println("Start service..");
+ }
+
+ @Destroy
+ public void stop() {
+ //System.out.println("Stop service..");
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..11767522d6 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java @@ -0,0 +1,78 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(MyTotalService.class)
+public class MyTotalServiceImpl implements MyTotalService {
+
+ // This is multiplicity=1:1
+ @Reference(required = true)
+ public MyListService myListService;
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyListServiceByYear myListServiceByYear = new MyServiceImpl();
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ // This is multiplicity=0:1
+ @Reference(required = false)
+ public MyServiceByDate myServiceByDate = new MyServiceImpl();
+
+ public String[] getHolidays() {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ return myListServiceByYear.getHolidaysByYear(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public Date nextHolidayByDate(Date date) {
+ return myServiceByDate.nextHolidayByDate(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite new file mode 100644 index 0000000000..d650c8ab42 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite @@ -0,0 +1,30 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="BasicServiceComposite">
+
+ <component name="BasicServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.BasicServiceImpl"/>
+ <reference name="mathServiceReference" target="MathServiceComponent"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite new file mode 100644 index 0000000000..7a5f05b552 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite @@ -0,0 +1,33 @@ +<?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://foo"
+ xmlns:foo="http://foo"
+ name="CompositeTest">
+
+ <include name="foo:myTotalService"></include>
+ <include name="foo:myListService"></include>
+ <include name="foo:mySimpleServiceInRecursive">foo:mySimpleServiceInRecursive</include>
+ <include name="foo:myServiceInRecursive">foo:myServiceInRecursive</include>
+ <include name="foo:mySimpleServiceInRecursive2">foo:mySimpleServiceInRecursive2</include>
+ <include name="foo:myTotalServiceInRecursive">foo:myTotalServiceInRecursive</include>
+ <include name="foo:myTotalServiceInRecursiveForReferenceOverride">foo:myTotalServiceInRecursiveForReferenceOverride</include>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite new file mode 100644 index 0000000000..59f8fa6981 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite @@ -0,0 +1,29 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="MathServiceComposite">
+
+ <component name="MathServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MathServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite new file mode 100644 index 0000000000..1f0cd97fb4 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite @@ -0,0 +1,33 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myListService">
+
+ <component name="MyNewListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyListServiceImpl"/>
+ <reference name="myListServiceList" target="MyNCService/MyListService"/>
+ <reference name="myListServiceArray" target="MyListServiceFor2006/MyListService"/>
+ <property name="serviceYear">2007</property>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite new file mode 100644 index 0000000000..518cb295f9 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite @@ -0,0 +1,50 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myServiceInComposite">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MyListService" promote="MyServiceComponent/MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </service>
+
+
+ <service name="MyListServiceByYear" promote="MyServiceComponent/MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </service>
+
+
+ <service name="MyServiceByDate" promote="MyServiceComponent/MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite new file mode 100644 index 0000000000..f9f7615ec5 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite @@ -0,0 +1,50 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myServiceInRecursive">
+
+ <service name="MyServiceInRecursiveMyService" promote="MyServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListService" promote="MyServiceInRecursive/MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListServiceByYear" promote="MyServiceInRecursive/MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyServiceByDate" promote="MyServiceInRecursive/MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ </service>
+
+
+ <component name="MyServiceInRecursive">
+ <implementation.composite name="foo:myServiceInComposite"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite new file mode 100644 index 0000000000..b1ecaced45 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite @@ -0,0 +1,35 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="mySimpleService">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite new file mode 100644 index 0000000000..662d67612d --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="mySimpleServiceInRecursive">
+
+ <service name="MySimpleService" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MySimpleServiceNo" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMay" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMust" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite name="foo:mySimpleService"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite new file mode 100644 index 0000000000..e059c5b46f --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite @@ -0,0 +1,44 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="mySimpleServiceInRecursive2">
+
+ <service name="MySimpleService2Default" promote="MySimpleServiceInRecursiveComponent/MySimpleService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleService2No" promote="MySimpleServiceInRecursiveComponent/MySimpleServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleService2May" promote="MySimpleServiceInRecursiveComponent/MySimpleServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleService2Must" promote="MySimpleServiceInRecursiveComponent/MySimpleServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MySimpleServiceInRecursiveComponent">
+ <implementation.composite name="foo:mySimpleServiceInRecursive"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite new file mode 100644 index 0000000000..f9076f6811 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite @@ -0,0 +1,34 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalService">
+
+ <include name="foo:myservice">foo:myservice</include>
+
+ <component name="MyTotalService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyNCService/MyService"/>
+ <reference name="myListService" target="MyNCService/MyListService"/>
+ <reference name="myListServiceByYear" target="MyNCService/MyListServiceByYear"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite new file mode 100644 index 0000000000..af41baf277 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInComposite">
+
+ <service name="MyTotalService" promote="MyTotalServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ </component>
+
+ <reference name="MyServiceRef" promote="MyTotalServiceComponent/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRef" promote="MyTotalServiceComponent/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRef" promote="MyTotalServiceComponent/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite new file mode 100644 index 0000000000..e802b469d0 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite @@ -0,0 +1,88 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInCompositeForReferenceOverride">
+
+ <service name="MyTotalServiceNo" promote="MyTotalServiceComponentNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponentNo">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService"/>
+ <reference name="myListService"/>
+ <reference name="myListServiceByYear"/>
+ </component>
+
+ <reference name="MyServiceRefNo" promote="MyTotalServiceComponentNo/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefNo" promote="MyTotalServiceComponentNo/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRefNo" promote="MyTotalServiceComponentNo/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+ <service name="MyTotalServiceMay" promote="MyTotalServiceComponentMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponentMay">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ </component>
+
+ <reference name="MyServiceRefMay" promote="MyTotalServiceComponentMay/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMay" promote="MyTotalServiceComponentMay/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRefMay" promote="MyTotalServiceComponentMay/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+ <service name="MyTotalServiceMust" promote="MyTotalServiceComponentMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponentMust">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ </component>
+
+ <reference name="MyServiceRefMust" promote="MyTotalServiceComponentMust/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMust" promote="MyTotalServiceComponentMust/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRefMust" promote="MyTotalServiceComponentMust/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite new file mode 100644 index 0000000000..a69c4cedd4 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite @@ -0,0 +1,64 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInRecursive">
+
+ <component name="MyServiceInComposite">
+ <implementation.composite name="foo:myServiceInComposite"/>
+ </component>
+
+ <component name="MyTotalServiceFromRecursive">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceInComposite/MyService"/>
+ <reference name="myListService" target="MyServiceInComposite/MyListService"/>
+ <reference name="myListServiceByYear" target="MyServiceInComposite/MyListServiceByYear"/>
+ </component>
+
+ <service name="MyTotalServiceInCompositeWithRecursiveUseService" promote="MyTotalServiceInCompositeWithRecursive">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceInCompositeWithComponentServiceUseService" promote="MyTotalServiceInCompositeWithComponentService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceInCompositeWithRecursive">
+ <implementation.composite name="foo:myTotalServiceInComposite"/>
+ <reference name="MyServiceRef" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComposite/MyListService"/>
+ <reference name="MyListServiceByYearRef" target="MyServiceInComposite/MyListServiceByYear"/>
+ </component>
+
+ <component name="MyTotalServiceInCompositeWithComponentService">
+ <implementation.composite name="foo:myTotalServiceInComposite"/>
+ <reference name="MyServiceRef" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRef" target="MyServiceInComponent/MyListServiceByYear"/>
+ </component>
+
+ <component name="myTotalServiceInRecursive_MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite new file mode 100644 index 0000000000..26033aad9f --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite @@ -0,0 +1,56 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInRecursiveForReferenceOverride">
+
+ <service name="MyTotalServiceNo" promote="MyTotalServiceForReferenceComponent/MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMay" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMust" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceForReferenceComponent">
+ <implementation.composite name="foo:myTotalServiceInCompositeForReferenceOverride"/>
+ <reference name="MyServiceRefNo" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRefNo" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRefNo" target="MyServiceInComponent/MyListServiceByYear"/>
+ <reference name="MyServiceRefMay" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRefMay" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRefMay" target="MyServiceInComponent/MyListServiceByYear"/>
+ <reference name="MyServiceRefMust" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRefMust" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRefMust" target="MyServiceInComponent/MyListServiceByYear"/>
+ </component>
+
+ <component name="myTotalServiceInRecursiveForReferenceOverride_MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite new file mode 100644 index 0000000000..4b5972bcc1 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite @@ -0,0 +1,52 @@ +<?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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myservice">
+
+ <component name="MyService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyNCService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">NC</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceByDate">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListServiceFor2006">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="year">2006</property>
+ </component>
+
+ <component name="MyListServiceByYear">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java new file mode 100644 index 0000000000..3f64202f13 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java @@ -0,0 +1,61 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ComponentContextTestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Test description: Locate a service and invoke a method.
+ */
+ @Test
+ public void simpleLocate() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.negate(99));
+ }
+
+ /**
+ * Test description: Locate a service that will then locate another service
+ * via a defined reference by means of:
+ * ComponentContext.getService(Class<B>businessInterface, String referenceName);
+ */
+ @Test
+ public void delegateViaDefinedReference() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.delegateNegate(99));
+ }
+
+ @Before
+ public void init() throws Exception {
+ domain = SCADomain.newInstance("http://localhost", "/", "BasicService.composite", "MathService.composite");
+ }
+
+ @After
+ public void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java new file mode 100644 index 0000000000..6a96326fbf --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ComponentServiceReferenceListTestCaseFIXME extends TestCase {
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+
+ private SCADomain domain;
+
+ public void testDefaultProperty() {
+ assertEquals("2007", myListService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myListService = domain.getService(MyListService.class, "MyNewListService");
+ myListServiceByYear = domain.getService(MyListServiceByYear.class, "MyNewListService");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java new file mode 100644 index 0000000000..b5c6a0d7b5 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java @@ -0,0 +1,64 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ComponentServiceReferenceTestCase extends TestCase {
+ private MyTotalService myService;
+ private SCADomain domain;
+
+ public void testDefaultProperty() {
+ assertEquals("NC", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotSame(myService.nextHoliday(), myService.nextHolidayByDate(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyTotalService.class, "MyTotalService");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java new file mode 100644 index 0000000000..d136530412 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java @@ -0,0 +1,98 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ComponentTestCase {
+ private static MyService myService;
+ private static MyServiceByDate myServiceByDate;
+ private static MyListService myListService;
+ private static MyListServiceByYear myListServiceByYear;
+ private static MyService myNCService;
+ private static MyListService myListServiceFor2006;
+
+ private static SCADomain domain;
+
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", myService.getLocation());
+ assertEquals("2006", myService.getYear());
+
+ }
+
+ @Test
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]);
+
+ }
+
+ @Test
+ public void testOverrideProperty() {
+ assertEquals("NC", myNCService.getLocation());
+ assertEquals("2007", myNCService.getYear());
+ }
+
+ @Test
+ public void testServiceWithOverrideProperty() {
+ assertFalse(myNCService.nextHoliday() == myService.nextHoliday());
+ assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]);
+
+ }
+
+ @Test
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MyService");
+ myServiceByDate = domain.getService(MyServiceByDate.class, "MyServiceByDate");
+ myListService = domain.getService(MyListService.class, "MyListService");
+ myListServiceByYear = domain.getService(MyListServiceByYear.class, "MyListServiceByYear");
+ myNCService = domain.getService(MyService.class, "MyNCService");
+ myListServiceFor2006 = domain.getService(MyListService.class, "MyListServiceFor2006");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java new file mode 100644 index 0000000000..5e54b5dcfa --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java @@ -0,0 +1,106 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+@SuppressWarnings("deprecation")
+public class CompositeOneService2LevelTestCaseFIXME extends TestCase {
+ private MyService myService;
+ private MyService myServiceDefault;
+ private MyService myServiceNo;
+ private MyService myServiceMay;
+ private MyService myServiceMust;
+
+ private SCADomain domain;
+
+ public void testPropertyFromComponent() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MySimpleServiceInRecursiveComponent");
+ myServiceDefault = domain.getService(MyService.class, "MySimpleServiceDefault");
+ myServiceNo = domain.getService(MyService.class, "MySimpleServiceNo");
+ myServiceMay = domain.getService(MyService.class, "MySimpleServiceMay");
+ myServiceMust = domain.getService(MyService.class, "MySimpleServiceMust");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java new file mode 100644 index 0000000000..c29e9e72b3 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java @@ -0,0 +1,60 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeOneServiceTestCase extends TestCase {
+ private MyService myService;
+ private SCADomain domain;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotNull(myService.nextHoliday());
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MySimpleServiceInRecursive");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java new file mode 100644 index 0000000000..eb846ddb71 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeServiceReferenceForRefOverrideTestCase extends TestCase {
+ private MyTotalService myService1;
+ private MyTotalService myService2;
+ private MyTotalService myService3;
+ private SCADomain domain;
+
+ public void testPropertyWithServiceFromReferenceNo() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceFromReferenceMay() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceFromReferenceMust() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromReferenceNo() {
+ System.out.println("nextHolday()" + myService1.nextHoliday());
+ System.out.println("nextHolday(Date)" + myService1.nextHolidayByDate(new Date()));
+ System.out.println("myService1.getHolidays()[0]" + myService1.getHolidays()[0]);
+ System.out.println("myService1.getHolidays(2007)[0]" + myService1.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceFromReferenceMay() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceFromReferenceMust() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService1 = domain.getService(MyTotalService.class, "MyTotalServiceNo");
+ myService2 = domain.getService(MyTotalService.class, "MyTotalServiceMay");
+ myService3 = domain.getService(MyTotalService.class, "MyTotalServiceMust");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java new file mode 100644 index 0000000000..60ee8b2011 --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java @@ -0,0 +1,92 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeServiceReferenceTestCase extends TestCase {
+ private MyTotalService myService1;
+ private MyTotalService myService2;
+ private MyTotalService myService3;
+ private MyTotalService myService4;
+ private MyTotalService myService5;
+ private SCADomain domain;
+
+ public void FIXMEtestPropertyWithServiceFromRecursive() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceInCompositeFromRecursive() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceInCompositeFromComponent() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void FIXMEtestServiceFromRecursive() {
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testServiceReferenceFromRecursive() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromRecursiveUseService() {
+ assertNotSame(myService4.nextHoliday(), myService4.nextHolidayByDate(new Date()));
+ assertEquals(myService4.getHolidays()[0], myService4.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceReferenceFromComponent() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromComponentUseService() {
+ assertNotSame(myService5.nextHoliday(), myService5.nextHolidayByDate(new Date()));
+ assertEquals(myService5.getHolidays()[0], myService5.getHolidaysByYear(2007)[0]);
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService1 = domain.getService(MyTotalService.class, "MyTotalServiceFromRecursive");
+ myService2 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursive");
+ myService3 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentService");
+ myService4 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursiveUseService");
+ myService5 =
+ domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentServiceUseService");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java new file mode 100644 index 0000000000..d9c2a73f7e --- /dev/null +++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java @@ -0,0 +1,78 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CompositeTestCase {
+ private static MyService myService;
+ private static MyServiceByDate myServiceByDate;
+ private static MyListService myListService;
+ private static MyListServiceByYear myListServiceByYear;
+
+ private static SCADomain domain;
+
+ @Test
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ @Test
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ @Test
+ public void testContext() {
+ // FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ * assertNotNull("Service component name is null",
+ * myService.getComponentName()); assertNotNull("service context is
+ * null", myService.getContext()); System.out.println("Service component
+ * name :" + myService.getComponentName()); System.out.println("service
+ * context :" + myService.getContext()); test(context);
+ */
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MyServiceInRecursiveMyService");
+ myServiceByDate = domain.getService(MyServiceByDate.class, "MyServiceInRecursiveMyServiceByDate");
+ myListService = domain.getService(MyListService.class, "MyServiceInRecursiveMyListService");
+ myListServiceByYear = domain.getService(MyListServiceByYear.class,
+ "MyServiceInRecursiveMyListServiceByYear");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/pom.xml.off b/sandbox/old/contrib/itest/specTest/pom.xml.off new file mode 100644 index 0000000000..66d1127a0f --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/pom.xml.off @@ -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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>integration-test</artifactId>
+ <version>2.0-alpha-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.integration-test</groupId>
+ <artifactId>specTest</artifactId>
+ <packaging>jar</packaging>
+ <name>Integration Test Suite for SCA Spec APIs</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java new file mode 100644 index 0000000000..6e1b8dc612 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.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 org.apache.tuscany.sca.test.spec; + +/** + * @version $Rev$ $Date$ + */ +public interface ComponentContextTester extends IdentityService { + /** + * Returns true if the ComponentContext was injected + * @return true if the ComponentContext was injected + */ + boolean isContextInjected(); + + /** + * Looks up a reference with the supplied name and returns the identity of the referenced component. + * @param name the name of a reference + * @return the identity of the referenced component + */ + String getServiceIdentity(String name); + + /** + * Looks up a reference with the supplied name using a ServiceReference + * and returns the identity of the referenced component. + * @param name the name of a reference + * @return the identity of the referenced component + */ + String getServiceReferenceIdentity(String name); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java new file mode 100644 index 0000000000..df6366dbef --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java @@ -0,0 +1,56 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; + +/** + * Component that tests ComponentContext functions. + * + * @version $Rev$ $Date$ + */ +public class ComponentContextTesterImpl implements ComponentContextTester { + @Context + public ComponentContext context; + + @Reference + public IdentityService getServiceTest; + + public boolean isContextInjected() { + return context != null; + } + + public String getURI() { + return context.getURI(); + } + + public String getServiceIdentity(String name) { + IdentityService service = context.getService(IdentityService.class, name); + return service.getURI(); + } + + public String getServiceReferenceIdentity(String name) { + ServiceReference<IdentityService> ref = context.getServiceReference(IdentityService.class, name); + IdentityService service = ref.getService(); + return service.getURI(); + } +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java new file mode 100644 index 0000000000..cab690eafd --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java @@ -0,0 +1,34 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.annotations.Context; +import org.osoa.sca.ComponentContext; + +/** + * @version $Rev$ $Date$ + */ +public class IdentifiableComponent implements IdentityService { + @Context + public ComponentContext context; + + public String getURI() { + return context.getURI(); + } +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java new file mode 100644 index 0000000000..25435a3cc4 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java @@ -0,0 +1,26 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +/** + * @version $Rev$ $Date$ + */ +public interface IdentityService { + String getURI(); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java new file mode 100644 index 0000000000..7fe9fa4909 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java @@ -0,0 +1,28 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java new file mode 100644 index 0000000000..28a26dddde --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java @@ -0,0 +1,26 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ String[] getHolidays(int year);
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java new file mode 100644 index 0000000000..fbb2161df3 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java @@ -0,0 +1,29 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService {
+ Date nextHoliday();
+
+ String getLocation();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java new file mode 100644 index 0000000000..892b36e1a1 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java @@ -0,0 +1,28 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ Date nextHoliday(Date date);
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java new file mode 100644 index 0000000000..6a4cfc1f79 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java @@ -0,0 +1,23 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate {
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java new file mode 100644 index 0000000000..2ba1cb41cb --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java @@ -0,0 +1,28 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.ComponentContext;
+
+public interface SCAComponentService {
+ String getComponentName();
+
+ ComponentContext getContext();
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java new file mode 100644 index 0000000000..6f3f761432 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java @@ -0,0 +1,73 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyListService.class, MyListServiceByYear.class})
+public class MyListServiceImpl implements MyListService, MyListServiceByYear {
+
+ // This is multiplicity=1:n
+ @Reference(name = "myListServiceList", required = false)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name = "myListServiceArray", required = false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name = "serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays() {
+ return getHolidays(Integer.parseInt(year));
+ }
+
+ public String[] getHolidays(int year) {
+ MyListService myService;
+ if (myListServicesList != null) {
+ for (MyListService aMyListServicesList : myListServicesList) {
+ myService = aMyListServicesList;
+ if (Integer.parseInt(myService.getYear()) == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ if (myListServicesArray != null) {
+ for (MyListService aMyListServicesArray : myListServicesArray) {
+ myService = aMyListServicesArray;
+ if (Integer.parseInt(myService.getYear()) == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java new file mode 100644 index 0000000000..3aa2c2a136 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java @@ -0,0 +1,122 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class})
+public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear {
+ static String[][] holidays =
+ {
+ {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23",
+ "2006/11/24", "2006/12/25"},
+ {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}};
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ protected String componentName;
+
+ @Context
+ protected ComponentContext context;
+
+ public MyServiceImpl() {
+ System.out.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHoliday(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHoliday(Date today) {
+ Date d1;
+ String[] days = getHolidays();
+ for (String day : days) {
+ d1 = new Date(day);
+ if (d1.after(today))
+ return d1;
+ }
+ return null;
+ }
+
+ public String[] getHolidays(int year) {
+ int index = year - 2006;
+ if (index >= 0 && index < holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays() {
+
+ Integer theYear;
+ if (year == null || year.length() == 0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidays(theYear.intValue());
+ }
+
+ @Init
+ public void start() {
+ System.out.println("Start service..");
+ }
+
+ @Destroy
+ public void stop() {
+ System.out.println("Stop service..");
+
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public ComponentContext getContext() {
+ return context;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..d56e9aede4 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java @@ -0,0 +1,83 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(MyTotalService.class)
+public class MyTotalServiceImpl implements MyTotalService {
+
+ // This is multiplicity=1:1
+ @Reference(required = true)
+ public MyListService myListService;
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyListServiceByYear myListServiceByYear = new MyServiceImpl();
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ // This is multiplicity=0:1
+ @Reference(required = false)
+ public MyServiceByDate myServiceByDate = new MyServiceImpl();
+
+ public String[] getHolidays() {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidays(int year) {
+ return myListServiceByYear.getHolidays(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public ComponentContext getContext() {
+ return myService.getContext();
+ }
+
+ public Date nextHoliday(Date date) {
+ return myServiceByDate.nextHoliday(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..0f09f102b9 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,43 @@ +<?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"
+ name="SpecTestComposite">
+
+ <component name="ComponentContextTester">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.ComponentContextTesterImpl"/>
+ <reference name="getServiceTest" target="ReferencedService"/>
+ </component>
+
+ <component name="ReferencedService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.IdentifiableComponent"/>
+ </component>
+
+ <!--
+ <include name="myTotalService" scdlLocation="myTotalService.scdl"/>
+ <include name="myListService" scdlLocation="myListService.scdl"/>
+ <include name="mySimpleServiceInRecursive" scdlLocation="mySimpleServiceInRecursive.scdl"/>
+ <include name="myServiceInRecursive" scdlLocation="myServiceInRecursive.scdl"/>
+ <include name="mySimpleServiceInRecursive2" scdlLocation="mySimpleServiceInRecursive2.scdl"/>
+ <include name="MyTotalServiceInRecursive" scdlLocation="MyTotalServiceInRecursive.scdl"/>
+ <include name="MyTotalServiceInRecursiveForReferenceOverride" scdlLocation="MyTotalServiceInRecursiveForReferenceOverride.scdl"/>
+ -->
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl new file mode 100644 index 0000000000..55293b00f1 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl @@ -0,0 +1,34 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyListServiceTest">
+
+ <component name="MyNewListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyListServiceImpl"/>
+ <!--
+ <reference name="myListServiceList">MyNCService/MyListService</reference>
+ <reference name="myListServiceArray">MyListServiceFor2006/MyListService</reference>
+ -->
+ <property name="serviceYear">2007</property>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl new file mode 100644 index 0000000000..14b1261604 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl @@ -0,0 +1,49 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyServiceInCompositeTest">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MyListService" promote="MyServiceComponent/MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </service>
+
+
+ <service name="MyListServiceByYear" promote="MyServiceComponent/MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </service>
+
+
+ <service name="MyServiceByDate" promote="MyServiceComponent/MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl new file mode 100644 index 0000000000..5d13f75970 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl @@ -0,0 +1,53 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyServiceInRecursiveTest">
+
+ <service name="MyServiceInRecursiveMyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceInRecursive/MyService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ <reference>MyServiceInRecursive/MyListService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ <reference>MyServiceInRecursive/MyListServiceByYear</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ <reference>MyServiceInRecursive/MyServiceByDate</reference>
+ </service>
+
+
+ <component name="MyServiceInRecursive">
+ <implementation.composite scdlLocation="MyServiceInComposite.scdl"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl new file mode 100644 index 0000000000..700ae21b25 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl @@ -0,0 +1,34 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceTest">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl new file mode 100644 index 0000000000..1354fc2ba4 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl @@ -0,0 +1,44 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleService" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MySimpleServiceNo" override="no" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite scdlLocation="mySimpleService.scdl"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl new file mode 100644 index 0000000000..79287745b7 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl @@ -0,0 +1,47 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleServiceDefault">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleService</reference>
+ </service>
+
+ <service name="MySimpleServiceNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceNo</reference>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMay</reference>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMust</reference>
+ </service>
+
+ <component name="MySimpleServiceInRecursiveComponent">
+ <implementation.composite scdlLocation="mySimpleServiceInRecursive.scdl"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl new file mode 100644 index 0000000000..8e676fedf8 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl @@ -0,0 +1,32 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <include name="myservice" scdlLocation="myservice.scdl"/>
+
+ <component name="MyTotalService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyNCService/MyService"/>
+ <reference name="myListService" target="MyNCService/MyListService"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl new file mode 100644 index 0000000000..825e3777b6 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl @@ -0,0 +1,43 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceReferenceOverrideTest">
+
+ <service name="MyTotalService" promote="MyTotalServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference target="MyTotalServiceComponent"/>
+ </service>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRef"/>
+ <reference name="myListService" target="MyListServiceRef"/>
+ </component>
+
+ <reference name="MyServiceRef">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRef">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl new file mode 100644 index 0000000000..29bfa3cd23 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl @@ -0,0 +1,81 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <service name="MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentNo</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentNo">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRefNo"/>
+ <reference name="myListService" target="MyListServiceRefNo"/>
+ </component>
+
+ <reference name="MyServiceRefNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMay</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMay">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRefMay"/>
+ <reference name="myListService" target="MyListServiceRefMay"/>
+ </component>
+
+ <reference name="MyServiceRefMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMust</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMust">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRefMust"/>
+ <reference name="myListService" target="MyListServiceRefMust"/>
+ </component>
+
+ <reference name="MyServiceRefMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl new file mode 100644 index 0000000000..98c19b6116 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl @@ -0,0 +1,60 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <component name="MyServiceInComposite">
+ <implementation.composite scdlLocation="myServiceInComposite.scdl"/>
+ </component>
+
+ <component name="MyTotalServiceFromRecursive">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceInComposite/MyService"/>
+ <reference name="myListService">MyServiceInComposite/MyListService</reference>
+ </component>
+
+ <service name="MyTotalServiceInCompositeWithRecursiveUseService" promote="MyTotalServiceInCompositeWithRecursive">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceInCompositeWithComponentServiceUseService" promote="MyTotalServiceInCompositeWithComponentService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceInCompositeWithRecursive">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.scdl"/>
+ <reference name="MyServiceRef" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComposite/MyListService"/>
+ </component>
+
+ <component name="MyTotalServiceInCompositeWithComponentService">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.scdl"/>
+ <reference name="MyServiceRef" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComponent/MyListService"/>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl new file mode 100644 index 0000000000..51cd181b00 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl @@ -0,0 +1,52 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <service name="MyTotalServiceNo" promote="MyTotalServiceForReferenceComponent/MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMay" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMust" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceForReferenceComponent">
+ <implementation.composite scdlLocation="myTotalServiceInCompositeForReferenceOverride.scdl"/>
+ <reference name="MyServiceRefNo" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRefNo" target="MyServiceInComposite/MyListService"/>
+ <reference name="MyServiceRefMay" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRefMay" target="MyServiceInComposite/MyListService"/>
+ <reference name="MyServiceRefMust" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRefMust" target="MyServiceInComposite/MyListService"/>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl new file mode 100644 index 0000000000..845cbbf9fd --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl @@ -0,0 +1,51 @@ +<?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"
+ xmlns:foo="http://foo"
+ name="MyServiceComposite">
+
+ <component name="MyService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyNCService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">NC</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceByDate">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListServiceFor2006">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="year">2006</property>
+ </component>
+
+ <component name="MyListServiceByYear">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java new file mode 100644 index 0000000000..c7bce6e65f --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java @@ -0,0 +1,48 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +import junit.framework.TestCase; +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentContextTestComponent extends TestCase { + @Reference + public ComponentContextTester tester; + + public void testContextWasInjected() { + assertTrue(tester.isContextInjected()); + } + + public void testComponentURI() { + assertEquals("itest://localhost/testDomain/testHarness/ComponentContextTester", tester.getURI()); + } + + public void testGetService() { + assertEquals("itest://localhost/testDomain/testHarness/ReferencedService", + tester.getServiceIdentity("getServiceTest")); + } + + public void testGetServiceReference() { + assertEquals("itest://localhost/testDomain/testHarness/ReferencedService", + tester.getServiceReferenceIdentity("getServiceTest")); + } +} diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java new file mode 100644 index 0000000000..c06ce947ea --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class ComponentServiceReferenceListTest extends TestCase {
+ @Reference
+ public MyListService myListService;
+ @Reference
+ public MyListServiceByYear myListServiceByYear;
+
+ public void testDefaultProperty() {
+ assertEquals("2007", myListService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2007)[0]);
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java new file mode 100644 index 0000000000..30a4959d8f --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java @@ -0,0 +1,60 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+
+public class ComponentServiceReferenceTest extends TestCase {
+ @Reference
+ public MyTotalService myService;
+
+ @Context
+ public ComponentContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("NC", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotSame(myService.nextHoliday(), myService.nextHoliday(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.getHolidays(2007)[0]);
+
+ }
+
+ public void testMyServiceContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ }
+
+ public void testContext() {
+ assertNotNull("service context is null", context);
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java new file mode 100644 index 0000000000..d039a066a7 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java @@ -0,0 +1,71 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Reference;
+
+import junit.framework.TestCase;
+
+public class ComponentTest extends TestCase {
+ @Reference
+ public MyService myService;
+ @Reference
+ public MyServiceByDate myServiceByDate;
+ @Reference
+ public MyListService myListService;
+ @Reference
+ public MyListServiceByYear myListServiceByYear;
+ @Reference
+ public MyService myNCService;
+ @Reference
+ public MyListService myListServiceFor2006;
+
+ public void testDefaultProperty() {
+ assertEquals("RTP", myService.getLocation());
+ assertEquals("2006", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHoliday(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2006)[0]);
+
+ }
+
+ public void testOverrideProperty() {
+ assertEquals("NC", myNCService.getLocation());
+ assertEquals("2007", myNCService.getYear());
+ }
+
+ public void testServiceWithOverrideProperty() {
+ assertFalse(myNCService.nextHoliday() == myService.nextHoliday());
+ assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidays(2006)[0]);
+
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java new file mode 100644 index 0000000000..2a50cdc8df --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java @@ -0,0 +1,89 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeOneService2LevelTest extends TestCase {
+ @Reference
+ public MyService myService;
+ @Reference
+ public MyService myServiceDefault;
+ @Reference
+ public MyService myServiceNo;
+ @Reference
+ public MyService myServiceMay;
+ @Reference
+ public MyService myServiceMust;
+
+ public void testPropertyFromComponent() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java new file mode 100644 index 0000000000..27deb92012 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeOneServiceTest extends TestCase {
+ @Reference
+ public MyService myService;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotNull(myService.nextHoliday());
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java new file mode 100644 index 0000000000..b312fd1e36 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java @@ -0,0 +1,70 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeServiceReferenceForRefOverrideTest extends TestCase {
+ @Reference
+ public MyTotalService myService1;
+ @Reference
+ public MyTotalService myService2;
+ @Reference
+ public MyTotalService myService3;
+
+ public void testPropertyWithServiceFromReferenceNo() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceFromReferenceMay() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceFromReferenceMust() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromReferenceNo() {
+ System.out.println("nextHolday()" + myService1.nextHoliday());
+ System.out.println("nextHolday(Date)" + myService1.nextHoliday(new Date()));
+ System.out.println("myService1.getHolidays()[0]" + myService1.getHolidays()[0]);
+ System.out.println("myService1.getHolidays(2007)[0]" + myService1.getHolidays(2007)[0]);
+ assertNotSame(myService1.nextHoliday(), myService1.nextHoliday(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidays(2007)[0]);
+ }
+
+ public void testServiceFromReferenceMay() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidays(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHoliday(new Date()));
+
+ }
+
+ public void testServiceFromReferenceMust() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidays(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHoliday(new Date()));
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java new file mode 100644 index 0000000000..edf8d05512 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java @@ -0,0 +1,81 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeServiceReferenceTest extends TestCase {
+ @Reference
+ public MyTotalService myService1;
+ @Reference
+ public MyTotalService myService2;
+ @Reference
+ public MyTotalService myService3;
+ @Reference
+ public MyTotalService myService4;
+ @Reference
+ public MyTotalService myService5;
+
+ public void testPropertyWithServiceFromRecursive() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceInCompositeFromRecursive() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceInCompositeFromComponent() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromRecursive() {
+ assertNotSame(myService1.nextHoliday(), myService1.nextHoliday(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidays(2007)[0]);
+
+ }
+
+ public void testServiceReferenceFromRecursive() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidays(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHoliday(new Date()));
+
+ }
+
+ public void testServiceReferenceFromRecursiveUseService() {
+ assertNotSame(myService4.nextHoliday(), myService4.nextHoliday(new Date()));
+ assertEquals(myService4.getHolidays()[0], myService4.getHolidays(2007)[0]);
+ }
+
+ public void testServiceReferenceFromComponent() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidays(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHoliday(new Date()));
+
+ }
+
+ public void testServiceReferenceFromComponentUseService() {
+ assertNotSame(myService5.nextHoliday(), myService5.nextHoliday(new Date()));
+ assertEquals(myService5.getHolidays()[0], myService5.getHolidays(2007)[0]);
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java new file mode 100644 index 0000000000..98c368fdba --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java @@ -0,0 +1,55 @@ +/*
+ * 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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeTest extends TestCase {
+ @Reference
+ public MyService myService;
+ @Reference
+ public MyServiceByDate myServiceByDate;
+ @Reference
+ public MyListService myListService;
+ @Reference
+ public MyListServiceByYear myListServiceByYear;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHoliday(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2007)[0]);
+
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl b/sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl new file mode 100644 index 0000000000..62c5cece94 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl @@ -0,0 +1,30 @@ +<?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" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha" + name="SpecTestHarnessComposite"> + + <include name="SpecTestComposite" scdlResource="META-INF/sca/default.scdl"/> + + <component name="testComponentContext"> + <tuscany:junit class="org.apache.tuscany.sca.test.spec.ComponentContextTestComponent"/> + <reference name="tester" target="ComponentContextTester"/> + </component> +</composite> |