Author: nash
Date: Mon Nov 19 15:35:35 2007
New Revision: 596487
URL: http://svn.apache.org/viewvc?rev=596487&view=rev
Log:
Fix versions in pom, add README and unit test
Added:
incubator/tuscany/java/sca/samples/callback-ws-client/README
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/myapp/
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
Modified:
incubator/tuscany/java/sca/samples/callback-ws-client/pom.xml
incubator/tuscany/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java
Added: incubator/tuscany/java/sca/samples/callback-ws-client/README
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-client/README?rev=596487&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/callback-ws-client/README (added)
+++ incubator/tuscany/java/sca/samples/callback-ws-client/README Mon Nov 19
15:35:35 2007
@@ -0,0 +1,152 @@
+Callback Web Services Client Sample
+===================================
+This sample demonstrates an SCA client that sends service requests to a
+remote server and receives asynchronous callbacks from the server, 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, you need to start the
+server first, so open a command prompt and navigate to the
+callback-ws-service 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
+
+Once the server is running 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-client.jar
myapp.MyClientImpl
+
+and on *nix do:
+
+java -cp
../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-client.jar
myapp.MyClientImpl
+
+
+Sample Overview
+---------------
+The sample has a single component that has a reference with a service
+interface and a callback interface, with Web service bindings for both
+these interfaces. The service interface binding URI identifies the
+service exposed by the callback-ws-service sample.
+
+callback-ws-client/
+ src/
+ main/
+ java/
+ myapp/
+ MyClient.java - interface description for
+ MyClientComponent
+ MyClientImpl.java - component implementation
+ myserver/
+ MyService.java - interface description for
+ MyServiceComponent
+ MyServiceCallback.java - interface description for callback
+ resources/
+ myapp.composite - the SCA assembly for this sample
+ test/
+ java/
+ myapp/
+ CallbackClientTestCase.java - JUnit test case
+ callback-ws-client.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.
+Before you do this, run the callback-ws-service sample to start up the
+service that the client will talk to. Take a look at the README in
+that sample and you will see you need the following commands:
+
+cd callback-ws-service
+ant run
+
+You can then compile and run this sample using the following commands:
+
+cd callback-ws-client
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 19-Nov-2007 23:05:34 org.apache.tuscany.sca.http.jetty.JettyServer
addServletMapping
+ [java] INFO: Added Servlet mapping: http://EUREKA:8080/MyClientComponent
+ [java] aClientMethod on thread Thread[main,5,main]
+ [java] aClientMethod return from someMethod on thread Thread[main,5,main]
+ [java] receiveResult on thread Thread[pool-1-thread-2,5,main]
+ [java] Result: -> someMethod -> receiveResult
+ [java] Closing the domain
+
+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-service sample first as Maven does this for you. With Maven,
+both client and server code run in the same JVM, which rather defeats the
+purpose of this sample (to show a standalone SCA client), but it's good
+enough for a unit test.
+
+cd callback-ws-client
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running myapp.CallbackClientTestCase
+19-Nov-2007 18:40:32 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+19-Nov-2007 18:40:32 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+19-Nov-2007 18:40:32 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8086
+19-Nov-2007 18:40:32 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8086
+19-Nov-2007 18:40:32 org.apache.tuscany.sca.http.tomcat.TomcatServer
addServletMapping
+INFO: Added Servlet mapping: http://EUREKA:8086/MyServiceComponent
+19-Nov-2007 18:40:33 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+19-Nov-2007 18:40:33 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+19-Nov-2007 18:40:33 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8080
+19-Nov-2007 18:40:33 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8080
+19-Nov-2007 18:40:33 org.apache.tuscany.sca.http.tomcat.TomcatServer
addServletMapping
+INFO: Added Servlet mapping: http://EUREKA:8080/MyClientComponent
+aClientMethod on thread Thread[main,5,main]
+aClientMethod return from someMethod on thread Thread[main,5,main]
+setMyServiceCallback on thread Thread[pool-1-thread-1,5,main]
+someMethod on thread Thread[pool-1-thread-1,5,main]
+Sleeping ...
+receiveResult on thread Thread[pool-2-thread-1,5,main]
+Result: -> someMethod -> receiveResult
+Closing the domain
+19-Nov-2007 18:40:38 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8080
+19-Nov-2007 18:40:38 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8086
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.796 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
Modified: incubator/tuscany/java/sca/samples/callback-ws-client/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-client/pom.xml?rev=596487&r1=596486&r2=596487&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/callback-ws-client/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/callback-ws-client/pom.xml Mon Nov 19
15:35:35 2007
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
- <version>1.0-incubating-SNAPSHOT</version>
+ <version>1.1-incubating-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>sample-callback-ws-client</artifactId>
@@ -39,29 +39,43 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-embedded</artifactId>
- <version>1.0-incubating-SNAPSHOT</version>
+ <version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.0-incubating-SNAPSHOT</version>
+ <version>1.1-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-axis2</artifactId>
- <version>1.0-incubating-SNAPSHOT</version>
+ <version>1.1-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-tomcat</artifactId>
- <version>1.0-incubating-SNAPSHOT</version>
+ <version>1.1-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-callback-ws-service</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
Modified:
incubator/tuscany/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java?rev=596487&r1=596486&r2=596487&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java
(original)
+++
incubator/tuscany/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java
Mon Nov 19 15:35:35 2007
@@ -52,6 +52,5 @@
Thread.sleep(5000); // don't exit before callback arrives
System.out.println("Closing the domain");
scaDomain.close();
- System.out.println("Domain was closed");
}
}
Added:
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java?rev=596487&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
(added)
+++
incubator/tuscany/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
Mon Nov 19 15:35:35 2007
@@ -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 myapp;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the callback server is available
+ */
+public class CallbackClientTestCase {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("callbackws.composite");
+ }
+
+ @Test
+ public void testClient() throws Exception {
+ MyClientImpl.main(null);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]