From 521237f10e7c01ce20a2ddd114a3d57f3a7584e2 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 8 Oct 2008 12:36:50 +0000 Subject: Copy 1.3.2-RC2 tag as 1.3.2 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@702845 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/1.3.2/samples/callback-ws-service/README | 227 +++++++++++++++++++++ .../1.3.2/samples/callback-ws-service/build.xml | 73 +++++++ .../callback-ws-service/callback-ws-service.png | Bin 0 -> 8949 bytes .../callback-ws-service/callback-ws-service.svg | 200 ++++++++++++++++++ .../sca/1.3.2/samples/callback-ws-service/pom.xml | 79 +++++++ .../src/main/java/myserver/CallbackServer.java | 48 +++++ .../src/main/java/myserver/MyService.java | 34 +++ .../src/main/java/myserver/MyServiceCallback.java | 30 +++ .../src/main/java/myserver/MyServiceImpl.java | 56 +++++ .../main/resources/META-INF/sca-contribution.xml | 24 +++ .../src/main/resources/callbackws.composite | 35 ++++ .../test/java/myserver/CallbackServerTestCase.java | 52 +++++ 12 files changed, 858 insertions(+) create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/README create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/build.xml create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.png create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.svg create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/pom.xml create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyService.java create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/callbackws.composite create mode 100644 tags/java/sca/1.3.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java (limited to 'tags/java/sca/1.3.2/samples/callback-ws-service') diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/README b/tags/java/sca/1.3.2/samples/callback-ws-service/README new file mode 100644 index 0000000000..2c65f745a6 --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/README @@ -0,0 +1,227 @@ +Callback Web Services Service Sample +=================================== +This sample demonstrates an SCA service with callback to a remote client +using Web service bindings for the service and the callback. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look +there first. + +If you just want to run it to see what happens open a command prompt, +navigate to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do: + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer + +and on *nix do: + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer + +Now the server is started you can use the callback-ws-client sample to +exercise it. + +Sample Overview +--------------- +The sample has a single component that provides a service that is +invoked from a remote client over Web services and makes an SCA callback +over Web services to the same remote client. + +callback-ws-service/ + src/ + main/ + java/ + myserver/ + MyService.java - interface description for + MyServiceComponent + MyServiceCallback.java - interface description for callback + NyServiceImpl.java - component implementation + CallbackServer.java - starts the SCA runtime and + deploys the callbackws.composite + and then waits for the service + to be called via Web services + resources/ + callbackws.composite - the SCA assembly for this sample + test/ + java/ + myserver/ + CallbackServerTestCase.java - JUnit test case + callback-ws-service.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant with +the following commands: + +cd callback-ws-service +ant compile +ant run + +You should see the following output from the run target: + +run: + [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy +Impl init + [java] INFO: Domain will be started stand-alone as domain URL is not provid +ed + [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.domain.impl.SCADomainImp +l registerNode + [java] INFO: Registered node: http://L3AW203:1331 at endpoint http://L3AW20 +3:1331 + [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy +Impl createRuntime + [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea +se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu +bating-SNAPSHOT.jar + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainEventServi +ceProxyComponent + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainAPIService +ProxyComponent + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo +nent/SCANodeManagerService + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo +nent/ComponentManagerService/* + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo +nent/ComponentManagerService + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomain/scaDomain +.js + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl ac +tivateComposite + [java] INFO: Building composite: {http://callbackws}callbackws + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl st +artComposite + [java] INFO: Starting composite: {http://callbackws}callbackws + [java] 15-Jan-2008 10:21:26 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] Callback server started (press enter to shutdown) + +As this point the SCA service is exposed as a Web service by a Web server +started automatically by the SCA runtime. To stop the server, press enter. + +To exercise the service, run the callback-ws-client sample. Take a look at +the README in that sample and you will see you need the following commands: + +cd callback-ws-client +ant run + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and +run using Maven as follows. When using Maven you don't need to run the +callback-ws-client sample as the Maven build uses a simple ping test to +make sure that the service is available. + +cd callback-ws-service +mvn + +You should see the following output from the test phase: + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running myserver.CallbackServerTestCase +15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init +INFO: Domain will be started stand-alone as domain URL is not provided +15-Jan-2008 10:29:36 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo +de +INFO: Registered node: http://L3AW203:1365 at endpoint http://L3AW203:1365 +15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR +untime +INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw +s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO +T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar +15-Jan-2008 10:29:42 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:29:42 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +1.dtd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +2.dtd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-1365 +15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-1365 +15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainEventServiceProxyCompo +nent +15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainAPIServiceProxyCompone +nt +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/SCANode +ManagerService +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone +ntManagerService/* +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone +ntManagerService +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCADomain/scaDomain.js +15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos +ite +INFO: Building composite: {http://callbackws}callbackws +15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite + +INFO: Starting composite: {http://callbackws}callbackws +15-Jan-2008 10:29:43 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:29:43 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent +15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite +INFO: Stopping composite: {http://callbackws}callbackws +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-1365 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.422 sec + +This shows that the Junit test cases have run successfully. diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/build.xml b/tags/java/sca/1.3.2/samples/callback-ws-service/build.xml new file mode 100644 index 0000000000..c91dd88a8c --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.png b/tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.png new file mode 100644 index 0000000000..772ac38431 Binary files /dev/null and b/tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.png differ diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.svg b/tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.svg new file mode 100644 index 0000000000..ff0a1d307b --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/callback-ws-service.svg @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + callbackws + + MyServiceComponent + http://localhost:8086/MyServiceComponent + + myservice callback + + diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/pom.xml b/tags/java/sca/1.3.2/samples/callback-ws-service/pom.xml new file mode 100644 index 0000000000..38e136df97 --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.3.2 + ../../pom.xml + + sample-callback-ws-service + Apache Tuscany SCA Callback Web Service Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node2-impl + 1.3.2 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.3.2 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.3.2 + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.3.2 + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + + diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java new file mode 100644 index 0000000000..9dfead61db --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.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 myserver; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; + +/** + * This server program shows how to create and start an SCA runtime that + * activates the MyService Web service endpoint. + */ +public class CallbackServer { + + public static void main(String[] args) throws Exception { + + SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null); + node.start(); + + try { + System.out.println("Callback server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + node.stop(); + System.out.println("Callback server stopped"); + } + +} diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyService.java b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyService.java new file mode 100644 index 0000000000..1850eae1bc --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyService.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 myserver; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +/** + * The remote service that will be invoked by the client + */ +@Remotable +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java new file mode 100644 index 0000000000..bf5f87a4f9 --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.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 myserver; + +import org.osoa.sca.annotations.Remotable; + +/** + * The callback interface for {@link MyService}. + */ +@Remotable +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java new file mode 100644 index 0000000000..25469def5c --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.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 myserver; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(MyService.class) +@Scope("COMPOSITE") +public class MyServiceImpl implements MyService { + + private MyServiceCallback myServiceCallback; + + /** + * The setter used by the runtime to set the callback reference + * @param myServiceCallback + */ + @Callback + public void setMyServiceCallback(MyServiceCallback myServiceCallback) { + System.out.println("setMyServiceCallback on thread " + Thread.currentThread()); + this.myServiceCallback = myServiceCallback; + } + + public void someMethod(String arg) { + System.out.println("someMethod on thread " + Thread.currentThread()); + // invoke the callback + try { + System.out.println("Sleeping ..."); + Thread.sleep(2000); + myServiceCallback.receiveResult(arg + " -> receiveResult "); + } catch(Exception e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + e.printStackTrace(); + } + } +} diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..35f7f60c2e --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/callbackws.composite b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/callbackws.composite new file mode 100644 index 0000000000..a09e638896 --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/main/resources/callbackws.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/1.3.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java b/tags/java/sca/1.3.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java new file mode 100644 index 0000000000..4208f7f6b5 --- /dev/null +++ b/tags/java/sca/1.3.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.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 myserver; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the callback server is available + */ +public class CallbackServerTestCase { + + private SCANode2 node; + + @Before + public void startServer() throws Exception { + node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null); + node.start(); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8086); + } + + @After + public void stopServer() throws Exception { + node.stop(); + } +} -- cgit v1.2.3