[prev in list] [next in list] [prev in thread] [next in thread]
List: sandesha-dev
Subject: svn commit: r359592 - in
From: chamikara () apache ! org
Date: 2005-12-28 18:48:20
Message-ID: 20051228184820.65719.qmail () minotaur ! apache ! org
[Download RAW message or body]
Author: chamikara
Date: Wed Dec 28 10:47:56 2005
New Revision: 359592
URL: http://svn.apache.org/viewcvs?rev=359592&view=rev
Log:
Added RMScenario test. This will check weather the RM message excange happens \
correctly by starting a temporary server and sending RM messages. Used the RMReport \
functionality I added earlier. (only SyncPing scenario has been completed)
Added:
webservices/sandesha/trunk/test/src/org/apache/sandesha2/RMScenarioTest.java
Modified:
webservices/sandesha/trunk/test/src/org/apache/sandesha2/PorpertyLoaderTest.java
Modified: webservices/sandesha/trunk/test/src/org/apache/sandesha2/PorpertyLoaderTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/PorpertyLoaderTest.java?rev=359592&r1=359591&r2=359592&view=diff
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/PorpertyLoaderTest.java \
(original)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/PorpertyLoaderTest.java \
Wed Dec 28 10:47:56 2005 @@ -36,10 +36,10 @@
public void setUp () {
manager = PropertyManager.getInstance();
- String fileName = "./test/resources/sandesha2.properties";
+ String fileName = "./test-resources/sandesha2.properties";
File file= new File (fileName);
if (!file.exists()) {
- fail("'test/resources/sandesha2.prop' not found");
+ fail("'test-resources/sandesha2.properties' not found");
}
try {
Added: webservices/sandesha/trunk/test/src/org/apache/sandesha2/RMScenarioTest.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/test/src/org/apache/sandesha2/RMScenarioTest.java?rev=359592&view=auto
==============================================================================
--- webservices/sandesha/trunk/test/src/org/apache/sandesha2/RMScenarioTest.java \
(added)
+++ webservices/sandesha/trunk/test/src/org/apache/sandesha2/RMScenarioTest.java Wed \
Dec 28 10:47:56 2005 @@ -0,0 +1,117 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.MessageSender;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+/**
+ * @author Chamikara Jayalath <chamikaramj@gmail.com>
+ */
+
+public class RMScenarioTest extends TestCase {
+
+ SimpleHTTPServer httpServer = null;
+
+ public void setUp () throws AxisFault {
+ httpServer = new SimpleHTTPServer ("target\\repos\\server",8060);
+ httpServer.start();
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ throw new SandeshaException ("sleep interupted");
+ }
+ }
+
+ public void tearDown () throws AxisFault {
+ if (httpServer!=null)
+ httpServer.stop();
+ }
+
+ public void testSyncPing () throws AxisFault {
+
+ MessageSender sender = new MessageSender ("target\\repos\\client");
+ sender.engageModule(new QName ("Sandesha2-0.9"));
+ Options clientOptions = new Options ();
+ sender.setClientOptions(clientOptions);
+
+ //clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
+ clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ String to = "http://127.0.0.1:8060/axis2/services/RMInteropService";
+ String transportTo = "http://127.0.0.1:8060/axis2/services/RMInteropService";
+
+ clientOptions.setTo(new EndpointReference(to));
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+
+ clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
+ sender.send("ping",getPingOMBlock("ping1"));
+ sender.send("ping",getPingOMBlock("ping2"));
+ clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
+ sender.send("ping",getPingOMBlock("ping3"));
+
+ try {
+ //waiting till the messages exchange finishes.
+ Thread.sleep(6000);
+ } catch (InterruptedException e) {
+ throw new SandeshaException ("sleep interupted");
+ }
+
+ RMReport rmReport = \
Sandesha2ClientAPI.getRMReport(to,"sequence1",sender.getServiceContext().getConfigurationContext());
+ assertTrue(rmReport.isSequenceCompleted());
+ assertEquals(rmReport.getAckedMessageCount(),3);
+ }
+
+ public void testAsyncPing () throws AxisFault{
+
+ }
+
+ public void testSyncEcho () throws AxisFault {
+
+ }
+
+ public void testAsyncEcho () throws AxisFault {
+
+ }
+
+ private OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace ns = fac.createOMNamespace("http://tempuri.apache.org",
+ "ns1");
+ OMElement pingElement = fac.createOMElement("ping", ns);
+ OMElement paramElement = fac.createOMElement("param1", ns);
+ pingElement.addChild(paramElement);
+ paramElement.setText(text);
+
+ return pingElement;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic