You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2006/04/19 13:42:41 UTC

svn commit: r395221 - /webservices/sandesha/trunk/test/src/org/apache/sandesha2/SandeshaReportsTest.java

Author: chamikara
Date: Wed Apr 19 04:42:40 2006
New Revision: 395221

URL: http://svn.apache.org/viewcvs?rev=395221&view=rev
Log:
A new test method to test the clicent API

Modified:
    webservices/sandesha/trunk/test/src/org/apache/sandesha2/SandeshaReportsTest.java

Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/SandeshaReportsTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/SandeshaReportsTest.java?rev=395221&r1=395220&r2=395221&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/SandeshaReportsTest.java (original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/SandeshaReportsTest.java Wed Apr 19 04:42:40 2006
@@ -302,4 +302,77 @@
 		return pingElem;
 	}
 	
+	public void testSequenceTermination () throws AxisFault,InterruptedException {
+		
+		String to = "http://127.0.0.1:8060/axis2/services/RMInteropService";
+		String transportTo = "http://127.0.0.1:8060/axis2/services/RMInteropService";
+		
+		String repoPath = "target" + File.separator + "repos" + File.separator + "client";
+		String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_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.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey1 = "sequence1";
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey1);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		
+		serviceClient.setOptions(clientOptions);
+		
+		serviceClient.fireAndForget(getPingOMBlock("ping11"));		
+		serviceClient.fireAndForget(getPingOMBlock("ping12"));
+		
+		String sequenceKey2 = "sequence2";
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey2);
+		
+		serviceClient.fireAndForget(getPingOMBlock("ping21"));	
+		
+		SandeshaClient.terminateSequence(serviceClient,sequenceKey1);
+		
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		serviceClient.fireAndForget(getPingOMBlock("ping22"));	
+		try {
+			//waiting till the messages exchange finishes.
+			Thread.sleep(10000);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+		
+		
+		SandeshaReport rmReport = SandeshaClient.getSandeshaReport(configContext);
+		
+	 	SequenceReport sequence1Report = null;
+	 	SequenceReport sequence2Report = null;
+	 	
+	 	Iterator iterator = rmReport.getOutgoingSequenceList().iterator();
+	 	while (iterator.hasNext()) {
+	 		String sequenceID = (String) iterator.next();
+	 		
+	 		 String internalSequenceID = rmReport.getInternalSequenceIdOfOutSequence(sequenceID);
+	 		 
+	 		 if (internalSequenceID.indexOf(sequenceKey1)>=0) {
+	 			 sequence1Report = SandeshaClient.getOutgoingSequenceReport(to,sequenceKey1,configContext);
+	 		 } else if (internalSequenceID.indexOf(sequenceKey2)>=0){
+	 			 sequence2Report = SandeshaClient.getOutgoingSequenceReport(to,sequenceKey2,configContext);
+	 		 }
+	 	}
+	 	
+	 	assertNotNull(sequence1Report);
+	 	assertNotNull(sequence2Report);
+	 	
+	 	assertEquals(sequence1Report.getCompletedMessages().size(),2);
+	 	assertEquals(sequence2Report.getCompletedMessages().size(),2);
+	 	
+	 	assertEquals(sequence1Report.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+	 	assertEquals(sequence2Report.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);	
+	}
+	
 }



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