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/10/17 08:35:37 UTC

svn commit: r464827 [5/6] - in /webservices/sandesha/trunk/java: interop/src/org/apache/sandesha2/interop/rm1_1_clients/ samples/src/sandesha2/samples/userguide/ src/org/apache/sandesha2/transport/ test/src/org/apache/sandesha2/ test/src/org/apache/san...

Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressableEchoTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressableEchoTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressableEchoTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressableEchoTest.java Mon Oct 16 23:35:33 2006
@@ -1,308 +1,315 @@
-package org.apache.sandesha2.scenarios;
-
-import java.io.File;
-import java.util.ArrayList;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.SandeshaTestCase;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-public class AddressableEchoTest extends SandeshaTestCase {
-
-	SimpleHTTPServer httpServer = null;
-	
-	private final static String applicationNamespaceName = "http://tempuri.org/"; 
-	private final static String echoString = "echoString";
-	private final static String Text = "Text";
-	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
-	int serverPort = DEFAULT_SERVER_TEST_PORT;
-	private Log log = LogFactory.getLog(getClass());
-	
-	public AddressableEchoTest () {
-		super ("AddressableEchoTest");
-	}
-	
-	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 + "server_axis2.xml";
-
-
-		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-		String serverPortStr = getTestProperty("test.server.port");
-		if (serverPortStr!=null) {
-		
-			try {
-				serverPort = Integer.parseInt(serverPortStr);
-			} catch (NumberFormatException e) {
-				log.error(e);
-			}
-		}
-		
-		httpServer = new SimpleHTTPServer (configContext,serverPort);
-		httpServer.start();
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void tearDown () throws SandeshaException {
-		if (httpServer!=null)
-			httpServer.stop();
-		
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void testAsyncEcho () throws AxisFault, InterruptedException {
-	
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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);
-
-		Options clientOptions = new Options ();
-
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		
-		String sequenceKey = SandeshaUtil.getUUID();
-		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-		
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		
-		String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
-		clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		
-		serviceClient.setOptions(clientOptions);
-		//serviceClient.
-		
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		clientOptions.setUseSeparateListener(true);
-		
-		serviceClient.setOptions(clientOptions);
-		
-		TestCallback callback1 = new TestCallback ("Callback 1");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
-		
-		TestCallback callback2 = new TestCallback ("Callback 2");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo2",sequenceKey),callback2);
-		
-		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		TestCallback callback3 = new TestCallback ("Callback 3");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo3",sequenceKey),callback3);
-
-        
-        Thread.sleep(15000);
-		
-        //assertions for the out sequence.
-		SequenceReport outgoingSequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertEquals (outgoingSequenceReport.getCompletedMessages().size(),3);
-		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(2)));
-		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(3)));
-		assertEquals(outgoingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(outgoingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-		
-		ArrayList incomingReports = SandeshaClient.getIncomingSequenceReports(configContext);
-		assertEquals(incomingReports.size(),1);
-		SequenceReport incomingSequenceReport = (SequenceReport) incomingReports.get(0);
-		assertEquals (incomingSequenceReport.getCompletedMessages().size(),3);
-		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(2)));
-		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(3)));
-		assertEquals(incomingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(incomingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_IN);
-		
-		assertTrue(callback1.isComplete());
-		assertEquals(callback1.getResult(),"echo1");
-		
-		assertTrue(callback2.isComplete());
-		assertEquals(callback2.getResult(),"echo1echo2");
-		
-		assertTrue(callback3.isComplete());
-		assertEquals(callback3.getResult(),"echo1echo2echo3");
-		
-		serviceClient.finalizeInvoke();
-	}
-	
-	public void testAsyncEchoWithOffer () throws AxisFault, InterruptedException {
-		
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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);
-
-		Options clientOptions = new Options ();
-
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		
-		String sequenceKey = SandeshaUtil.getUUID();
-		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-		
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		
-		String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
-		clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		
-		String offeredSequeiceId = SandeshaUtil.getUUID();
-		clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequeiceId);
-		
-		serviceClient.setOptions(clientOptions);
-		//serviceClient.
-		
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		clientOptions.setUseSeparateListener(true);
-		
-		serviceClient.setOptions(clientOptions);
-		
-		
-		TestCallback callback1 = new TestCallback ("Callback 1");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
-		
-		TestCallback callback2 = new TestCallback ("Callback 2");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo2",sequenceKey),callback2);
-		
-		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		TestCallback callback3 = new TestCallback ("Callback 3");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo3",sequenceKey),callback3);
-
-        
-        Thread.sleep(15000);
-		
-        //assertions for the out sequence.
-        //assertions for the out sequence.
-		SequenceReport outgoingSequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertEquals (outgoingSequenceReport.getCompletedMessages().size(),3);
-		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(2)));
-		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(3)));
-		assertEquals(outgoingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(outgoingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-		
-		SequenceReport incomingSequenceReport = SandeshaClient.getIncomingSequenceReport(offeredSequeiceId,configContext);
-		assertEquals (incomingSequenceReport.getCompletedMessages().size(),3);
-		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(2)));
-		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(3)));
-		assertEquals(incomingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(incomingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_IN);
-		
-		assertTrue(callback1.isComplete());
-		assertEquals(callback1.getResult(),"echo1");
-		
-		assertTrue(callback2.isComplete());
-		assertEquals(callback2.getResult(),"echo1echo2");
-		
-		assertTrue(callback3.isComplete());
-		assertEquals(callback3.getResult(),"echo1echo2echo3");
-		
-		serviceClient.finalizeInvoke();
-	}
-	
-	private static OMElement getEchoOMBlock(String text, String sequenceKey) {
-		OMFactory fac = OMAbstractFactory.getOMFactory();
-		OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
-		OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
-		OMElement textElem = fac.createOMElement(Text,applicationNamespace);
-		OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
-		
-		textElem.setText(text);
-		sequenceElem.setText(sequenceKey);
-		echoStringElement.addChild(textElem);
-		echoStringElement.addChild(sequenceElem);
-		
-		return echoStringElement;
-	}
-	
-	class TestCallback extends Callback {
-
-		String name = null;
-		boolean completed = false;
-		boolean errorRported = false;
-		String resultStr;
-		
-		public boolean isCompleted() {
-			return completed;
-		}
-
-		public boolean isErrorRported() {
-			return errorRported;
-		}
-
-		public String getResult () {
-			return resultStr;
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
-			if (echoStringResponseElem==null) { 
-				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
-				return;
-			}
-			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			if (echoStringReturnElem==null) { 
-				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
-				return;
-			}
-			
-			String resultStr = echoStringReturnElem.getText();
-			this.resultStr = resultStr;
-			completed = true;
-		}
-
-		public void onError (Exception e) {
-			e.printStackTrace();
-			errorRported = true;
-		}
-	}
-
-}
+package org.apache.sandesha2.scenarios;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SandeshaTestCase;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class AddressableEchoTest extends SandeshaTestCase {
+
+	SimpleHTTPServer httpServer = null;
+	
+	private final static String applicationNamespaceName = "http://tempuri.org/"; 
+	private final static String echoString = "echoString";
+	private final static String Text = "Text";
+	private final static String Sequence = "Sequence";
+	private final static String echoStringResponse = "echoStringResponse";
+	private final static String EchoStringReturn = "EchoStringReturn";
+	int serverPort = DEFAULT_SERVER_TEST_PORT;
+	private Log log = LogFactory.getLog(getClass());
+	
+	public AddressableEchoTest () {
+		super ("AddressableEchoTest");
+	}
+	
+	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 + "server_axis2.xml";
+
+
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		String serverPortStr = getTestProperty("test.server.port");
+		if (serverPortStr!=null) {
+		
+			try {
+				serverPort = Integer.parseInt(serverPortStr);
+			} catch (NumberFormatException e) {
+				log.error(e);
+			}
+		}
+		
+		httpServer = new SimpleHTTPServer (configContext,serverPort);
+		httpServer.start();
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void tearDown () throws SandeshaException {
+		if (httpServer!=null)
+			httpServer.stop();
+		
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void testAsyncEcho () throws AxisFault, InterruptedException {
+	
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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);
+
+		Options clientOptions = new Options ();
+
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = SandeshaUtil.getUUID();
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		
+		String acksTo = null;//serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+		clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		
+		serviceClient.setOptions(clientOptions);
+		//serviceClient.
+		
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		clientOptions.setUseSeparateListener(true);
+		
+		clientOptions.setAction("urn:wsrm:EchoString");
+		
+		serviceClient.setOptions(clientOptions);
+		
+		TestCallback callback1 = new TestCallback ("Callback 1");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
+		
+		TestCallback callback2 = new TestCallback ("Callback 2");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo2",sequenceKey),callback2);
+		
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		TestCallback callback3 = new TestCallback ("Callback 3");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo3",sequenceKey),callback3);
+		
+        Thread.sleep(15000);
+		
+        //assertions for the out sequence.
+		SequenceReport outgoingSequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertEquals (outgoingSequenceReport.getCompletedMessages().size(),3);
+		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(2)));
+		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(3)));
+		assertEquals(outgoingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(outgoingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+		
+		ArrayList incomingReports = SandeshaClient.getIncomingSequenceReports(configContext);
+		assertEquals(incomingReports.size(),1);
+		SequenceReport incomingSequenceReport = (SequenceReport) incomingReports.get(0);
+		assertEquals (incomingSequenceReport.getCompletedMessages().size(),3);
+		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(2)));
+		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(3)));
+		assertEquals(incomingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(incomingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_IN);
+//		
+		assertTrue(callback1.isComplete());
+		System.out.println(callback2.getResult());
+		assertNotNull (callback1.getResult());
+		
+		assertTrue(callback2.isComplete());
+		System.out.println(callback2.getResult());
+		assertNotNull (callback2.getResult());
+		
+		assertTrue(callback3.isComplete());
+		assertNotNull (callback3.getResult());
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+	public void testAsyncEchoWithOffer () throws AxisFault, InterruptedException {
+		
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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);
+
+		Options clientOptions = new Options ();
+
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = SandeshaUtil.getUUID();
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		
+		String acksTo = null;//serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+		clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		
+		String offeredSequeiceId = SandeshaUtil.getUUID();
+		clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequeiceId);
+		
+		serviceClient.setOptions(clientOptions);
+		//serviceClient.
+		
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		clientOptions.setUseSeparateListener(true);
+		
+		clientOptions.setAction("urn:wsrm:EchoString");
+		
+		serviceClient.setOptions(clientOptions);
+		
+		
+		TestCallback callback1 = new TestCallback ("Callback 1");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
+		
+		TestCallback callback2 = new TestCallback ("Callback 2");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo2",sequenceKey),callback2);
+		
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		TestCallback callback3 = new TestCallback ("Callback 3");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo3",sequenceKey),callback3);
+
+        
+        Thread.sleep(15000);
+		
+        //assertions for the out sequence.
+        //assertions for the out sequence.
+		SequenceReport outgoingSequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertEquals (outgoingSequenceReport.getCompletedMessages().size(),3);
+		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(2)));
+		assertTrue(outgoingSequenceReport.getCompletedMessages().contains(new Long(3)));
+		assertEquals(outgoingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(outgoingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+		
+		SequenceReport incomingSequenceReport = SandeshaClient.getIncomingSequenceReport(offeredSequeiceId,configContext);
+		assertEquals (incomingSequenceReport.getCompletedMessages().size(),3);
+		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(2)));
+		assertTrue(incomingSequenceReport.getCompletedMessages().contains(new Long(3)));
+		assertEquals(incomingSequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(incomingSequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_IN);
+		
+		assertTrue(callback1.isComplete());
+		assertNotNull (callback1.getResult(),"echo1");
+		
+		assertTrue(callback2.isComplete());
+		assertNotNull (callback2.getResult(),"echo1echo2");
+		
+		assertTrue(callback3.isComplete());
+		assertNotNull (callback3.getResult(),"echo1echo2echo3");
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+	private static OMElement getEchoOMBlock(String text, String sequenceKey) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+		OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
+		OMElement textElem = fac.createOMElement(Text,applicationNamespace);
+		OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
+		
+		textElem.setText(text);
+		sequenceElem.setText(sequenceKey);
+		echoStringElement.addChild(textElem);
+		echoStringElement.addChild(sequenceElem);
+		
+		return echoStringElement;
+	}
+	
+	class TestCallback extends Callback {
+
+		String name = null;
+		boolean completed = false;
+		boolean errorRported = false;
+		String resultStr;
+		
+		public boolean isCompleted() {
+			return completed;
+		}
+
+		public boolean isErrorRported() {
+			return errorRported;
+		}
+
+		public String getResult () {
+			return resultStr;
+		}
+		
+		public TestCallback (String name) {
+			this.name = name;
+		}
+		
+		public void onComplete(AsyncResult result) {
+			//System.out.println("On Complete Called for " + text);
+			SOAPBody body = result.getResponseEnvelope().getBody();
+			
+			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
+			if (echoStringResponseElem==null) { 
+				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
+				return;
+			}
+			
+			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+			if (echoStringReturnElem==null) { 
+				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
+				return;
+			}
+			
+			String resultStr = echoStringReturnElem.getText();
+			this.resultStr = resultStr;
+			completed = true;
+		}
+
+		public void onError (Exception e) {
+			e.printStackTrace();
+			errorRported = true;
+		}
+	}
+
+}

Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressablePingTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressablePingTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressablePingTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AddressablePingTest.java Mon Oct 16 23:35:33 2006
@@ -1,156 +1,157 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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 org.apache.sandesha2.scenarios;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.SandeshaTestCase;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class AddressablePingTest extends SandeshaTestCase {
-
-	SimpleHTTPServer httpServer = null;
-	
-	private final String applicationNamespaceName = "http://tempuri.org/"; 
-	private final String ping = "ping";
-	private final String Text = "Text";
-	int serverPort = DEFAULT_SERVER_TEST_PORT;
-	private Log log = LogFactory.getLog(getClass());
-	
-	public AddressablePingTest () {
-		super ("AddressablePingTest");
-	}
-	
-	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 + "server_axis2.xml";
-
-
-		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-		String serverPortStr = getTestProperty("test.server.port");
-		if (serverPortStr!=null) {
-		
-			try {
-				serverPort = Integer.parseInt(serverPortStr);
-			} catch (NumberFormatException e) {
-				log.error(e);
-			}
-		}
-		
-		httpServer = new SimpleHTTPServer (configContext,serverPort);
-		httpServer.start();
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void tearDown () throws SandeshaException {
-		if (httpServer!=null)
-			httpServer.stop();
-		
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void testAsyncPing () throws AxisFault,IOException {
-		
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-		
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		
-		String sequenceKey = "sequence2";
-		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-		
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		
-		String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
-		clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
-		//serviceClient.
-		serviceClient.setOptions(clientOptions);
-				
-		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		serviceClient.fireAndForget(getPingOMBlock("ping2"));
-		
-		try {
-			Thread.sleep(10000);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		
-		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-		
-		serviceClient.finalizeInvoke();
-	}
-	
-	private OMElement getPingOMBlock(String text) {
-		OMFactory fac = OMAbstractFactory.getOMFactory();
-		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 pingElem;
-	}
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.sandesha2.scenarios;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SandeshaTestCase;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class AddressablePingTest extends SandeshaTestCase {
+
+	SimpleHTTPServer httpServer = null;
+	
+	private final String applicationNamespaceName = "http://tempuri.org/"; 
+	private final String ping = "ping";
+	private final String Text = "Text";
+	int serverPort = DEFAULT_SERVER_TEST_PORT;
+	private Log log = LogFactory.getLog(getClass());
+	
+	public AddressablePingTest () {
+		super ("AddressablePingTest");
+	}
+	
+	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 + "server_axis2.xml";
+
+
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		String serverPortStr = getTestProperty("test.server.port");
+		if (serverPortStr!=null) {
+		
+			try {
+				serverPort = Integer.parseInt(serverPortStr);
+			} catch (NumberFormatException e) {
+				log.error(e);
+			}
+		}
+		
+		httpServer = new SimpleHTTPServer (configContext,serverPort);
+		httpServer.start();
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void tearDown () throws SandeshaException {
+		if (httpServer!=null)
+			httpServer.stop();
+		
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void testAsyncPing () throws AxisFault,IOException {
+		
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = "sequence2";
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		
+		String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+		clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+		//serviceClient.
+		serviceClient.setOptions(clientOptions);
+				
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		serviceClient.fireAndForget(getPingOMBlock("ping2"));
+		
+		try {
+			Thread.sleep(10000);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		
+		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+	private OMElement getPingOMBlock(String text) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		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 pingElem;
+	}
+
+}

Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousAckEchoTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousAckEchoTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousAckEchoTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousAckEchoTest.java Mon Oct 16 23:35:33 2006
@@ -1,198 +1,199 @@
-package org.apache.sandesha2.scenarios;
-
-import java.io.File;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.SandeshaTestCase;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-public class AnonymousAckEchoTest extends SandeshaTestCase {
-
-	SimpleHTTPServer httpServer = null;
-	
-	private final static String applicationNamespaceName = "http://tempuri.org/"; 
-	private final static String echoString = "echoString";
-	private final static String Text = "Text";
-	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
-	int serverPort = DEFAULT_SERVER_TEST_PORT;
-	private Log log = LogFactory.getLog(getClass());
-	
-	public AnonymousAckEchoTest () {
-		super ("AnonymousAckEchoTest");
-	}
-	
-	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 + "server_axis2.xml";
-
-
-		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-		String serverPortStr = getTestProperty("test.server.port");
-		if (serverPortStr!=null) {
-		
-			try {
-				serverPort = Integer.parseInt(serverPortStr);
-			} catch (NumberFormatException e) {
-				log.error(e);
-			}
-		}
-		
-		httpServer = new SimpleHTTPServer (configContext,serverPort);
-		httpServer.start();
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void tearDown () throws SandeshaException {
-		if (httpServer!=null)
-			httpServer.stop();
-		
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void testSyncEcho () throws AxisFault, InterruptedException {
-
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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);
-
-		Options clientOptions = new Options ();
-
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		
-		String sequenceKey = SandeshaUtil.getUUID();
-		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		serviceClient.setOptions(clientOptions);
-		//serviceClient.
-		
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		clientOptions.setUseSeparateListener(true);
-		
-		serviceClient.setOptions(clientOptions);
-
-		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		TestCallback callback1 = new TestCallback ("Callback 1");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
-		
-        
-        Thread.sleep(10000);
-		
-        //assertions for the out sequence.
-		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-		
-		assertEquals(callback1.getResult(),"echo1");
-		
-		serviceClient.finalizeInvoke();
-	}
-	
-	private static OMElement getEchoOMBlock(String text, String sequenceKey) {
-		OMFactory fac = OMAbstractFactory.getOMFactory();
-		OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
-		OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
-		OMElement textElem = fac.createOMElement(Text,applicationNamespace);
-		OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
-		
-		textElem.setText(text);
-		sequenceElem.setText(sequenceKey);
-		echoStringElement.addChild(textElem);
-		echoStringElement.addChild(sequenceElem);
-		
-		return echoStringElement;
-	}
-	
-	class TestCallback extends Callback {
-
-		String name = null;
-		boolean completed = false;
-		boolean errorRported = false;
-		String resultStr;
-		
-		public boolean isCompleted() {
-			return completed;
-		}
-
-		public boolean isErrorRported() {
-			return errorRported;
-		}
-
-		public String getResult () {
-			return resultStr;
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
-			if (echoStringResponseElem==null) { 
-				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
-				return;
-			}
-			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			if (echoStringReturnElem==null) { 
-				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
-				return;
-			}
-			
-			String resultStr = echoStringReturnElem.getText();
-			this.resultStr = resultStr;
-			completed = true;
-		}
-
-		public void onError (Exception e) {
-			e.printStackTrace();
-			errorRported = true;
-		}
-	}
-
-}
+package org.apache.sandesha2.scenarios;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SandeshaTestCase;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class AnonymousAckEchoTest extends SandeshaTestCase {
+
+	SimpleHTTPServer httpServer = null;
+	
+	private final static String applicationNamespaceName = "http://tempuri.org/"; 
+	private final static String echoString = "echoString";
+	private final static String Text = "Text";
+	private final static String Sequence = "Sequence";
+	private final static String echoStringResponse = "echoStringResponse";
+	private final static String EchoStringReturn = "EchoStringReturn";
+	int serverPort = DEFAULT_SERVER_TEST_PORT;
+	private Log log = LogFactory.getLog(getClass());
+	
+	public AnonymousAckEchoTest () {
+		super ("AnonymousAckEchoTest");
+	}
+	
+	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 + "server_axis2.xml";
+
+
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		String serverPortStr = getTestProperty("test.server.port");
+		if (serverPortStr!=null) {
+		
+			try {
+				serverPort = Integer.parseInt(serverPortStr);
+			} catch (NumberFormatException e) {
+				log.error(e);
+			}
+		}
+		
+		httpServer = new SimpleHTTPServer (configContext,serverPort);
+		httpServer.start();
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void tearDown () throws SandeshaException {
+		if (httpServer!=null)
+			httpServer.stop();
+		
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void testSyncEcho () throws AxisFault, InterruptedException {
+
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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);
+
+		Options clientOptions = new Options ();
+
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = SandeshaUtil.getUUID();
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		serviceClient.setOptions(clientOptions);
+		//serviceClient.
+		
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		clientOptions.setUseSeparateListener(true);
+		
+		serviceClient.setOptions(clientOptions);
+
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		TestCallback callback1 = new TestCallback ("Callback 1");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
+		
+        
+        Thread.sleep(10000);
+		
+        //assertions for the out sequence.
+		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+		
+		assertEquals(callback1.getResult(),"echo1");
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+	private static OMElement getEchoOMBlock(String text, String sequenceKey) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+		OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
+		OMElement textElem = fac.createOMElement(Text,applicationNamespace);
+		OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
+		
+		textElem.setText(text);
+		sequenceElem.setText(sequenceKey);
+		echoStringElement.addChild(textElem);
+		echoStringElement.addChild(sequenceElem);
+		
+		return echoStringElement;
+	}
+	
+	class TestCallback extends Callback {
+
+		String name = null;
+		boolean completed = false;
+		boolean errorRported = false;
+		String resultStr;
+		
+		public boolean isCompleted() {
+			return completed;
+		}
+
+		public boolean isErrorRported() {
+			return errorRported;
+		}
+
+		public String getResult () {
+			return resultStr;
+		}
+		
+		public TestCallback (String name) {
+			this.name = name;
+		}
+		
+		public void onComplete(AsyncResult result) {
+			//System.out.println("On Complete Called for " + text);
+			SOAPBody body = result.getResponseEnvelope().getBody();
+			
+			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
+			if (echoStringResponseElem==null) { 
+				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
+				return;
+			}
+			
+			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+			if (echoStringReturnElem==null) { 
+				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
+				return;
+			}
+			
+			String resultStr = echoStringReturnElem.getText();
+			this.resultStr = resultStr;
+			completed = true;
+		}
+
+		public void onError (Exception e) {
+			e.printStackTrace();
+			errorRported = true;
+		}
+	}
+
+}

Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousPingTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousPingTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousPingTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousPingTest.java Mon Oct 16 23:35:33 2006
@@ -1,144 +1,146 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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 org.apache.sandesha2.scenarios;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.SandeshaTestCase;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class AnonymousPingTest extends SandeshaTestCase  {
-
-	SimpleHTTPServer httpServer = null;
-	private final String applicationNamespaceName = "http://tempuri.org/"; 
-	private final String ping = "ping";
-	private final String Text = "Text";
-
-	private Log log = LogFactory.getLog(getClass());
-	int serverPort = DEFAULT_SERVER_TEST_PORT;
-	
-	public AnonymousPingTest () {
-        super ("AnonymousPingTest");
-	}
-	
-	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 + "server_axis2.xml";
-
-		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-		String serverPortStr = getTestProperty("test.server.port");
-		if (serverPortStr!=null) {
-			try {
-				serverPort = Integer.parseInt(serverPortStr);
-			} catch (NumberFormatException e) {
-				log.error(e);
-			}
-		}
-		
-		httpServer = new SimpleHTTPServer (configContext,serverPort);
-		httpServer.start();
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void tearDown () throws SandeshaException {
-		if (httpServer!=null)
-			httpServer.stop();
-		
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void testSyncPing () throws AxisFault,InterruptedException  {
-		
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-		
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		
-		String sequenceKey = "sequence1";
-		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-		
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		//serviceClient.
-
-		serviceClient.setOptions(clientOptions);
-		
-		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		serviceClient.fireAndForget(getPingOMBlock("ping1"));
-		
-		Thread.sleep(10000);
-				
-		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
-		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
-		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-	
-		serviceClient.finalizeInvoke();
-	}
-	
-	private OMElement getPingOMBlock(String text) {
-		OMFactory fac = OMAbstractFactory.getOMFactory();
-		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 pingElem;
-	}
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.sandesha2.scenarios;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SandeshaTestCase;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class AnonymousPingTest extends SandeshaTestCase  {
+
+	SimpleHTTPServer httpServer = null;
+	private final String applicationNamespaceName = "http://tempuri.org/"; 
+	private final String ping = "ping";
+	private final String Text = "Text";
+
+	private Log log = LogFactory.getLog(getClass());
+	int serverPort = DEFAULT_SERVER_TEST_PORT;
+	
+	public AnonymousPingTest () {
+        super ("AnonymousPingTest");
+	}
+	
+	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 + "server_axis2.xml";
+
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		String serverPortStr = getTestProperty("test.server.port");
+		if (serverPortStr!=null) {
+			try {
+				serverPort = Integer.parseInt(serverPortStr);
+			} catch (NumberFormatException e) {
+				log.error(e);
+			}
+		}
+		
+		httpServer = new SimpleHTTPServer (configContext,serverPort);
+		httpServer.start();
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void tearDown () throws SandeshaException {
+		if (httpServer!=null)
+			httpServer.stop();
+		
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void testSyncPing () throws AxisFault,InterruptedException  {
+		
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = "sequence1";
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		//serviceClient.
+
+		serviceClient.setOptions(clientOptions);
+		
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		serviceClient.fireAndForget(getPingOMBlock("ping1"));
+		
+		Thread.sleep(10000);
+				
+		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
+		assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+		assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+	
+
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+	private OMElement getPingOMBlock(String text) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		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 pingElem;
+	}
+
+}

Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/OptionalReliabilityTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/OptionalReliabilityTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/OptionalReliabilityTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/OptionalReliabilityTest.java Mon Oct 16 23:35:33 2006
@@ -1,265 +1,268 @@
-package org.apache.sandesha2.scenarios;
-
-import java.io.File;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.SandeshaTestCase;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class OptionalReliabilityTest extends SandeshaTestCase {
-
-	SimpleHTTPServer httpServer = null;
-	
-	private final static String applicationNamespaceName = "http://tempuri.org/"; 
-	private final static String echoString = "echoString";
-	private final static String ping = "ping";
-	private final static String Text = "Text";
-	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
-	int serverPort = DEFAULT_SERVER_TEST_PORT;
-	private Log log = LogFactory.getLog(getClass());
-	
-	public OptionalReliabilityTest() {
-		super ("OptionalReliabilityTest");
-	}
-	
-	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 + "server_axis2.xml";
-
-
-		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-		String serverPortStr = getTestProperty("test.server.port");
-		if (serverPortStr!=null) {
-		
-			try {
-				serverPort = Integer.parseInt(serverPortStr);
-			} catch (NumberFormatException e) {
-				log.error(e);
-			}
-		}
-		
-		httpServer = new SimpleHTTPServer (configContext,serverPort);
-		httpServer.start();
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-	
-	public void tearDown () throws SandeshaException {
-		if (httpServer!=null)
-			httpServer.stop();
-		
-		try {
-			Thread.sleep(300);
-		} catch (InterruptedException e) {
-			throw new SandeshaException ("sleep interupted");
-		}
-	}
-
-	public void testPing () throws AxisFault, InterruptedException {
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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);
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-
-		Options clientOptions = new Options ();
-		clientOptions.setAction("ping");
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE, "true");
-		serviceClient.setOptions(clientOptions);
-		
-		serviceClient.fireAndForget(getPingOMBlock("echo1"));
-		
-    //assertions for the out sequence.
-		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertTrue(sequenceReport.getCompletedMessages().isEmpty());
-		
-		//assertions for the in sequence
-		List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
-		assertTrue(inboundReports.isEmpty());
-		
-		serviceClient.finalizeInvoke();
-	}
-
-	public void testSyncEcho () throws AxisFault, InterruptedException {
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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);
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-
-		Options clientOptions = new Options ();
-		clientOptions.setAction("echo");
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,"true");
-		serviceClient.setOptions(clientOptions);
-		
-		OMElement result = serviceClient.sendReceive(getEchoOMBlock("echo1", "sync"));
-		
-		// Check the response
-		String echoStr = checkEchoOMBlock(result);
-		assertEquals(echoStr, "echo1");
-		
-    //assertions for the out sequence.
-		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertTrue(sequenceReport.getCompletedMessages().isEmpty());
-		
-		//assertions for the in sequence
-		List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
-		assertTrue(inboundReports.isEmpty());
-		
-		serviceClient.finalizeInvoke();
-	}
-
-	public void testAsyncEcho () throws AxisFault, InterruptedException {
-		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-		
-		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);
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-
-		Options clientOptions = new Options ();
-		clientOptions.setAction("echo");
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-		clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,"true");
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		clientOptions.setUseSeparateListener(true);
-		serviceClient.setOptions(clientOptions);
-		
-		TestCallback callback1 = new TestCallback ("Callback 1");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1", "async"),callback1);
-
-		Thread.sleep(4000);
-		
-    //assertions for the out sequence.
-		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-		assertTrue(sequenceReport.getCompletedMessages().isEmpty());
-		
-		assertTrue(callback1.isComplete());
-		assertEquals(callback1.getResult(),"echo1");
-		
-		//assertions for the in sequence
-		List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
-		assertTrue(inboundReports.isEmpty());
-		
-		serviceClient.finalizeInvoke();
-	}
-	
-	private static OMElement getEchoOMBlock(String text, String appSeq) {
-		OMFactory fac = OMAbstractFactory.getOMFactory();
-		OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
-		OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
-		OMElement textElem = fac.createOMElement(Text,applicationNamespace);
-		OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
-		
-		textElem.setText(text);
-		sequenceElem.setText(appSeq);
-		echoStringElement.addChild(textElem);
-		echoStringElement.addChild(sequenceElem);
-		
-		return echoStringElement;
-	}
-
-	private static OMElement getPingOMBlock(String text) {
-		OMFactory fac = OMAbstractFactory.getOMFactory();
-		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 pingElem;
-	}
-
-	private static String checkEchoOMBlock(OMElement response) {
-		assertEquals(response.getNamespace().getName(), applicationNamespaceName);
-		assertEquals(response.getLocalName(), echoStringResponse);
-		
-		OMElement echoStringReturnElem = response.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-		assertNotNull(echoStringReturnElem);
-		
-		String resultStr = echoStringReturnElem.getText();
-
-		return resultStr;
-	}
-	
-	class TestCallback extends Callback {
-
-		String name = null;
-		boolean completed = false;
-		boolean errorRported = false;
-		String resultStr;
-		
-		public boolean isCompleted() {
-			return completed;
-		}
-
-		public boolean isErrorRported() {
-			return errorRported;
-		}
-
-		public String getResult () {
-			return resultStr;
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			this.resultStr = checkEchoOMBlock(body.getFirstElement());
-			completed = true;
-		}
-
-		public void onError (Exception e) {
-			e.printStackTrace();
-			errorRported = true;
-		}
-	}
-
-}
+package org.apache.sandesha2.scenarios;
+
+import java.io.File;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SandeshaTestCase;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class OptionalReliabilityTest extends SandeshaTestCase {
+
+	SimpleHTTPServer httpServer = null;
+	
+	private final static String applicationNamespaceName = "http://tempuri.org/"; 
+	private final static String echoString = "echoString";
+	private final static String ping = "ping";
+	private final static String Text = "Text";
+	private final static String Sequence = "Sequence";
+	private final static String echoStringResponse = "echoStringResponse";
+	private final static String EchoStringReturn = "EchoStringReturn";
+	int serverPort = DEFAULT_SERVER_TEST_PORT;
+	private Log log = LogFactory.getLog(getClass());
+	
+	public OptionalReliabilityTest() {
+		super ("OptionalReliabilityTest");
+	}
+	
+	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 + "server_axis2.xml";
+
+
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		String serverPortStr = getTestProperty("test.server.port");
+		if (serverPortStr!=null) {
+		
+			try {
+				serverPort = Integer.parseInt(serverPortStr);
+			} catch (NumberFormatException e) {
+				log.error(e);
+			}
+		}
+		
+		httpServer = new SimpleHTTPServer (configContext,serverPort);
+		httpServer.start();
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+	
+	public void tearDown () throws SandeshaException {
+		if (httpServer!=null)
+			httpServer.stop();
+		
+		try {
+			Thread.sleep(300);
+		} catch (InterruptedException e) {
+			throw new SandeshaException ("sleep interupted");
+		}
+	}
+
+	public void testPing () throws AxisFault, InterruptedException {
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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);
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+		Options clientOptions = new Options ();
+		clientOptions.setAction("ping");
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE, "true");
+		serviceClient.setOptions(clientOptions);
+		
+		serviceClient.fireAndForget(getPingOMBlock("echo1"));
+		
+    //assertions for the out sequence.
+		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertTrue(sequenceReport.getCompletedMessages().isEmpty());
+		
+		//assertions for the in sequence
+		List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
+		assertTrue(inboundReports.isEmpty());
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+
+	public void testSyncEcho () throws AxisFault, InterruptedException {
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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);
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+		Options clientOptions = new Options ();
+		clientOptions.setAction("echo");
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,"true");
+		serviceClient.setOptions(clientOptions);
+		
+		OMElement result = serviceClient.sendReceive(getEchoOMBlock("echo1", "sync"));
+		
+		// Check the response
+		String echoStr = checkEchoOMBlock(result);
+		assertEquals(echoStr, "echo1");
+		
+    //assertions for the out sequence.
+		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertTrue(sequenceReport.getCompletedMessages().isEmpty());
+		
+		//assertions for the in sequence
+		List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
+		assertTrue(inboundReports.isEmpty());
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+
+	public void testAsyncEcho () throws AxisFault, InterruptedException {
+		String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+		
+		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);
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+		Options clientOptions = new Options ();
+		clientOptions.setAction("echo");
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+		clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,"true");
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		clientOptions.setUseSeparateListener(true);
+		serviceClient.setOptions(clientOptions);
+		
+		TestCallback callback1 = new TestCallback ("Callback 1");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1", "async"),callback1);
+
+		Thread.sleep(4000);
+		
+    //assertions for the out sequence.
+		SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+		assertTrue(sequenceReport.getCompletedMessages().isEmpty());
+		
+		assertTrue(callback1.isComplete());
+		assertEquals(callback1.getResult(),"echo1");
+		
+		//assertions for the in sequence
+		List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
+		assertTrue(inboundReports.isEmpty());
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+	private static OMElement getEchoOMBlock(String text, String appSeq) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+		OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
+		OMElement textElem = fac.createOMElement(Text,applicationNamespace);
+		OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
+		
+		textElem.setText(text);
+		sequenceElem.setText(appSeq);
+		echoStringElement.addChild(textElem);
+		echoStringElement.addChild(sequenceElem);
+		
+		return echoStringElement;
+	}
+
+	private static OMElement getPingOMBlock(String text) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		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 pingElem;
+	}
+
+	private static String checkEchoOMBlock(OMElement response) {
+		assertEquals(response.getNamespace().getName(), applicationNamespaceName);
+		assertEquals(response.getLocalName(), echoStringResponse);
+		
+		OMElement echoStringReturnElem = response.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+		assertNotNull(echoStringReturnElem);
+		
+		String resultStr = echoStringReturnElem.getText();
+
+		return resultStr;
+	}
+	
+	class TestCallback extends Callback {
+
+		String name = null;
+		boolean completed = false;
+		boolean errorRported = false;
+		String resultStr;
+		
+		public boolean isCompleted() {
+			return completed;
+		}
+
+		public boolean isErrorRported() {
+			return errorRported;
+		}
+
+		public String getResult () {
+			return resultStr;
+		}
+		
+		public TestCallback (String name) {
+			this.name = name;
+		}
+		
+		public void onComplete(AsyncResult result) {
+			//System.out.println("On Complete Called for " + text);
+			SOAPBody body = result.getResponseEnvelope().getBody();
+			this.resultStr = checkEchoOMBlock(body.getFirstElement());
+			completed = true;
+		}
+
+		public void onError (Exception e) {
+			e.printStackTrace();
+			errorRported = true;
+		}
+	}
+
+}



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