OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | orchestra-commits List | September 2007 Index

<--  Date Index  --> <--  Thread Index  -->

[765] trunk/OrchestraPVM/modules/axisws/src/main/java/org/ow2/orchestra/axisws: test for axis deployment (2 services to deploy)


Title: [765] trunk/OrchestraPVM/modules/axisws/src/main/java/org/ow2/orchestra/axisws: test for axis deployment (2 services to deploy)
Revision
765
Author
porcherg
Date
2007-09-21 14:30:13 +0200 (Fri, 21 Sep 2007)

Log Message

test for axis deployment (2 services to deploy)

Modified Paths

Added Paths

Diff

Modified: trunk/OrchestraPVM/modules/axisws/src/main/java/org/ow2/orchestra/axisws/AxisPublisher.java (764 => 765)


--- trunk/OrchestraPVM/modules/axisws/src/main/java/org/ow2/orchestra/axisws/AxisPublisher.java	2007-09-21 09:40:45 UTC (rev 764)
+++ trunk/OrchestraPVM/modules/axisws/src/main/java/org/ow2/orchestra/axisws/AxisPublisher.java	2007-09-21 12:30:13 UTC (rev 765)
@@ -43,13 +43,14 @@
     QName processQName = bpelProcess.getQName();
     AxisDeployer axisDeployer = new AxisDeployer(processQName, null);
     WsdlsInfos wsdlInfos = bpelProcess.getWsdlInfos();
+    List<Service> services = new ArrayList<Service>();
     for (OperationKey operationKey : receivers.keySet()) {
       QName portTypeQName = operationKey.getPortTypeQName();
-      List<Service> services = wsdlInfos.getServicesOfPortType(portTypeQName);
-      if (services != null) {
-        axisDeployer.undeploy(services);
-      }
+      services.addAll(wsdlInfos.getServicesOfPortType(portTypeQName));
     }
+    if (services != null) {
+      axisDeployer.undeploy(services);
+    }
     super.unpublishServices(bpelProcess);
   }
 

Added: trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/Hello2Test.java (764 => 765)


--- trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/Hello2Test.java	2007-09-21 09:40:45 UTC (rev 764)
+++ trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/Hello2Test.java	2007-09-21 12:30:13 UTC (rev 765)
@@ -0,0 +1,257 @@
+/**
+ * Copyright (C) 2007  Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation
+ * version 2.1 of the License.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA  02110-1301, USA.
+ **/
+package org.ow2.orchestra.tests.functionnal.ws.axis.hello2;
+
+
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.transform.dom.DOMSource;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+import org.ow2.orchestra.axisws.AxisPublisher;
+import org.ow2.orchestra.deployment.Deployer;
+import org.ow2.orchestra.execution.function.ExpressionExecutor;
+import org.ow2.orchestra.execution.function.GetVariablePropertyFunction;
+import org.ow2.orchestra.execution.function.QueryExecutor;
+import org.ow2.orchestra.execution.services.Invoker;
+import org.ow2.orchestra.execution.services.ProcessRepository;
+import org.ow2.orchestra.execution.services.Publisher;
+import org.ow2.orchestra.execution.services.UnsupportedInvoker;
+import org.ow2.orchestra.execution.services.memory.MemoryProcessRepository;
+import org.ow2.orchestra.util.Language;
+import org.ow2.orchestra.util.LanguageProcessor;
+import org.ow2.orchestra.xpath.JaxenExpressionExecutor;
+import org.ow2.orchestra.xpath.JaxenGetVariablePropertyFunction;
+import org.ow2.orchestra.xpath.JaxenProcessor;
+import org.ow2.orchestra.xpath.JaxenQueryExecutor;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+import org.xml.sax.InputSource;
+
+/**
+ * 
+ * Tests a hello2 process:
+ * - 2 services to deploy
+ * - 2 receive/reply
+ * 
+ * @author Charles Souillard, Guillaume Porcher
+ */
+public class Hello2Test extends TestCase {
+
+  class Hello2CallHelloPT implements Runnable {
+    private Throwable uncaughtException;
+
+    public Throwable getTrowable() {
+      return uncaughtException;
+    }
+
+    public void run() {
+      try {
+
+        String enveloppe =
+          "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+          + "  <env:Body>"
+          + "    <name>toto</name>"
+          + "  </env:Body>"
+          + "</env:Envelope>";
+
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        Document document = documentBuilder.parse(new InputSource(new StringReader(enveloppe)));
+        SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
+        SOAPConnection connection = conFactory.createConnection();
+        MessageFactory messFactory = MessageFactory.newInstance();
+        SOAPMessage soapMessage = messFactory.createMessage();
+        SOAPPart soapPart = soapMessage.getSOAPPart();
+        soapPart.setContent(new DOMSource(document));
+        SOAPMessage response = connection.call(soapMessage, "http://localhost:8080/orchestra/services/helloPT");
+        connection.close();
+        if (response != null) {
+          SOAPBodyElement result = (SOAPBodyElement) response.getSOAPBody().getChildElements().next();
+          assertNotNull(result);
+          assertTrue(result instanceof Element);
+          //assertEquals("result", result.getElementName().getLocalName());
+          assertNotNull(result.getFirstChild());
+          assertTrue(result.getFirstChild() instanceof Text);
+          Text text = (Text) result.getFirstChild();
+          assertEquals("coucou toto", text.getData());
+        } else {
+          assertTrue("No return available", false);
+        }
+      } catch (Throwable e) {
+        uncaughtException = e;
+      }
+    }
+  }
+
+  class Hello2CallHelloTextPT implements Runnable {
+    private Throwable uncaughtException;
+
+    public Throwable getTrowable() {
+      return uncaughtException;
+    }
+
+    public void run() {
+      try {
+
+        String enveloppe =
+          "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+          + "  <env:Body>"
+          + "    <setHelloText>coucou </setHelloText>"
+          + "  </env:Body>"
+          + "</env:Envelope>";
+
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        Document document = documentBuilder.parse(new InputSource(new StringReader(enveloppe)));
+        SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
+        SOAPConnection connection = conFactory.createConnection();
+        MessageFactory messFactory = MessageFactory.newInstance();
+        SOAPMessage soapMessage = messFactory.createMessage();
+        SOAPPart soapPart = soapMessage.getSOAPPart();
+        soapPart.setContent(new DOMSource(document));
+        SOAPMessage response = connection.call(soapMessage, "http://localhost:8080/orchestra/services/helloTextPT");
+        connection.close();
+        if (response != null) {
+          SOAPBodyElement result = (SOAPBodyElement) response.getSOAPBody().getChildElements().next();
+          assertNotNull(result);
+          assertTrue(result instanceof Element);
+          assertEquals("setHelloText", result.getElementName().getLocalName());
+          assertNotNull(result.getFirstChild());
+          assertTrue(result.getFirstChild() instanceof Text);
+          Text text = (Text) result.getFirstChild();
+          assertEquals("coucou", text.getData());
+        } else {
+          assertTrue("No return available", false);
+        }
+      } catch (Throwable e) {
+        uncaughtException = e;
+      }
+    }
+  }
+  /**
+   * test.
+   * @throws Exception exception
+   */
+  public void testAxisHello2() throws Exception {
+    String envAsString = ""
+      + "<environment-scopes>"
+      + "  <application>"
+      + "    <object name='" + Deployer.DEFAULT_KEY + "' class='" + Deployer.class.getName() + "' init='eager'>"
+      + "      <field name='" + ProcessRepository.DEFAULT_KEY + "'><ref object='" + ProcessRepository.DEFAULT_KEY + "' /></field>"
+      + "      <field name='" + Publisher.DEFAULT_KEY + "'><ref object='" + Publisher.DEFAULT_KEY + "' /></field>"
+      + "    </object>"
+      + "    <object name='" + Publisher.DEFAULT_KEY + "' class='" + AxisPublisher.class.getName() + "' init='eager'/>"
+      + "    <object name='" + Invoker.DEFAULT_KEY + "' class='" + UnsupportedInvoker.class.getName() + "' init='eager'/>"
+      + "    <object name='" + ProcessRepository.DEFAULT_KEY + "' class='" + MemoryProcessRepository.class.getName() + "' init='eager'/>"
+      + "    <object name='" + GetVariablePropertyFunction.DEFAULT_KEY + "' class='" + JaxenGetVariablePropertyFunction.class.getName() + "' init='eager'/>"
+      + "    <object name='" + ExpressionExecutor.getExpressionExecutorKey(Language.XPath) + "' class='" + JaxenExpressionExecutor.class.getName() + "' init='eager'/>"
+      + "    <object name='" + QueryExecutor.getQueryExecutorKey(Language.XPath) + "' class='" + JaxenQueryExecutor.class.getName() + "' init='eager'/>"
+      + "    <object name='" + LanguageProcessor.getLanguageProcessorKey(Language.XPath) + "' class='" + JaxenProcessor.class.getName() + "' init='eager'/>"
+      + "  </application>"
+      + "  <block>"
+      + "  </block>"
+      + "</environment-scopes>"
+      ;
+    String processName = "hello2";
+    String processNamespace = "http://orchestra.ow2.org/demos/hello2";
+    QName processQName = new QName(processNamespace, "hello2");
+    try {
+
+      if (System.getSecurityManager() == null) {
+        System.setSecurityManager(new SecurityManager());
+      }
+      JMXServiceURL url = "" JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/orchestraServer");
+      JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
+      MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
+      String domain = mbsc.getDefaultDomain();
+
+      ObjectName mbeanObjectName = ObjectName.getInstance("JMXAgent:name=orchestraRemoteDeployer");
+
+      String[] deploySignature = {
+          String.class.getName(),
+          QName.class.getName(),
+          URL.class.getName(),
+          URL.class.getName()};
+      Object[] deployParams = {
+          envAsString,
+          processQName,
+          this.getClass().getResource(processName + ".bpel"),
+          this.getClass().getResource(processName + ".wsdl")
+      };
+      mbsc.invoke(mbeanObjectName, "deploy", deployParams, deploySignature);
+
+      Hello2CallHelloTextPT helloTextCall = new Hello2CallHelloTextPT();
+      Hello2CallHelloPT helloCall = new Hello2CallHelloPT();
+
+      Thread t1 = new Thread(helloTextCall);
+      Thread t2 = new Thread(helloCall);
+
+      // Do the first call
+      t1.start();
+      // Wait before doing the second call
+      synchronized (this) {
+        this.wait(2000);
+      }
+      // Do the second call
+      t2.start();
+
+      // Wait for answers
+      while (t1.isAlive() || t2.isAlive()) {
+        t1.join(100);
+        t2.join(100);
+        if (helloCall.getTrowable() != null) {
+          throw new AssertionFailedError("Error in thread").initCause(helloCall.getTrowable());
+        }
+        if (helloTextCall.getTrowable() != null) {
+          throw new AssertionFailedError("Error in thread").initCause(helloTextCall.getTrowable());
+        }
+      }
+
+      // undeploy services
+
+      String[] undeploySignature = {QName.class.getName()};
+      Object[] undeployParams = {processQName};
+      mbsc.invoke(mbeanObjectName, "undeploy", undeployParams, undeploySignature);
+
+    } catch (Throwable e) {
+      if (e instanceof AssertionFailedError) {
+        throw (AssertionFailedError)e;
+      }
+      e.printStackTrace();
+      assertTrue(false);
+    }
+  }
+
+}
+
+
Property changes on: trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/Hello2Test.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/hello2.bpel (764 => 765)


--- trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/hello2.bpel	2007-09-21 09:40:45 UTC (rev 764)
+++ trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/hello2.bpel	2007-09-21 12:30:13 UTC (rev 765)
@@ -0,0 +1,59 @@
+<process name="hello2"
+	targetNamespace="http://orchestra.ow2.org/demos/hello2"
+	xmlns:tns="http://orchestra.ow2.org/demos/hello2"
+	xmlns:bpelj="http://schemas.xmlsoap.org/ws/2003/03/business-process/java"
+	xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
+	xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
+	<partnerLinks>
+		<partnerLink name="hello" myRole="hello"
+			partnerLinkType="tns:helloPLT" />
+		<partnerLink name="helloText" myRole="set"
+			partnerLinkType="tns:helloTextPLT" />
+	</partnerLinks>
+
+	<variables>
+		<variable name="input" messageType="tns:helloNameRequest" />
+		<variable name="output" messageType="tns:helloNameResponse" />
+		<variable name="helloWord" messageType="tns:helloSetText" />
+	</variables>
+
+
+	<sequence>
+		<receive partnerLink="helloText" portType="tns:helloTextPT"
+			operation="setHelloText" variable="helloWord" createInstance="yes" />
+
+
+		<receive partnerLink="hello" portType="tns:helloPT"
+			operation="sayHello" variable="input">
+		</receive>
+		<!--
+			Concat "Hello " and the name stored in the input
+			
+		-->
+		<assign name="Convert_input_variables">
+
+			<copy>
+				<from>
+					<literal>Default Say Hello</literal>
+				</from>
+				<to>$output.result</to>
+			</copy>
+
+
+			<copy>
+				<from>concat($helloWord.word, $input.name)</from>
+				<to>$output.result/text()</to>
+			</copy>
+		</assign>
+
+
+
+		<reply partnerLink="helloText" portType="tns:helloTextPT"
+			operation="setHelloText" variable="helloWord">
+		</reply>
+
+		<reply partnerLink="hello" portType="tns:helloPT"
+			operation="sayHello" variable="output">
+		</reply>
+	</sequence>
+</process>

Added: trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/hello2.wsdl (764 => 765)


--- trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/hello2.wsdl	2007-09-21 09:40:45 UTC (rev 764)
+++ trunk/OrchestraPVM/tests/functionnal/src/main/java/org/ow2/orchestra/tests/functionnal/ws/axis/hello2/hello2.wsdl	2007-09-21 12:30:13 UTC (rev 765)
@@ -0,0 +1,89 @@
+<definitions name="hello"
+	targetNamespace="http://orchestra.ow2.org/demos/hello2"
+	xmlns:tns="http://orchestra.ow2.org/demos/hello2"
+	xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+	xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+
+	<plnk:partnerLinkType name="helloPLT">
+		<plnk:role name="hello" portType="tns:helloPT" />
+	</plnk:partnerLinkType>
+
+	<plnk:partnerLinkType name="helloTextPLT">
+		<plnk:role name="set" portType="tns:helloTextPT" />
+	</plnk:partnerLinkType>
+
+	<types>
+
+	</types>
+
+
+	<message name="helloSetText">
+		<part name="word" type="xsd:string" />
+	</message>
+
+	<message name="helloNameRequest">
+		<part name="name" type="xsd:string" />
+	</message>
+
+	<message name="helloNameResponse">
+		<part name="result" type="xsd:string" />
+	</message>
+
+	<portType name="helloTextPT">
+		<operation name="setHelloText">
+			<input message="tns:helloSetText" />
+			<output message="tns:helloSetText" />
+		</operation>
+	</portType>
+
+	<portType name="helloPT">
+		<operation name="sayHello">
+			<input message="tns:helloNameRequest" />
+			<output message="tns:helloNameResponse" />
+		</operation>
+	</portType>
+
+	<binding name="helloPTSOAPBinding" type="tns:helloPT">
+		<soap:binding style="document"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+		<operation name="sayHello">
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+		</operation>
+	</binding>
+
+	<binding name="helloTextPTSOAPBinding" type="tns:helloTextPT">
+		<soap:binding style="document"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+		<operation name="setHelloText">
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+		</operation>
+	</binding>
+
+	<service name="helloServiceBP">
+		<port name="helloPT" binding="tns:helloPTSOAPBinding">
+			<soap:address
+				location="http://localhost:8080/orchestra/services/helloPT" />
+		</port>
+	</service>
+
+	<service name="helloTextServiceBP">
+		<port name="helloTextPT" binding="tns:helloTextPTSOAPBinding">
+			<soap:address
+				location="http://localhost:8080/orchestra/services/helloTextPT" />
+		</port>
+	</service>
+
+</definitions>


<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.