You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2011/03/10 14:14:17 UTC

svn commit: r1080209 - /tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldWSDLMergedTestCase.java

Author: slaws
Date: Thu Mar 10 13:14:17 2011
New Revision: 1080209

URL: http://svn.apache.org/viewvc?rev=1080209&view=rev
Log:
Extend test to prove that node which fires up ws binding can be stopped/started repeatedly

Modified:
    tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldWSDLMergedTestCase.java

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldWSDLMergedTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldWSDLMergedTestCase.java?rev=1080209&r1=1080208&r2=1080209&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldWSDLMergedTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldWSDLMergedTestCase.java Thu Mar 10 13:14:17 2011
@@ -29,16 +29,22 @@ import org.apache.axiom.om.OMText;
 import org.apache.tuscany.sca.node.Contribution;
 import org.apache.tuscany.sca.node.Node;
 import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+import org.junit.Ignore;
 
 public class HelloWorldWSDLMergedTestCase extends TestCase {
 
-    private Node node;
+    private NodeFactory nodeFactory;
+    private NodeImpl node;
     private HelloWorldOM helloWorld;
 
     @Override
     protected void setUp() throws Exception {
         String contribution = "target/classes";
-        node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/helloworld-om-merged.composite", new Contribution("test", contribution));
+        nodeFactory = NodeFactory.newInstance();
+        // have to set this to stop the node factory killing itself when we stop and re-start the node
+        nodeFactory.setAutoDestroy(false);
+        node = (NodeImpl)nodeFactory.createNode("org/apache/tuscany/sca/binding/ws/axis2/helloworld-om-merged.composite", new Contribution("test", contribution));
         node.start();
         helloWorld = node.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent");
     }
@@ -52,7 +58,26 @@ public class HelloWorldWSDLMergedTestCas
         OMElement responseOM = helloWorld.getGreetings(requestOM);
         OMElement child = (OMElement)responseOM.getFirstElement();
         Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
-    }    
+    }  
+    
+    @Ignore
+    public void testHelloWorldRepeating() throws Exception {
+        for (int i = 0; i < 2; i++){
+            OMFactory fac = OMAbstractFactory.getOMFactory();
+            OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
+            OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
+            requestOM.addChild(parmE);
+            parmE.addChild(fac.createOMText("petra"));
+            OMElement responseOM = helloWorld.getGreetings(requestOM);
+            OMElement child = (OMElement)responseOM.getFirstElement();
+            Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());            
+            
+            node.stop(); 
+            node.start();
+            
+            helloWorld = node.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent");
+        }
+    }
     
     @Override
     protected void tearDown() throws Exception {