diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src')
8 files changed, 691 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java new file mode 100644 index 0000000000..44801846f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite new file mode 100644 index 0000000000..ca3ff6494e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl new file mode 100644 index 0000000000..22d7070ec3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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:8080/services/SCATestToolWSService" /> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp new file mode 100644 index 0000000000..eb219e4cef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..fd58cb8b0e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java new file mode 100644 index 0000000000..8467074c26 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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", 8080); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java new file mode 100644 index 0000000000..b5f076b7e8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java new file mode 100644 index 0000000000..0f6cb912a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.90/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(); + } + +} |