Author: nash
Date: Mon Nov 19 04:50:11 2007
New Revision: 596282

URL: http://svn.apache.org/viewvc?rev=596282&view=rev
Log:
Fix wrong versions in pom and add README and test case

Added:
    incubator/tuscany/java/sca/samples/callback-ws-service/README
    incubator/tuscany/java/sca/samples/callback-ws-service/src/test/
    incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/
    
incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/myserver/
    
incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java
Modified:
    incubator/tuscany/java/sca/samples/callback-ws-service/pom.xml

Added: incubator/tuscany/java/sca/samples/callback-ws-service/README
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-service/README?rev=596282&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/callback-ws-service/README (added)
+++ incubator/tuscany/java/sca/samples/callback-ws-service/README Mon Nov 19 
04:50:11 2007
@@ -0,0 +1,115 @@
+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] 12-Nov-2007 17:05:38 org.apache.tuscany.sca.http.jetty.JettyServer 
addServletMapping
+     [java] INFO: Added Servlet mapping: http://EUREKA:8086/MyServiceComponent
+     [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
+18-Nov-2007 15:48:25 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+18-Nov-2007 15:48:26 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+18-Nov-2007 15:48:26 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8086
+18-Nov-2007 15:48:26 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8086
+18-Nov-2007 15:48:26 org.apache.tuscany.sca.http.tomcat.TomcatServer 
addServletMapping
+INFO: Added Servlet mapping: http://EUREKA:8086/MyServiceComponent
+18-Nov-2007 15:48:26 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.134 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-service/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-service/pom.xml?rev=596282&r1=596281&r2=596282&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/callback-ws-service/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/callback-ws-service/pom.xml Mon Nov 19 
04:50:11 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-service</artifactId>
@@ -39,28 +39,35 @@
         <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>
 
     </dependencies>

Added: 
incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java?rev=596282&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java
 Mon Nov 19 04:50:11 2007
@@ -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 myserver;
+
+import java.io.IOException;
+import java.net.Socket;
+
+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 CallbackServerTestCase {
+
+    private SCADomain scaDomain;
+
+    @Before
+       public void startServer() throws Exception {
+        scaDomain = SCADomain.newInstance("callbackws.composite");
+       }
+
+       @Test
+       public void testPing() throws IOException {
+               new Socket("127.0.0.1", 8086);
+       }
+    
+       @After
+       public void stopServer() throws Exception {
+        scaDomain.close();
+       }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to