You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2006/02/28 03:29:28 UTC

svn commit: r381543 - in /webservices/sandesha/trunk/test/src/org/apache/sandesha2: ./ wsrm/

Author: chamikara
Date: Mon Feb 27 18:29:25 2006
New Revision: 381543

URL: http://svn.apache.org/viewcvs?rev=381543&view=rev
Log:
Corrections to test cases.

Modified:
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceResponseTest.java
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceTest.java
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceAcknowledgementTest.java
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceTest.java
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/TerminateSequenceTest.java

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/AddressablePingTest.java Mon Feb 27 18:29:25 2006
@@ -47,12 +47,14 @@
 
 	SimpleHTTPServer httpServer = null;
 	
+	private final String applicationNamespaceName = "http://tempuri.org/"; 
+	private final String Ping = "Ping";
+	private final String Text = "Text";
+	
 	public void setUp () throws AxisFault {
 		String repoPath = "target" + File.separator + "repos" + File.separator + "server";
 		String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "axis2.xml";
 		
-//		String repoPath = "target\\repos\\server";
-//		String axis2_xml = "target\\repos\\server\\axis2.xml";
 		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
 		
 		httpServer = new SimpleHTTPServer (configContext,8060);
@@ -72,68 +74,70 @@
 	
 	public void testAsyncPing () throws AxisFault{
 		
-//		String to = "http://127.0.0.1:8060/axis2/services/RMInteropService";
-//		String transportTo = "http://127.0.0.1:8060/axis2/services/RMInteropService";
-//		String acksToEPR = "http://127.0.0.1:6060/axis2/services/__ANONYMOUS_SERVICE__";
-//		
-//		String repoPath = "target" + File.separator + "repos" + File.separator + "server";
-//		String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "axis2.xml";
-//		
-//		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-//
-//		//clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-//		Options clientOptions = new Options ();
-//		clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
-//		clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-//		
-//	//	clientOptions.setr\
-//		clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean (true));
-//		clientOptions.setTo(new EndpointReference (to));
-//		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-//		
-//		String sequenceKey = "sequence2";
-//		clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,sequenceKey);
-//		clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
-//		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-//		
-//		ServiceClient serviceClient = new ServiceClient (configContext,null);
-//		//serviceClient.
-//		
-//		serviceClient.engageModule(new QName ("sandesha2"));
-//		serviceClient.setOptions(clientOptions);
-//		
-//		serviceClient.fireAndForget(getPingOMBlock("ping1"));
-//		serviceClient.fireAndForget(getPingOMBlock("ping2"));
-//		
-//		clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
-//		serviceClient.fireAndForget(getPingOMBlock("ping3"));
-//		
-//		try {
-//			//waiting till the messages exchange finishes.
-//			Thread.sleep(10000);
-//		} catch (InterruptedException e) {
-//			throw new SandeshaException ("sleep interupted");
-//		}
-//		
-//		SequenceReport sequenceReport = Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
-//		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
-//		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(2)));
-//		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(3)));
-//		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_COMPLETED);
-//		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+		String to = "http://127.0.0.1:8060/axis2/services/RMInteropService";
+		String transportTo = "http://127.0.0.1:8060/axis2/services/RMInteropService";
+		String acksToEPR = "http://127.0.0.1:6060/axis2/services/__ANONYMOUS_SERVICE__";
+		
+		String repoPath = "target" + File.separator + "repos" + File.separator + "server";
+		String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "axis2.xml";
+		
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		//clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		Options clientOptions = new Options ();
+		clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
+		clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		
+	//	clientOptions.setr\
+		clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean (true));
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = "sequence2";
+		clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,sequenceKey);
+		clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		//serviceClient.
+		
+		serviceClient.engageModule(new QName ("sandesha2"));
+		serviceClient.setOptions(clientOptions);
+		
+		serviceClient.fireAndForget(getPingOMBlock("ping1"));
+		serviceClient.fireAndForget(getPingOMBlock("ping2"));
+		
+		clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
+		serviceClient.fireAndForget(getPingOMBlock("ping3"));
+		
+		try {
+			//waiting till the messages exchange finishes.
+			Thread.sleep(10000);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+		
+		SequenceReport sequenceReport = Sandesha2ClientAPI.getOutgoingSequenceReport(to,sequenceKey,configContext);
+		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(2)));
+		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(3)));
+		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_COMPLETED);
+		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+		
+		serviceClient.finalizeInvoke();
 		
 	}
 	
 	private OMElement getPingOMBlock(String text) {
 		OMFactory fac = OMAbstractFactory.getOMFactory();
-		OMNamespace ns = fac.createOMNamespace("http://tempuri.apache.org",
-				"ns1");
-		OMElement pingElement = fac.createOMElement("ping", ns);
-		OMElement paramElement = fac.createOMElement("param1", ns);
-		pingElement.addChild(paramElement);
-		paramElement.setText(text);
+		OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+		OMElement pingElem = fac.createOMElement(Ping, namespace);
+		OMElement textElem = fac.createOMElement(Text, namespace);
+		
+		textElem.setText(text);
+		pingElem.addChild(textElem);
 
-		return pingElement;
+		return pingElem;
 	}
 
 }

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/AnonymousPingTest.java Mon Feb 27 18:29:25 2006
@@ -27,6 +27,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.engine.ListenerManager;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMElement;
 import org.apache.ws.commons.om.OMFactory;
@@ -45,16 +46,15 @@
 public class AnonymousPingTest extends TestCase{
 
 	SimpleHTTPServer httpServer = null;
+	private final String applicationNamespaceName = "http://tempuri.org/"; 
+	private final String Ping = "Ping";
+	private final String Text = "Text";
 	
 	public void setUp () throws AxisFault {
 		
 		String repoPath = "target" + File.separator + "repos" + File.separator + "server";
 		String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "axis2.xml";
-		
-		
-//		String repoPath = "target\\repos\\server";
-//		String axis2_xml = "target\\repos\\server\\axis2.xml";
-		
+			
 		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
 
 		
@@ -118,18 +118,19 @@
 		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_COMPLETED);
 		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
 		
+		serviceClient.finalizeInvoke();
 	}
 	
 	private OMElement getPingOMBlock(String text) {
 		OMFactory fac = OMAbstractFactory.getOMFactory();
-		OMNamespace ns = fac.createOMNamespace("http://tempuri.apache.org",
-				"ns1");
-		OMElement pingElement = fac.createOMElement("ping", ns);
-		OMElement paramElement = fac.createOMElement("param1", ns);
-		pingElement.addChild(paramElement);
-		paramElement.setText(text);
+		OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+		OMElement pingElem = fac.createOMElement(Ping, namespace);
+		OMElement textElem = fac.createOMElement(Text, namespace);
+		
+		textElem.setText(text);
+		pingElem.addChild(textElem);
 
-		return pingElement;
+		return pingElem;
 	}
 
 }

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceResponseTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceResponseTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceResponseTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceResponseTest.java Mon Feb 27 18:29:25 2006
@@ -1,5 +1,6 @@
 package org.apache.sandesha2.wsrm;
 
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SandeshaTestCase;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.ws.commons.soap.SOAPEnvelope;
@@ -27,7 +28,7 @@
 
     }
 
-    public void testFromOMElement() {
+    public void testFromOMElement() throws SandeshaException {
         CreateSequenceResponse res = new CreateSequenceResponse(factory,rmNamespace);
         SOAPEnvelope env = getSOAPEnvelope("", "CreateSequenceResponse.xml");
         res.fromOMElement(env.getBody());
@@ -42,7 +43,7 @@
 
     }
 
-    public void testToSOAPEnvelope() {
+    public void testToSOAPEnvelope()  throws SandeshaException {
         CreateSequenceResponse res = new CreateSequenceResponse(factory,rmNamespace);
 
         Identifier identifier = new Identifier(factory,rmNamespace);

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/CreateSequenceTest.java Mon Feb 27 18:29:25 2006
@@ -1,5 +1,6 @@
 package org.apache.sandesha2.wsrm;
 
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SandeshaTestCase;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.wsrm.*;
@@ -27,7 +28,7 @@
         super("CreateSequenceTest");
     }
 
-    public void testfromOMElement() {
+    public void testfromOMElement()  throws SandeshaException {
         CreateSequence createSequence = new CreateSequence(factory,rmNamespace);
         createSequence.fromOMElement(getSOAPEnvelope("", "CreateSequence.xml").getBody());
 
@@ -41,7 +42,7 @@
 
     }
 
-    public void testToSOAPEnvelope() {
+    public void testToSOAPEnvelope()  throws SandeshaException {
         CreateSequence createSequence = new CreateSequence(factory,rmNamespace);
 
         AcksTo acksTo = new AcksTo(factory,rmNamespace);

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceAcknowledgementTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceAcknowledgementTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceAcknowledgementTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceAcknowledgementTest.java Mon Feb 27 18:29:25 2006
@@ -1,5 +1,6 @@
 package org.apache.sandesha2.wsrm;
 
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SandeshaTestCase;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.ws.commons.soap.SOAPEnvelope;
@@ -26,7 +27,7 @@
         super("SequenceAcknowledgementTest");
     }
 
-    public void testFromOMElement() {
+    public void testFromOMElement()  throws SandeshaException {
         SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement(factory,rmNamespace);
         SOAPEnvelope env = getSOAPEnvelope("", "SequenceAcknowledgement.xml");
         sequenceAck.fromOMElement(env.getHeader());
@@ -63,7 +64,7 @@
 
     }
 
-    public void testToOMElement() {
+    public void testToOMElement()  throws SandeshaException {
         SequenceAcknowledgement seqAck = new SequenceAcknowledgement(factory,rmNamespace);
         Identifier identifier = new Identifier(factory,rmNamespace);
         identifier.setIndentifer("uuid:897ee740-1624-11da-a28e-b3b9c4e71445");

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/SequenceTest.java Mon Feb 27 18:29:25 2006
@@ -1,5 +1,6 @@
 package org.apache.sandesha2.wsrm;
 
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SandeshaTestCase;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.ws.commons.soap.SOAPEnvelope;
@@ -26,7 +27,7 @@
 
     }
 
-    public void testFromOMElement() {
+    public void testFromOMElement()  throws SandeshaException {
         SOAPEnvelope env = getSOAPEnvelope("", "Sequence.xml");
         Sequence sequence = new Sequence(factory,rmNamespace);
         sequence.fromOMElement(env.getHeader());
@@ -38,7 +39,7 @@
         assertEquals(1, msgNo.getMessageNumber());
     }
 
-    public void testToSOAPEnvelope() {
+    public void testToSOAPEnvelope()  throws SandeshaException {
         Sequence sequence = new Sequence(factory,rmNamespace);
 
         Identifier identifier = new Identifier(factory,rmNamespace);

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/TerminateSequenceTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/TerminateSequenceTest.java?rev=381543&r1=381542&r2=381543&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/TerminateSequenceTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/wsrm/TerminateSequenceTest.java Mon Feb 27 18:29:25 2006
@@ -1,5 +1,6 @@
 package org.apache.sandesha2.wsrm;
 
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SandeshaTestCase;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.ws.commons.soap.SOAPEnvelope;
@@ -25,7 +26,7 @@
         super("TerminateSequenceTest");
     }
 
-    public void testFromOMElement() {
+    public void testFromOMElement() throws SandeshaException {
         TerminateSequence terminateSequence =  new TerminateSequence(factory,rmNamespace);
         SOAPEnvelope env = getSOAPEnvelope("", "TerminateSequence.xml");
         terminateSequence.fromOMElement(env.getBody());
@@ -34,7 +35,7 @@
         assertEquals("uuid:59b0c910-1625-11da-bdfc-b09ed76a1f06", identifier.getIdentifier());
     }
 
-    public void testToSOAPEnvelope() {
+    public void testToSOAPEnvelope() throws SandeshaException {
         TerminateSequence terminateSequence = new TerminateSequence(factory,rmNamespace);
         Identifier identifier = new Identifier(factory,rmNamespace);
         identifier.setIndentifer("uuid:59b0c910-1625-11da-bdfc-b09ed76a1f06");



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org