Author: lresende
Date: Sun Jan 20 16:58:25 2008
New Revision: 613712

URL: http://svn.apache.org/viewvc?rev=613712&view=rev
Log:
Strawman of a helloworld bpel with reference to a sca component

Added:
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
   (with props)
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
   (with props)
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
   (with props)
Removed:
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorld.java
Modified:
    incubator/tuscany/java/sca/itest/bpel/helloworld-reference/pom.xml
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
    
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite

Modified: incubator/tuscany/java/sca/itest/bpel/helloworld-reference/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/pom.xml?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/bpel/helloworld-reference/pom.xml 
(original)
+++ incubator/tuscany/java/sca/itest/bpel/helloworld-reference/pom.xml Sun Jan 
20 16:58:25 2008
@@ -104,6 +104,7 @@
                                        
<useSystemClassLoader>true</useSystemClassLoader>
                                </configuration>
                        </plugin>
+                       <!-- 
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
@@ -170,6 +171,7 @@
                                        </execution>
                                </executions>
                        </plugin>
+                       -->
                </plugins>
     </build>
 

Modified: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java
 Sun Jan 20 16:58:25 2008
@@ -19,7 +19,9 @@
 
 package greetings;
 
-import greetings.GreetingsService;
+import java.io.IOException;
+import java.net.Socket;
+
 import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
@@ -51,8 +53,8 @@
         scaDomain.close();
     }
     
-    public void testPing() {
-        
+    public void testPing() throws IOException {
+        new Socket("127.0.0.1", 8085);
     }
     public void testInvoke() {
         String response = greetingsService.getGreetings("Luciano");

Added: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java?rev=613712&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
 Sun Jan 20 16:58:25 2008
@@ -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 greetings;
+
+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;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class GreetingsTestServer {
+
+    private SCADomain scaDomain;
+
+    @Before
+    public void startServer() throws Exception {
+        try {
+            scaDomain = SCADomain.newInstance("greetings/greetings.composite");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testPing() throws IOException {
+        new Socket("127.0.0.1", 8085);
+    }
+
+    @After
+    public void stopServer() throws Exception {
+        scaDomain.close();
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java?rev=613712&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
 Sun Jan 20 16:58:25 2008
@@ -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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
[EMAIL PROTECTED]
+public interface HelloWorldService {
+    public String hello(String name);
+}

Propchange: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java?rev=613712&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
 Sun Jan 20 16:58:25 2008
@@ -0,0 +1,44 @@
+/*
+ * 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 helloworld;
+
+import greetings.GreetingsService;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceImpl implements HelloWorldService {
+   
+    GreetingsService greetingsService;
+
+    public GreetingsService getGreetingsService() {
+        return greetingsService;
+    }
+
+    @Reference
+    public void setGreetingsService(GreetingsService greetingsService) {
+        this.greetingsService = greetingsService;
+    }
+    
+    public String hello(String name) {
+        return greetingsService.getGreetings(name);
+    }
+}
\ No newline at end of file

Propchange: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java
 Sun Jan 20 16:58:25 2008
@@ -19,6 +19,11 @@
 
 package helloworld;
 
+import greetings.GreetingsService;
+
+import java.io.IOException;
+import java.net.Socket;
+
 import junit.framework.TestCase;
 
 import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
@@ -30,7 +35,6 @@
  * @version $Rev$ $Date$
  */
 public class HelloWorldTestCase extends TestCase {
-
     private SCADomain scaDomain;
     
     /**
@@ -49,15 +53,19 @@
         scaDomain.close();
     }
     
+    public void testPing() throws IOException {
+        new Socket("127.0.0.1", 8085);
+    }
+    
+    public void testGreetingsServiceInvocation() {
+        GreetingsService greetingsService = 
scaDomain.getService(GreetingsService.class, "GreetingsServiceComponent");
+        String response = greetingsService.getGreetings("Luciano");
+        assertEquals("Hello Luciano", response);
+    }
+    
     public void testServiceInvocation() {
         HelloPortType bpelService = scaDomain.getService(HelloPortType.class, 
"BPELHelloWorldService");
         String response = bpelService.hello("Hello");
         assertEquals("Hello World", response);
-    }
-    
-    public void testReferenceInvocation() {
-        HelloWorld bpelService = scaDomain.getService(HelloWorld.class, 
"BPELHelloWorld");
-        String response = bpelService.hello("Hello");
-        assertEquals("Hello World", response);        
     }
 }

Modified: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
 (original)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
 Sun Jan 20 16:58:25 2008
@@ -17,8 +17,13 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<wsdl:definitions targetNamespace="http://greetings"; 
xmlns:tns="http://greetings"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
-       name="greetings">
+<wsdl:definitions name="greetings"
+    targetNamespace="http://greetings"; 
+    xmlns:tns="http://greetings"; 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
+    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+    xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/";>
 
     <wsdl:types>
         <schema elementFormDefault="qualified" 
targetNamespace="http://greetings"; xmlns="http://www.w3.org/2001/XMLSchema";>
@@ -76,4 +81,7 @@
         </wsdl:port>
     </wsdl:service>
 
+    <plnk:partnerLinkType name="GreetingsPartnerLinkType">
+        <plnk:role name="processGreetings" portType="tns:Greetings"/>
+    </plnk:partnerLinkType>
 </wsdl:definitions>

Modified: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
 (original)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
 Sun Jan 20 16:58:25 2008
@@ -22,45 +22,63 @@
     xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/";
     
xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld";    
     xmlns:xsd="http://www.w3.org/2001/XMLSchema";
-    
xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl";
+    
xmlns:helloworld="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl";
+    xmlns:greetings="http://greetings";
     queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
     expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
 
   <import location="helloworld.wsdl" 
importType="http://schemas.xmlsoap.org/wsdl/";
      
namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+  <import location="../greetings/greetings.wsdl" 
importType="http://schemas.xmlsoap.org/wsdl/";
+     namespace="http://greetings"/>
 
    <partnerLinks>
-      <partnerLink name="helloPartnerLink" 
partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+      <partnerLink name="helloPartnerLink" 
partnerLinkType="helloworld:HelloPartnerLinkType" myRole="me" />
+      <partnerLink name="greetingsPartnerLink" 
partnerLinkType="greetings:GreetingsPartnerLinkType" myRole="processGreetings" 
initializePartnerRole="yes" />
    </partnerLinks>
     
    <variables>
-     <variable name="helloMessage" messageType="test:HelloMessage"/>
-     <variable name="tmpVar" type="xsd:string"/>
+     <variable name="helloMessage" messageType="helloworld:HelloMessage"/>
+     <variable name="helloResponse" messageType="helloworld:HelloMessage"/>
+     <variable name="greetingsRequest" 
messageType="greetings:getGreetingsRequest"/>
+     <variable name="greetingsResponse" 
messageType="helloworld:getGreetingsResponse"/>
    </variables>
 
    <sequence>
        <receive
-          name="start"
+          name="start"
+          createInstance="yes"
+          operation="hello"
           partnerLink="helloPartnerLink"
-          portType="test:HelloPortType"
-          operation="hello"
-          variable="helloMessage"
-          createInstance="yes"/>
+          portType="helloworld:HelloPortType"
+          variable="helloMessage"/>
+
+       <assign name="assignToGreetingsRequest">
+          <copy>
+              <from>$helloMessage.TestPart</from>
+              <to>$getGreetingsRequest.parameters</to>
+          </copy>
+       </assign>
 
-      <assign name="assign1">
-          <copy>
-              <from variable="helloMessage" part="TestPart"/>
-              <to variable="tmpVar"/>
-          </copy>
-          <copy>
-              <from>concat($tmpVar,' World')</from>
-              <to variable="helloMessage" part="TestPart"/>
-          </copy>
-      </assign>
-       <reply name="end"  
-              partnerLink="helloPartnerLink"
-              portType="test:HelloPortType" 
+      <invoke name="invokeGreetings"
+              operation="getGreetings"
+              inputVariable="greetingsRequest"
+              outputVariable="greetingsResponse"
+              partnerLink="greetingsPartnerLink"
+              portType="greetings:Greetings" />
+
+       <assign name="assignToHelloResponse">
+          <copy>
+              <from>$getGreetingsResponse.parameters</from>
+              <to>$helloResponse.TestPart</to>
+          </copy>
+       </assign>
+
+       <reply name="end"  
               operation="hello"
-              variable="helloMessage"/>
+              partnerLink="helloPartnerLink"
+              portType="helloworld:HelloPortType" 
+              variable="helloResponse"/>
    </sequence>
 </process>

Modified: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
 (original)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
 Sun Jan 20 16:58:25 2008
@@ -25,6 +25,10 @@
   <service name="HelloService">
         <interface.wsdl 
interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)"
 />
   </service>
+  
+  <reference name="greetingsService" target="GreetingsServiceComponent">
+        <binding.ws uri="http://localhost:8085/GreetingsService"/>
+  </reference>
 
 </componentType>              
        

Modified: 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite?rev=613712&r1=613711&r2=613712&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite
 (original)
+++ 
incubator/tuscany/java/sca/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite
 Sun Jan 20 16:58:25 2008
@@ -22,15 +22,15 @@
     
xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld";
     name="helloworld">
     
-    <component name="BPELHelloWorld">
-        <implementation.java class="helloworld.HelloWorld"/>
-        <reference name="helloService" target="BPELHelloWorldService">
-            <!--  Workaround for databinding issue -->
-               <!--  interface.wsdl 
interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)"
 / -->
-        </reference>
-    </component>
-    
-    <component name="BPELHelloWorldService">
+    <component name="BPELHelloWorldServiceComponent">
         <implementation.bpel process="hns:HelloWorld"/>
     </component>
+    
+    <component name="GreetingsServiceComponent">
+        <implementation.java class="greetings.GreetingsServiceImpl" />
+           <service name="GreetingsService">
+               <interface.wsdl 
interface="http://greetings#wsdl.interface(Greetings)" />
+               <binding.ws uri="http://localhost:8085/GreetingsService"/>
+           </service>
+    </component> 
 </composite>



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

Reply via email to