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 di...@apache.org on 2007/08/09 02:58:01 UTC

svn commit: r564063 [12/16] - in /webservices/sandesha/trunk/java: ./ modules/client/ modules/core/ modules/core/src/main/java/org/apache/sandesha2/ modules/core/src/main/java/org/apache/sandesha2/client/ modules/core/src/main/java/org/apache/sandesha2...

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java Wed Aug  8 17:57:51 2007
@@ -1,113 +1,113 @@
-/*
- * 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 sandesha2.samples.userguide;
-
-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.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.sandesha2.client.SandeshaClientConstants;
-
-public class UserguideEchoClient {
-	
-	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";
-	private static String toEPR = "http://127.0.0.1:8070/axis2/services/RMSampleService";
-
-	private static String CLIENT_REPO_PATH = "Full path to the Client Repo folder";
-	
-	public static void main(String[] args) throws Exception {
-		
-		String axis2_xml = CLIENT_REPO_PATH + File.separator +"client_axis2.xml";
-        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);
-		ServiceClient serviceClient = new ServiceClient (configContext,null);	
-		
-		Options clientOptions = new Options ();
-		clientOptions.setTo(new EndpointReference (toEPR));
-		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-		clientOptions.setUseSeparateListener(true);
-		serviceClient.setOptions(clientOptions);
-
-		Callback callback1 = new TestCallback ("Callback 1");
-		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1","sequence1"),callback1);
-		Callback callback2 = new TestCallback ("Callback 2");
-		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2","sequence1"),callback2);
-
-		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		Callback callback3 = new TestCallback ("Callback 3");
-		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3","sequence1"),callback3);
-		
-        while (!callback3.isComplete()) {
-            Thread.sleep(1000);
-        }
-        
-        Thread.sleep(4000); 
-	}
-
-	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;
-	}
-
-	static class TestCallback extends Callback {
-
-		String name = null;
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			
-			String resultStr = echoStringReturnElem.getText();
-			System.out.println("Callback '" + name +  "' got result:" + resultStr);
-		}
-
-		public void onError (Exception e) {
-			System.out.println("Error reported for test call back");
-			e.printStackTrace();
-		}
-	}
-}
+/*
+ * 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 sandesha2.samples.userguide;
+
+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.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.sandesha2.client.SandeshaClientConstants;
+
+public class UserguideEchoClient {
+	
+	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";
+	private static String toEPR = "http://127.0.0.1:8070/axis2/services/RMSampleService";
+
+	private static String CLIENT_REPO_PATH = "Full path to the Client Repo folder";
+	
+	public static void main(String[] args) throws Exception {
+		
+		String axis2_xml = CLIENT_REPO_PATH + File.separator +"client_axis2.xml";
+        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);
+		ServiceClient serviceClient = new ServiceClient (configContext,null);	
+		
+		Options clientOptions = new Options ();
+		clientOptions.setTo(new EndpointReference (toEPR));
+		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+		clientOptions.setUseSeparateListener(true);
+		serviceClient.setOptions(clientOptions);
+
+		Callback callback1 = new TestCallback ("Callback 1");
+		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1","sequence1"),callback1);
+		Callback callback2 = new TestCallback ("Callback 2");
+		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2","sequence1"),callback2);
+
+		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+		Callback callback3 = new TestCallback ("Callback 3");
+		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3","sequence1"),callback3);
+		
+        while (!callback3.isComplete()) {
+            Thread.sleep(1000);
+        }
+        
+        Thread.sleep(4000); 
+	}
+
+	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;
+	}
+
+	static class TestCallback extends Callback {
+
+		String name = null;
+		public TestCallback (String name) {
+			this.name = name;
+		}
+		
+		public void onComplete(AsyncResult result) {
+			SOAPBody body = result.getResponseEnvelope().getBody();
+			
+			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));			
+			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+			
+			String resultStr = echoStringReturnElem.getText();
+			System.out.println("Callback '" + name +  "' got result:" + resultStr);
+		}
+
+		public void onError (Exception e) {
+			System.out.println("Error reported for test call back");
+			e.printStackTrace();
+		}
+	}
+}

Propchange: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguidePingClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/resources/userguide/services.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/resources/userguide/services.xml?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/resources/userguide/services.xml (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/resources/userguide/services.xml Wed Aug  8 17:57:51 2007
@@ -1,30 +1,30 @@
-<service name="RMSampleService">
-   <parameter name="ServiceClass" locked="xsd:false">sandesha2.samples.userguide.RMSampleService</parameter>
-
-
-
-    <description>
-        The userguide Sample service.
-    </description>
-
-    <module ref="sandesha2" />
-       
-    <operation name="ping" mep="http://www.w3.org/2006/01/wsdl/in-only">  
-        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
-        <actionMapping>urn:wsrm:Ping</actionMapping>
-    </operation>
-    
-    <operation name="MTOMPing" mep="http://www.w3.org/2006/01/wsdl/in-only">  
-        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
-    </operation>
-    
-    <operation name="echoString">
-        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
-        <actionMapping>urn:wsrm:EchoString</actionMapping>
-        <outputActionMapping>urn:wsrm:EchoStringResponse</outputActionMapping>
-    </operation>
+<service name="RMSampleService">
+   <parameter name="ServiceClass" locked="xsd:false">sandesha2.samples.userguide.RMSampleService</parameter>
+
+
+
+    <description>
+        The userguide Sample service.
+    </description>
+
+    <module ref="sandesha2" />
+       
+    <operation name="ping" mep="http://www.w3.org/2006/01/wsdl/in-only">  
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
+        <actionMapping>urn:wsrm:Ping</actionMapping>
+    </operation>
+    
+    <operation name="MTOMPing" mep="http://www.w3.org/2006/01/wsdl/in-only">  
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
+    </operation>
+    
+    <operation name="echoString">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
+        <actionMapping>urn:wsrm:EchoString</actionMapping>
+        <outputActionMapping>urn:wsrm:EchoStringResponse</outputActionMapping>
+    </operation>
        
-   <!--     
+   <!--     
    <supported-policy-namespaces namespaces="http://ws.apache.org/sandesha2/policy" />
 
 	<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
@@ -39,8 +39,8 @@
 		</sandesha2:RMAssertion>
 		
 	</wsp:Policy>
-	 -->
-    
-    
-</service>
-
+	 -->
+    
+    
+</service>
+

Propchange: webservices/sandesha/trunk/java/modules/samples/src/main/resources/userguide/services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/tests/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/MessageContextPropertyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/MessageRetransmissionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/PropertyLoaderTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/PropertyLoaderTest.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/PropertyLoaderTest.java (original)
+++ webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/PropertyLoaderTest.java Wed Aug  8 17:57:51 2007
@@ -1,84 +1,84 @@
-/*
- * 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;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.sandesha2.policy.SandeshaPolicyBean;
-import org.apache.sandesha2.util.PropertyManager;
-
-public class PropertyLoaderTest extends TestCase {
-	
-	SandeshaPolicyBean propertyBean = null;
-	
-	public void setUp () {
-		String fileName =  "target" + File.separator + "test-classes" + File.separator + "sandesha2.properties";
-		File file= new File (fileName);
-		if (!file.exists()) {
-			fail("sandesha2.properties file was not found");
-		}
-		
-		try {
-			InputStream in = new FileInputStream (file);
-			propertyBean = PropertyManager.loadPropertiesFromPropertyFile(in);
-			in.close();
-		} catch (Exception e) {
-			fail (e.getMessage());
-		}
-		
-	}
-	
-	public void testRetransmissionInterval () throws SandeshaException {
-		long value = propertyBean.getRetransmissionInterval();
-		assertEquals(value,20000);
-	}
-	
-	public void testExponentialBackOff () throws SandeshaException {
-		boolean value = propertyBean.isExponentialBackoff();
-		assertEquals(value,false);
-	}
-	
-	public void testAcknowledgementInterval () throws SandeshaException {
-		long value = propertyBean.getAcknowledgementInterval();
-		assertEquals(value,8000);
-	}
-	
-	public void testInactivityTImeout () {
-		long value = propertyBean.getInactivityTimeoutInterval();
-		assertEquals(value,(60*60*3*1000));
-	}
-	
-	public void testStorageManager () {
-		String storageMgr = propertyBean.getInMemoryStorageManagerClass();
-		assertEquals(storageMgr,"org.apache.sandesha2.storage.inmemory.InMemoryStorageManager1");
-	}
-
-	public void testSecurityManager() {
-		String secMgr = propertyBean.getSecurityManagerClass();
-		assertEquals(secMgr,"org.apache.sandesha2.security.SecurityManager1");
-	}
-	
-	public void testSequenceRemovalTimeout() {
-		long value = propertyBean.getSequenceRemovalTimeoutInterval();
-		assertEquals((60*60*1*1000), value);
-	}
-	
-}
+/*
+ * 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.sandesha2.policy.SandeshaPolicyBean;
+import org.apache.sandesha2.util.PropertyManager;
+
+public class PropertyLoaderTest extends TestCase {
+	
+	SandeshaPolicyBean propertyBean = null;
+	
+	public void setUp () {
+		String fileName =  "target" + File.separator + "test-classes" + File.separator + "sandesha2.properties";
+		File file= new File (fileName);
+		if (!file.exists()) {
+			fail("sandesha2.properties file was not found");
+		}
+		
+		try {
+			InputStream in = new FileInputStream (file);
+			propertyBean = PropertyManager.loadPropertiesFromPropertyFile(in);
+			in.close();
+		} catch (Exception e) {
+			fail (e.getMessage());
+		}
+		
+	}
+	
+	public void testRetransmissionInterval () throws SandeshaException {
+		long value = propertyBean.getRetransmissionInterval();
+		assertEquals(value,20000);
+	}
+	
+	public void testExponentialBackOff () throws SandeshaException {
+		boolean value = propertyBean.isExponentialBackoff();
+		assertEquals(value,false);
+	}
+	
+	public void testAcknowledgementInterval () throws SandeshaException {
+		long value = propertyBean.getAcknowledgementInterval();
+		assertEquals(value,8000);
+	}
+	
+	public void testInactivityTImeout () {
+		long value = propertyBean.getInactivityTimeoutInterval();
+		assertEquals(value,(60*60*3*1000));
+	}
+	
+	public void testStorageManager () {
+		String storageMgr = propertyBean.getInMemoryStorageManagerClass();
+		assertEquals(storageMgr,"org.apache.sandesha2.storage.inmemory.InMemoryStorageManager1");
+	}
+
+	public void testSecurityManager() {
+		String secMgr = propertyBean.getSecurityManagerClass();
+		assertEquals(secMgr,"org.apache.sandesha2.security.SecurityManager1");
+	}
+	
+	public void testSequenceRemovalTimeout() {
+		long value = propertyBean.getSequenceRemovalTimeoutInterval();
+		assertEquals((60*60*1*1000), value);
+	}
+	
+}

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/PropertyLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientAckRequestWaitTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientAckRequestWaitTest.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientAckRequestWaitTest.java (original)
+++ webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientAckRequestWaitTest.java Wed Aug  8 17:57:51 2007
@@ -1,126 +1,126 @@
-/*
- * 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;
-
-import java.io.File;
-
-import org.apache.axiom.soap.SOAP11Constants;
-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.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class SandeshaClientAckRequestWaitTest extends SandeshaTestCase {
-
-	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
-	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
-
-	public SandeshaClientAckRequestWaitTest () {
-		super ("SandeshaClientTest");
-	}
-
-	public void setUp () throws Exception {
-	}
-
-    /**
-		 * Checks the following scenario
-		 * 
-		 * Don't start the server
-		 * 1) send an application message (will generate the create sequence)
-		 * 2) Send ACK Request (should not be rejected)
-		 * 3) start the server
-		 * 4) wait a bit then terminate sequence
-		 * 5) Issue wait until sequence completed (with a wait time)
-		 * 6) Ensure that the sequence was terminated
-		 * 
-		 */
-		public void testAckRequestWithWait () throws Exception {
-			String to = "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.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-		   clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, 
-		       Sandesha2Constants.SPEC_VERSIONS.v1_1);
-			clientOptions.setTo(new EndpointReference (to));
-			
-			ServiceClient serviceClient = new ServiceClient (configContext,null);
-			clientOptions.setAction(pingAction);
-			
-			String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
-			clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
-			clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-				//serviceClient.
-			serviceClient.setOptions(clientOptions);
-				
-			try{
-				// 1) Send the application message
-				serviceClient.fireAndForget(getPingOMBlock("ping1"));
-				
-				// 2) Send Ack request for the sequence
-				SandeshaClient.sendAckRequest(serviceClient);
-								
-				// 3) Start the server			
-				startServer(server_repoPath, server_axis2_xml);
-
-				// 4) Wait a bit then terminate
-				long limit = System.currentTimeMillis() + waitTime;
-				Error lastError = null;
-				while(System.currentTimeMillis() < limit) {
-					Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
-					
-					try {
-						//now check the sequence is running
-						SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-						assertEquals(report.getSequenceStatus(), SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
-
-						lastError = null;
-						break;
-					} catch(Error e) {
-						lastError = e;
-					}
-				}
-				if(lastError != null) throw lastError;
-				
-				SandeshaClient.terminateSequence(serviceClient);
-				
-				// 5) wait for the sequence completion (30 second wait)
-				SandeshaClient.waitUntilSequenceCompleted(serviceClient, 30000);
-				
-				// 6) Check that the sequence has terminated
-				SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-				assertNotNull(report);
-				assertEquals(SequenceReport.SEQUENCE_STATUS_TERMINATED, report.getSequenceStatus());
-
-			}
-			finally {
-				configContext.getListenerManager().stop();
-				serviceClient.cleanup();			
-			}
-			
-		}
-	
-}
+/*
+ * 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;
+
+import java.io.File;
+
+import org.apache.axiom.soap.SOAP11Constants;
+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.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class SandeshaClientAckRequestWaitTest extends SandeshaTestCase {
+
+	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
+	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
+
+	public SandeshaClientAckRequestWaitTest () {
+		super ("SandeshaClientTest");
+	}
+
+	public void setUp () throws Exception {
+	}
+
+    /**
+		 * Checks the following scenario
+		 * 
+		 * Don't start the server
+		 * 1) send an application message (will generate the create sequence)
+		 * 2) Send ACK Request (should not be rejected)
+		 * 3) start the server
+		 * 4) wait a bit then terminate sequence
+		 * 5) Issue wait until sequence completed (with a wait time)
+		 * 6) Ensure that the sequence was terminated
+		 * 
+		 */
+		public void testAckRequestWithWait () throws Exception {
+			String to = "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.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		   clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, 
+		       Sandesha2Constants.SPEC_VERSIONS.v1_1);
+			clientOptions.setTo(new EndpointReference (to));
+			
+			ServiceClient serviceClient = new ServiceClient (configContext,null);
+			clientOptions.setAction(pingAction);
+			
+			String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+			clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+			clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+				//serviceClient.
+			serviceClient.setOptions(clientOptions);
+				
+			try{
+				// 1) Send the application message
+				serviceClient.fireAndForget(getPingOMBlock("ping1"));
+				
+				// 2) Send Ack request for the sequence
+				SandeshaClient.sendAckRequest(serviceClient);
+								
+				// 3) Start the server			
+				startServer(server_repoPath, server_axis2_xml);
+
+				// 4) Wait a bit then terminate
+				long limit = System.currentTimeMillis() + waitTime;
+				Error lastError = null;
+				while(System.currentTimeMillis() < limit) {
+					Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
+					
+					try {
+						//now check the sequence is running
+						SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+						assertEquals(report.getSequenceStatus(), SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
+
+						lastError = null;
+						break;
+					} catch(Error e) {
+						lastError = e;
+					}
+				}
+				if(lastError != null) throw lastError;
+				
+				SandeshaClient.terminateSequence(serviceClient);
+				
+				// 5) wait for the sequence completion (30 second wait)
+				SandeshaClient.waitUntilSequenceCompleted(serviceClient, 30000);
+				
+				// 6) Check that the sequence has terminated
+				SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+				assertNotNull(report);
+				assertEquals(SequenceReport.SEQUENCE_STATUS_TERMINATED, report.getSequenceStatus());
+
+			}
+			finally {
+				configContext.getListenerManager().stop();
+				serviceClient.cleanup();			
+			}
+			
+		}
+	
+}

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientAckRequestWaitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientCloseWaitTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientCloseWaitTest.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientCloseWaitTest.java (original)
+++ webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientCloseWaitTest.java Wed Aug  8 17:57:51 2007
@@ -1,131 +1,131 @@
-/*
- * 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;
-
-import java.io.File;
-
-import org.apache.axiom.soap.SOAP11Constants;
-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.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class SandeshaClientCloseWaitTest extends SandeshaTestCase {
-
-	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
-	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
-
-	public SandeshaClientCloseWaitTest () {
-		super ("SandeshaClientTest");
-	}
-
-		/**
-		 * Checks the following scenario
-		 * 
-		 * Don't start the server
-		 * 1) send an application message (will generate the create sequence)
-		 * 2) close the sequence
-		 * 3) send another application message (this should fail)
-		 * 4) start the server
-		 * 5) wait a bit then terminate sequence
-		 * 6) Issue wait until sequence completed (with a wait time)
-		 * 7) Ensure that the sequence was terminated
-		 * 
-		 */
-		public void testCloseSequenceWithWait () throws Exception {
-			String to = "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.setAction(pingAction);
-			clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-		   clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, 
-		       Sandesha2Constants.SPEC_VERSIONS.v1_1);
-			clientOptions.setTo(new EndpointReference (to));
-			
-			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);
-				
-			try{
-				// 1) Send the application message
-				serviceClient.fireAndForget(getPingOMBlock("ping1"));
-				
-				// 2) Close the sequence
-				SandeshaClient.closeSequence(serviceClient);
-				
-				// 3) Send the second application message (this should fail)
-				try{
-					serviceClient.fireAndForget(getPingOMBlock("ping2"));
-					fail(); //this should have failed
-				}
-				catch(Exception e){
-					//good
-				}
-				
-				// 4) Start the server			
-				startServer(server_repoPath, server_axis2_xml);
-
-				// 5) Wait a bit then terminate
-				long limit = System.currentTimeMillis() + waitTime;
-				Error lastError = null;
-				while(System.currentTimeMillis() < limit) {
-					Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
-					
-					try {
-						//now check the sequence is running
-						SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-						assertEquals(report.getSequenceStatus(), SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
-
-						lastError = null;
-						break;
-					} catch(Error e) {
-						lastError = e;
-					}
-				}
-				if(lastError != null) throw lastError;
-				SandeshaClient.terminateSequence(serviceClient);
-				
-				// 6) wait for the sequence completion (30 second wait)
-				SandeshaClient.waitUntilSequenceCompleted(serviceClient, 30000);
-				
-				// 7) Check that the sequence has terminated
-				SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-				assertNotNull(report);
-				assertEquals(SequenceReport.SEQUENCE_STATUS_TERMINATED, report.getSequenceStatus());
-
-			}
-			finally {
-				configContext.getListenerManager().stop();
-				serviceClient.cleanup();			
-			}
-			
-		}
-}
+/*
+ * 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;
+
+import java.io.File;
+
+import org.apache.axiom.soap.SOAP11Constants;
+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.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class SandeshaClientCloseWaitTest extends SandeshaTestCase {
+
+	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
+	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
+
+	public SandeshaClientCloseWaitTest () {
+		super ("SandeshaClientTest");
+	}
+
+		/**
+		 * Checks the following scenario
+		 * 
+		 * Don't start the server
+		 * 1) send an application message (will generate the create sequence)
+		 * 2) close the sequence
+		 * 3) send another application message (this should fail)
+		 * 4) start the server
+		 * 5) wait a bit then terminate sequence
+		 * 6) Issue wait until sequence completed (with a wait time)
+		 * 7) Ensure that the sequence was terminated
+		 * 
+		 */
+		public void testCloseSequenceWithWait () throws Exception {
+			String to = "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.setAction(pingAction);
+			clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		   clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, 
+		       Sandesha2Constants.SPEC_VERSIONS.v1_1);
+			clientOptions.setTo(new EndpointReference (to));
+			
+			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);
+				
+			try{
+				// 1) Send the application message
+				serviceClient.fireAndForget(getPingOMBlock("ping1"));
+				
+				// 2) Close the sequence
+				SandeshaClient.closeSequence(serviceClient);
+				
+				// 3) Send the second application message (this should fail)
+				try{
+					serviceClient.fireAndForget(getPingOMBlock("ping2"));
+					fail(); //this should have failed
+				}
+				catch(Exception e){
+					//good
+				}
+				
+				// 4) Start the server			
+				startServer(server_repoPath, server_axis2_xml);
+
+				// 5) Wait a bit then terminate
+				long limit = System.currentTimeMillis() + waitTime;
+				Error lastError = null;
+				while(System.currentTimeMillis() < limit) {
+					Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
+					
+					try {
+						//now check the sequence is running
+						SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+						assertEquals(report.getSequenceStatus(), SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
+
+						lastError = null;
+						break;
+					} catch(Error e) {
+						lastError = e;
+					}
+				}
+				if(lastError != null) throw lastError;
+				SandeshaClient.terminateSequence(serviceClient);
+				
+				// 6) wait for the sequence completion (30 second wait)
+				SandeshaClient.waitUntilSequenceCompleted(serviceClient, 30000);
+				
+				// 7) Check that the sequence has terminated
+				SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+				assertNotNull(report);
+				assertEquals(SequenceReport.SEQUENCE_STATUS_TERMINATED, report.getSequenceStatus());
+
+			}
+			finally {
+				configContext.getListenerManager().stop();
+				serviceClient.cleanup();			
+			}
+			
+		}
+}

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientCloseWaitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientLastErrorTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientLastErrorTest.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientLastErrorTest.java (original)
+++ webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientLastErrorTest.java Wed Aug  8 17:57:51 2007
@@ -1,123 +1,123 @@
-/*
- * 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;
-
-import java.io.File;
-
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axis2.Constants.Configuration;
-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.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class SandeshaClientLastErrorTest extends SandeshaTestCase {
-
-	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
-	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
-
-	public SandeshaClientLastErrorTest () {
-		super ("SandeshaClientTest");
-	}
-	
-	/**
-	 * Tests that the last error and timestamp are set for the simple case of the target service not being available
-	 */
-	public void testLastErrorAndTimestamp() throws Exception
-	{
-		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.setAction(pingAction);
-		clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-		
-		clientOptions.setTo(new EndpointReference (to));
-		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportTo);
-		
-		String sequenceKey = "sequence1";
-		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-		
-		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		
-		serviceClient.setOptions(clientOptions);
-	
-		serviceClient.fireAndForget(getPingOMBlock("ping1"));
-		
-		// Let an error occur before we start the server
-		long limit = System.currentTimeMillis() + waitTime;
-		Error lastError = null;
-		while(System.currentTimeMillis() < limit) {
-			Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
-			
-			try {
-				// Check that the last error and last error time stamp have been set
-				Exception lastSendError = SandeshaClient.getLastSendError(serviceClient);
-				long lastSendErrorTime = SandeshaClient.getLastSendErrorTimestamp(serviceClient);
-				
-				// Check the values are valid
-				assertNotNull(lastSendError);
-				assertTrue(lastSendErrorTime > -1);
-
-				lastError = null;
-				break;
-			} catch(Error e) {
-				lastError = e;
-			}
-		}
-		if(lastError != null) throw lastError;
-		
-		startServer(server_repoPath, server_axis2_xml);
-
-		serviceClient.fireAndForget(getPingOMBlock("ping2"));
-		
-		
-		limit = System.currentTimeMillis() + waitTime;
-		while(System.currentTimeMillis() < limit) {
-			Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
-			
-			try {
-				SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-				assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
-				assertTrue(sequenceReport.getCompletedMessages().contains(new Long(2)));
-				assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-
-				lastError = null;
-				break;
-			} catch(Error e) {
-				lastError = e;
-			}
-		}
-		if(lastError != null) throw lastError;
-	
-		SandeshaClient.terminateSequence(serviceClient, sequenceKey);
-		
-		configContext.getListenerManager().stop();
-		serviceClient.cleanup();
-	}
-	
-}
+/*
+ * 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;
+
+import java.io.File;
+
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axis2.Constants.Configuration;
+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.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class SandeshaClientLastErrorTest extends SandeshaTestCase {
+
+	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
+	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
+
+	public SandeshaClientLastErrorTest () {
+		super ("SandeshaClientTest");
+	}
+	
+	/**
+	 * Tests that the last error and timestamp are set for the simple case of the target service not being available
+	 */
+	public void testLastErrorAndTimestamp() throws Exception
+	{
+		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.setAction(pingAction);
+		clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		
+		clientOptions.setTo(new EndpointReference (to));
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportTo);
+		
+		String sequenceKey = "sequence1";
+		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+		
+		ServiceClient serviceClient = new ServiceClient (configContext,null);
+		
+		serviceClient.setOptions(clientOptions);
+	
+		serviceClient.fireAndForget(getPingOMBlock("ping1"));
+		
+		// Let an error occur before we start the server
+		long limit = System.currentTimeMillis() + waitTime;
+		Error lastError = null;
+		while(System.currentTimeMillis() < limit) {
+			Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
+			
+			try {
+				// Check that the last error and last error time stamp have been set
+				Exception lastSendError = SandeshaClient.getLastSendError(serviceClient);
+				long lastSendErrorTime = SandeshaClient.getLastSendErrorTimestamp(serviceClient);
+				
+				// Check the values are valid
+				assertNotNull(lastSendError);
+				assertTrue(lastSendErrorTime > -1);
+
+				lastError = null;
+				break;
+			} catch(Error e) {
+				lastError = e;
+			}
+		}
+		if(lastError != null) throw lastError;
+		
+		startServer(server_repoPath, server_axis2_xml);
+
+		serviceClient.fireAndForget(getPingOMBlock("ping2"));
+		
+		
+		limit = System.currentTimeMillis() + waitTime;
+		while(System.currentTimeMillis() < limit) {
+			Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
+			
+			try {
+				SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+				assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
+				assertTrue(sequenceReport.getCompletedMessages().contains(new Long(2)));
+				assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+
+				lastError = null;
+				break;
+			} catch(Error e) {
+				lastError = e;
+			}
+		}
+		if(lastError != null) throw lastError;
+	
+		SandeshaClient.terminateSequence(serviceClient, sequenceKey);
+		
+		configContext.getListenerManager().stop();
+		serviceClient.cleanup();
+	}
+	
+}

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientLastErrorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientTerminateWaitTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientTerminateWaitTest.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientTerminateWaitTest.java (original)
+++ webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientTerminateWaitTest.java Wed Aug  8 17:57:51 2007
@@ -1,109 +1,109 @@
-/*
- * 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;
-
-import java.io.File;
-
-import org.apache.axiom.soap.SOAP11Constants;
-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.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class SandeshaClientTerminateWaitTest extends SandeshaTestCase {
-
-	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
-	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
-
-	public SandeshaClientTerminateWaitTest () {
-		super ("SandeshaClientTest");
-	}
-
-  /**
-	 * Checks the following scenario
-	 * 
-	 * Don't start the server
-	 * 1) send an application message (will generate the create sequence)
-	 * 2) terminate the sequence
-	 * 3) send another application message (this should fail)
-	 * 4) start the server
-	 * 5) Issue wait until sequence completed (with a wait time)
-	 * 6) Ensure that the sequence was terminated
-	 * 
-	 */
-	public void testTerminateSequenceWithWait () throws Exception {
-		String to = "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.setAction(pingAction);
-		clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-	   clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, 
-	       Sandesha2Constants.SPEC_VERSIONS.v1_1);
-		clientOptions.setTo(new EndpointReference (to));
-		
-		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);
-			
-		try{
-			// 1) Send the application message
-			serviceClient.fireAndForget(getPingOMBlock("ping1"));
-			
-			// 2) Terminate the sequence
-			SandeshaClient.terminateSequence(serviceClient);
-			
-			// 3) Send the second application message (this should fail)
-			try{
-				serviceClient.fireAndForget(getPingOMBlock("ping2"));
-				fail(); //this should have failed
-			}
-			catch(Exception e){
-				//good
-			}
-			
-			// 4) Start the server			
-			startServer(server_repoPath, server_axis2_xml);
-
-			// 5) wait for the sequence completion (30 second wait)
-			SandeshaClient.waitUntilSequenceCompleted(serviceClient, 30000);
-			
-			// 6) Check that the sequence has terminated
-			SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-			assertNotNull(report);
-			assertEquals(SequenceReport.SEQUENCE_STATUS_TERMINATED, report.getSequenceStatus());
-
-		}
-		finally {
-			configContext.getListenerManager().stop();
-			serviceClient.cleanup();			
-		}		
-	}
-}
+/*
+ * 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;
+
+import java.io.File;
+
+import org.apache.axiom.soap.SOAP11Constants;
+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.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class SandeshaClientTerminateWaitTest extends SandeshaTestCase {
+
+	String server_repoPath = "target" + File.separator + "repos" + File.separator + "server";
+	String server_axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
+
+	public SandeshaClientTerminateWaitTest () {
+		super ("SandeshaClientTest");
+	}
+
+  /**
+	 * Checks the following scenario
+	 * 
+	 * Don't start the server
+	 * 1) send an application message (will generate the create sequence)
+	 * 2) terminate the sequence
+	 * 3) send another application message (this should fail)
+	 * 4) start the server
+	 * 5) Issue wait until sequence completed (with a wait time)
+	 * 6) Ensure that the sequence was terminated
+	 * 
+	 */
+	public void testTerminateSequenceWithWait () throws Exception {
+		String to = "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.setAction(pingAction);
+		clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+	   clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, 
+	       Sandesha2Constants.SPEC_VERSIONS.v1_1);
+		clientOptions.setTo(new EndpointReference (to));
+		
+		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);
+			
+		try{
+			// 1) Send the application message
+			serviceClient.fireAndForget(getPingOMBlock("ping1"));
+			
+			// 2) Terminate the sequence
+			SandeshaClient.terminateSequence(serviceClient);
+			
+			// 3) Send the second application message (this should fail)
+			try{
+				serviceClient.fireAndForget(getPingOMBlock("ping2"));
+				fail(); //this should have failed
+			}
+			catch(Exception e){
+				//good
+			}
+			
+			// 4) Start the server			
+			startServer(server_repoPath, server_axis2_xml);
+
+			// 5) wait for the sequence completion (30 second wait)
+			SandeshaClient.waitUntilSequenceCompleted(serviceClient, 30000);
+			
+			// 6) Check that the sequence has terminated
+			SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+			assertNotNull(report);
+			assertEquals(SequenceReport.SEQUENCE_STATUS_TERMINATED, report.getSequenceStatus());
+
+		}
+		finally {
+			configContext.getListenerManager().stop();
+			serviceClient.cleanup();			
+		}		
+	}
+}

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientTerminateWaitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaClientTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaReportsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaTestCase.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaTestCase.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaTestCase.java (original)
+++ webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaTestCase.java Wed Aug  8 17:57:51 2007
@@ -1,271 +1,271 @@
-/*
- * 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;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Properties;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-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.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.client.async.AxisCallback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class SandeshaTestCase extends TestCase {
- 
-	String resourceDir = ""; //"test-resources";
-    Properties properties = null;
-    final String PROPERTY_FILE_NAME = "sandesha2-test.properties";
-    public final int DEFAULT_SERVER_TEST_PORT = 8060;
-    public ConfigurationContext serverConfigurationContext = null;
-    private final String RMServiceName = "RMSampleService";
-	private Log log = LogFactory.getLog(getClass());
-    
-	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";
-
-	protected SimpleHTTPServer httpServer = null;
-	protected int serverPort = DEFAULT_SERVER_TEST_PORT;
-	protected int waitTime = 60000; // Each test will wait up to 60 seconds, unless we override it here
-	protected int tickTime = 1000;  // Each wait will check the test assertions each second
-	protected String pingAction = "urn:wsrm:Ping";
-	protected String echoAction = "urn:wsrm:EchoString";
-	
-    public SandeshaTestCase(String name) {
-        super(name);
-        String testRource = "target" + File.separator + "test-classes";
-        resourceDir = new File(testRource).getPath();
-        
-        String propFileStr = resourceDir + File.separator + PROPERTY_FILE_NAME;
-        properties = new Properties ();
-        
-        try {
-			FileInputStream propertyFile = new FileInputStream (new File(propFileStr));
-			properties.load(propertyFile);
-		} catch (FileNotFoundException e) {
-			log.error(e);
-		} catch (IOException e) {
-			log.error(e);
-		}
-    }
-    
-    public void setUp () throws Exception {
-		super.setUp();
-    	
-		String serverPortStr = getTestProperty("test.server.port");
-		if (serverPortStr!=null) {
-			try {
-				serverPort = Integer.parseInt(serverPortStr);
-			} catch (NumberFormatException e) {
-				log.error(e);
-			}
-		}
-    }
-    
-	public ConfigurationContext startServer(String repoPath, String axis2_xml)
-	throws Exception {
-
-		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-		httpServer = new SimpleHTTPServer (configContext,serverPort);
-		httpServer.start();
-		Thread.sleep(300);
-		
-		return configContext;
-	}
-
-	public void tearDown () throws Exception {
-		if (httpServer!=null) {
-			httpServer.stop();
-		}
-		
-		Thread.sleep(300);
-	}
-
-	protected InputStreamReader getResource(String relativePath, String resourceName) {
-        String resourceFile = resourceDir + relativePath + File.separator + resourceName;
-        try {
-            FileReader reader = new FileReader(resourceFile);
-            return reader;
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException("cannot load the test-resource", e);
-        }
-    }
-
-    protected SOAPEnvelope getSOAPEnvelope() {
-        return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
-    }
-
-    protected SOAPEnvelope getSOAPEnvelope(String relativePath, String resourceName) {
-        try {
-            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(
-                    getResource(relativePath, resourceName));
-            OMXMLParserWrapper wrapper = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                    OMAbstractFactory.getSOAP11Factory(), reader);
-            return (SOAPEnvelope) wrapper.getDocumentElement();
-
-        } catch (XMLStreamException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected SOAPEnvelope getEmptySOAPEnvelope() {
-        return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
-    }
-
-    protected 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;
-	}
-    
-	protected 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;
-	}
-
-	protected String checkEchoOMBlock(OMElement response) {
-		assertEquals("Response namespace", applicationNamespaceName, response.getNamespace().getNamespaceURI());
-		assertEquals("Response local name", echoStringResponse, response.getLocalName());
-		
-		OMElement echoStringReturnElem = response.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-		assertNotNull("Echo String Return", echoStringReturnElem);
-		
-		String resultStr = echoStringReturnElem.getText();
-		return resultStr;
-	}
-
-    public String getTestProperty (String key) {
-    	if (properties!=null)
-    		return properties.getProperty(key);
-    	 
-    	return null;
-    }
-    
-    public void overrideConfigurationContext (ConfigurationContext context,MessageReceiver messageReceiver, String operationName, boolean newOperation, int mep) throws Exception  {
-    	
-    	
-    	AxisService rmService = context.getAxisConfiguration().getService(RMServiceName);
-    	
-    	AxisOperation operation = null;
-    	
-    	if (newOperation) {
-    		operation = rmService.getOperation(new QName (operationName));
-    		if (operation==null)
-    			throw new Exception ("Given operation not found");
-    	} else {
-    		operation = AxisOperationFactory.getAxisOperation(mep);
-    		rmService.addOperation(operation);
-    	}
-    	
-    	operation.setMessageReceiver(messageReceiver);
-    }
-
-	protected class TestCallback implements AxisCallback {
-
-		String name = null;
-		boolean completed = false;
-		boolean errorReported = false;
-		String resultStr;
-		
-		public boolean isComplete() {
-			return completed;
-		}
-		
-		public boolean isErrorReported() {
-			return errorReported;
-		}
-
-		public String getResult () {
-			return resultStr;
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete() {
-			completed = true;
-		}
-
-		public void onMessage(MessageContext result) {
-			SOAPBody body = result.getEnvelope().getBody();
-			OMElement contents = body.getFirstElement();
-			this.resultStr = checkEchoOMBlock(contents);
-			System.out.println("TestCallback got text: '" + resultStr + "'");
-		}
-		
-		public void onFault(MessageContext result) {
-			errorReported = true;
-			System.out.println("TestCallback got fault: " + result.getEnvelope());
-		}
-
-		public void onError (Exception e) {
-			errorReported = true;
-			System.out.println("TestCallback got exception");
-			e.printStackTrace();
-		}
-	}
-
-}
+/*
+ * 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+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.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.client.async.AxisCallback;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisOperationFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SandeshaTestCase extends TestCase {
+ 
+	String resourceDir = ""; //"test-resources";
+    Properties properties = null;
+    final String PROPERTY_FILE_NAME = "sandesha2-test.properties";
+    public final int DEFAULT_SERVER_TEST_PORT = 8060;
+    public ConfigurationContext serverConfigurationContext = null;
+    private final String RMServiceName = "RMSampleService";
+	private Log log = LogFactory.getLog(getClass());
+    
+	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";
+
+	protected SimpleHTTPServer httpServer = null;
+	protected int serverPort = DEFAULT_SERVER_TEST_PORT;
+	protected int waitTime = 60000; // Each test will wait up to 60 seconds, unless we override it here
+	protected int tickTime = 1000;  // Each wait will check the test assertions each second
+	protected String pingAction = "urn:wsrm:Ping";
+	protected String echoAction = "urn:wsrm:EchoString";
+	
+    public SandeshaTestCase(String name) {
+        super(name);
+        String testRource = "target" + File.separator + "test-classes";
+        resourceDir = new File(testRource).getPath();
+        
+        String propFileStr = resourceDir + File.separator + PROPERTY_FILE_NAME;
+        properties = new Properties ();
+        
+        try {
+			FileInputStream propertyFile = new FileInputStream (new File(propFileStr));
+			properties.load(propertyFile);
+		} catch (FileNotFoundException e) {
+			log.error(e);
+		} catch (IOException e) {
+			log.error(e);
+		}
+    }
+    
+    public void setUp () throws Exception {
+		super.setUp();
+    	
+		String serverPortStr = getTestProperty("test.server.port");
+		if (serverPortStr!=null) {
+			try {
+				serverPort = Integer.parseInt(serverPortStr);
+			} catch (NumberFormatException e) {
+				log.error(e);
+			}
+		}
+    }
+    
+	public ConfigurationContext startServer(String repoPath, String axis2_xml)
+	throws Exception {
+
+		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+		httpServer = new SimpleHTTPServer (configContext,serverPort);
+		httpServer.start();
+		Thread.sleep(300);
+		
+		return configContext;
+	}
+
+	public void tearDown () throws Exception {
+		if (httpServer!=null) {
+			httpServer.stop();
+		}
+		
+		Thread.sleep(300);
+	}
+
+	protected InputStreamReader getResource(String relativePath, String resourceName) {
+        String resourceFile = resourceDir + relativePath + File.separator + resourceName;
+        try {
+            FileReader reader = new FileReader(resourceFile);
+            return reader;
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException("cannot load the test-resource", e);
+        }
+    }
+
+    protected SOAPEnvelope getSOAPEnvelope() {
+        return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+    }
+
+    protected SOAPEnvelope getSOAPEnvelope(String relativePath, String resourceName) {
+        try {
+            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(
+                    getResource(relativePath, resourceName));
+            OMXMLParserWrapper wrapper = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                    OMAbstractFactory.getSOAP11Factory(), reader);
+            return (SOAPEnvelope) wrapper.getDocumentElement();
+
+        } catch (XMLStreamException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected SOAPEnvelope getEmptySOAPEnvelope() {
+        return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+    }
+
+    protected 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;
+	}
+    
+	protected 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;
+	}
+
+	protected String checkEchoOMBlock(OMElement response) {
+		assertEquals("Response namespace", applicationNamespaceName, response.getNamespace().getNamespaceURI());
+		assertEquals("Response local name", echoStringResponse, response.getLocalName());
+		
+		OMElement echoStringReturnElem = response.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+		assertNotNull("Echo String Return", echoStringReturnElem);
+		
+		String resultStr = echoStringReturnElem.getText();
+		return resultStr;
+	}
+
+    public String getTestProperty (String key) {
+    	if (properties!=null)
+    		return properties.getProperty(key);
+    	 
+    	return null;
+    }
+    
+    public void overrideConfigurationContext (ConfigurationContext context,MessageReceiver messageReceiver, String operationName, boolean newOperation, int mep) throws Exception  {
+    	
+    	
+    	AxisService rmService = context.getAxisConfiguration().getService(RMServiceName);
+    	
+    	AxisOperation operation = null;
+    	
+    	if (newOperation) {
+    		operation = rmService.getOperation(new QName (operationName));
+    		if (operation==null)
+    			throw new Exception ("Given operation not found");
+    	} else {
+    		operation = AxisOperationFactory.getAxisOperation(mep);
+    		rmService.addOperation(operation);
+    	}
+    	
+    	operation.setMessageReceiver(messageReceiver);
+    }
+
+	protected class TestCallback implements AxisCallback {
+
+		String name = null;
+		boolean completed = false;
+		boolean errorReported = false;
+		String resultStr;
+		
+		public boolean isComplete() {
+			return completed;
+		}
+		
+		public boolean isErrorReported() {
+			return errorReported;
+		}
+
+		public String getResult () {
+			return resultStr;
+		}
+		
+		public TestCallback (String name) {
+			this.name = name;
+		}
+		
+		public void onComplete() {
+			completed = true;
+		}
+
+		public void onMessage(MessageContext result) {
+			SOAPBody body = result.getEnvelope().getBody();
+			OMElement contents = body.getFirstElement();
+			this.resultStr = checkEchoOMBlock(contents);
+			System.out.println("TestCallback got text: '" + resultStr + "'");
+		}
+		
+		public void onFault(MessageContext result) {
+			errorReported = true;
+			System.out.println("TestCallback got fault: " + result.getEnvelope());
+		}
+
+		public void onError (Exception e) {
+			errorReported = true;
+			System.out.println("TestCallback got exception");
+			e.printStackTrace();
+		}
+	}
+
+}

Propchange: webservices/sandesha/trunk/java/modules/tests/src/test/java/org/apache/sandesha2/SandeshaTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native



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