You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2005/12/29 11:43:26 UTC
svn commit: r359771 [2/2] - in /webservices/axis2/trunk/java/modules:
core/src/org/apache/axis2/client/ core/src/org/apache/axis2/context/
core/src/org/apache/axis2/description/ core/src/org/apache/axis2/util/
integration/test/org/apache/axis2/engine/ ...
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/HandlerFailureTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/HandlerFailureTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/HandlerFailureTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/HandlerFailureTest.java Thu Dec 29 02:42:30 2005
@@ -21,8 +21,10 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.client.Call;
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.MessageContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -86,13 +88,13 @@
UtilServer.start();
UtilServer.deployService(service);
AxisOperation operation = service.getOperation(operationName);
- ArrayList phasec= new ArrayList();
+ ArrayList phasec = new ArrayList();
phasec.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
operation.setRemainingPhasesInFlow(phasec);
ArrayList phase = operation.getRemainingPhasesInFlow();
for (int i = 0; i < phase.size(); i++) {
Phase phase1 = (Phase) phase.get(i);
- if(PhaseMetadata.PHASE_POLICY_DETERMINATION.equals(phase1.getPhaseName())){
+ if (PhaseMetadata.PHASE_POLICY_DETERMINATION.equals(phase1.getPhaseName())) {
phase1.addHandler(culprit);
}
}
@@ -155,18 +157,18 @@
OMElement value = fac.createOMElement("myValue", omNs);
value.setText("Isaac Asimov, The Foundation Trilogy");
method.addChild(value);
-
- String clientHome = "target/test-resources/integrationRepo";
-
Options options = new Options();
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setTo(targetEPR);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+
+ OMElement result = sender.sendReceive(method);
- Call call = new Call(clientHome);
- call.setClientOptions(options);
- OMElement result = call.invokeBlocking(
- operationName.getLocalPart(), method);
result.serializeAndConsume(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
fail("the test must fail due to bad service Name");
@@ -174,7 +176,6 @@
log.info(e.getMessage());
String message = e.getMessage();
assertTrue((message.indexOf(UtilServer.FAILURE_MESSAGE)) >= 0);
- return;
}
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java Thu Dec 29 02:42:30 2005
@@ -18,16 +18,11 @@
import junit.framework.TestCase;
import org.apache.axis2.Constants;
-import org.apache.axis2.client.MessageSender;
import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOnlyAxisOperation;
-import org.apache.axis2.description.ParameterImpl;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.*;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
@@ -36,26 +31,12 @@
import org.apache.axis2.receivers.AbstractMessageReceiver;
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.axis2.soap.SOAP11Constants;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.transport.local.LocalTransportReceiver;
import org.apache.axis2.transport.local.LocalTransportSender;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.xml.namespace.QName;
public class MessageContextInjectionTest extends TestCase implements TestConstants {
-
- private Log log = LogFactory.getLog(getClass());
-
-
- private AxisConfiguration engineRegistry;
- private MessageContext mc;
-
- private SOAPEnvelope envelope;
-
- private boolean finish = false;
private TransportOutDescription tOut;
public MessageContextInjectionTest() {
@@ -108,18 +89,19 @@
}
public void testEchoXMLSync() throws Exception {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createEnvelope();
- MessageSender sender = new MessageSender("target/test-resources/integrationRepo");
-
+// MessageSender sender = new MessageSender("target/test-resources/integrationRepo");
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
Options options = new Options();
- sender.setClientOptions(options);
+ sender.setOptions(options);
options.setTo(targetEPR);
options.setSenderTransport(tOut);
options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- sender.send(operationName.getLocalPart(), payload);
+ sender.fireAndForget(payload);
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java Thu Dec 29 02:42:30 2005
@@ -40,7 +40,6 @@
private QName serviceName = new QName("", "EchoService");
private QName operationName =
new QName("http://ws.apache.org/axis2", "echoVoid");
- private QName transportName = new QName("", "NullTransport");
private AxisConfiguration engineRegistry;
private ClassLoader cl;
@@ -56,7 +55,6 @@
Echo.class.getName(),
operationName);
-
//service.setFaultInFlow(new MockFlow("service faultflow", 1));
ModuleDescription m1 = new ModuleDescription(
@@ -64,10 +62,10 @@
m1.setInFlow(new MockFlow("service module inflow", 4));
//m1.setFaultInFlow(new MockFlow("service module faultflow", 1));
engineRegistry = new AxisConfiguration();
- service.engageModule(m1,engineRegistry);
+ service.engageModule(m1, engineRegistry);
AxisOperation axisOperation = new OutInAxisOperation(
- );
+ );
axisOperation.setName(operationName);
service.addOperation(axisOperation);
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java Thu Dec 29 02:42:30 2005
@@ -20,7 +20,6 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.MessageSender;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
@@ -32,20 +31,13 @@
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.integration.TestingUtils;
import org.apache.axis2.integration.UtilServer;
-import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
public class OneWayRawXMLTest extends TestCase implements TestConstants {
- private Log log = LogFactory.getLog(getClass());
-
private SOAPEnvelope envelope;
- private boolean finish = false;
public OneWayRawXMLTest() {
super(OneWayRawXMLTest.class.getName());
@@ -62,7 +54,7 @@
AxisOperation axisOperation = new OutInAxisOperation(
operationName);
axisOperation.setMessageReceiver(new MessageReceiver() {
- public void receive(MessageContext messageCtx) throws AxisFault {
+ public void receive(MessageContext messageCtx) {
envelope = messageCtx.getEnvelope();
TestingUtils.campareWithCreatedOMElement(
envelope.getBody().getFirstElement());
@@ -80,7 +72,6 @@
public void testEchoXMLSync() throws Exception {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMElement payload = TestingUtils.createDummyOMElement();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java Thu Dec 29 02:42:30 2005
@@ -31,22 +31,17 @@
import org.apache.axis2.soap.SOAP11Constants;
import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.xml.namespace.QName;
public class SOAPversionTest extends TestCase implements TestConstants {
- private Log log = LogFactory.getLog(getClass());
QName assumedServiceName = new QName("AnonymousService");
private AxisService service;
- private boolean finish = false;
protected void setUp() throws Exception {
UtilServer.start();
@@ -65,8 +60,6 @@
public void testSOAP11() throws AxisFault {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createEnvelope();
MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
Options options = new Options();
@@ -86,8 +79,6 @@
}
public void testSOAP12() throws AxisFault {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createEnvelope();
MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
Options options = new Options();
@@ -109,8 +100,6 @@
}
public void testSOAPfault() throws AxisFault {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createEnvelope();
MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
Options options = new Options();
@@ -120,10 +109,8 @@
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
- SOAPEnvelope result =
- inOutMEPClient.invokeBlockingWithEnvelopeOut(
- operationName.getLocalPart(), payload);
+ inOutMEPClient.invokeBlockingWithEnvelopeOut(
+ operationName.getLocalPart(), payload);
// assertEquals("SOAP Version received is not compatible", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, result.getNamespace().getName());
inOutMEPClient.close();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java Thu Dec 29 02:42:30 2005
@@ -19,8 +19,10 @@
import junit.framework.TestCase;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
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.description.AxisService;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.integration.TestingUtils;
@@ -59,18 +61,22 @@
public void testDispatchWithURLOnly() throws Exception {
OMElement payload = TestingUtils.createDummyOMElement();
- Call call =
- new Call("target/test-resources/integrationRepo");
Options options = new Options();
- call.setClientOptions(options);
options.setTo(
new EndpointReference("http://127.0.0.1:5555/axis/services/EchoXMLService/echoOMElement"));
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- OMElement result = call.invokeBlocking(
- operationName.getLocalPart(), payload);
+
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ options.setTo(targetEPR);
+
+ OMElement result = sender.sendReceive(payload);
+
TestingUtils.campareWithCreatedOMElement(result);
- call.close();
}
public void testDispatchWithURLAndSOAPAction() throws Exception {
@@ -81,18 +87,20 @@
value.addChild(
fac.createText(value, "Isaac Asimov, The Foundation Trilogy"));
payload.addChild(value);
- Call call =
- new Call("target/test-resources/integrationRepo");
Options options = new Options();
- call.setClientOptions(options);
options.setTo(
new EndpointReference("http://127.0.0.1:5555/axis/services/EchoXMLService/"));
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setSoapAction("echoOMElement");
- OMElement result = call.invokeBlocking(
- operationName.getLocalPart(), payload);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ options.setTo(targetEPR);
+
+ OMElement result = sender.sendReceive(payload);
TestingUtils.campareWithCreatedOMElement(result);
- call.close();
}
public void testDispatchWithSOAPBody() throws Exception {
@@ -105,18 +113,19 @@
value.addChild(
fac.createText(value, "Isaac Asimov, The Foundation Trilogy"));
payload.addChild(value);
-
-
- Call call =
- new Call("target/test-resources/integrationRepo");
Options options = new Options();
- call.setClientOptions(options);
options.setTo(
new EndpointReference("http://127.0.0.1:5555/axis/services/"));
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- OMElement result = call.invokeBlocking(
- operationName.getLocalPart(), payload);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ options.setTo(targetEPR);
+
+ OMElement result = sender.sendReceive(payload);
+
TestingUtils.campareWithCreatedOMElement(result);
- call.close();
}
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java Thu Dec 29 02:42:30 2005
@@ -4,11 +4,15 @@
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.description.AxisService;
import org.apache.axis2.engine.util.RequestCounter;
import org.apache.axis2.engine.util.RequestCounterMessageReceiver;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.soap.SOAPFactory;
@@ -79,35 +83,45 @@
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope payload = fac.getDefaultEnvelope();
-
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call("target/test-resources/integrationRepo");
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setAction(operationName.getLocalPart());
- SOAPEnvelope result = call.invokeBlocking(operationName.getLocalPart(), payload);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ options.setTo(targetEPR);
+ OMElement result = sender.sendReceive(payload.getBody().getFirstElement());
OMNamespace axis2Namespace = fac.createOMNamespace(Constants.AXIS2_NAMESPACE_URI,
Constants.AXIS2_NAMESPACE_PREFIX);
SOAPEnvelope defaultEnvelope = fac.getDefaultEnvelope();
+
+
SOAPHeaderBlock soapHeaderBlock = defaultEnvelope.getHeader().addHeaderBlock(Constants.SERVICE_GROUP_ID,
axis2Namespace);
System.out.println("soapHeaderBlock = " + soapHeaderBlock);
- String serviceGroupId = result.getHeader().getFirstChildWithName(new QName("ReplyTo"))
+
+ //TODO : ple imporove this , what I have done is a hack
+ OMElement body = (OMElement) result.getParent();
+ SOAPEnvelope soapEnvlop = (SOAPEnvelope) body.getParent();
+
+ String serviceGroupId = soapEnvlop.getHeader().getFirstChildWithName(new QName("ReplyTo"))
.getFirstChildWithName(new QName("ReferenceParameters")).
getFirstChildWithName(new QName("ServiceGroupId")).getText();
- soapHeaderBlock.setText(serviceGroupId);
+ OMElement soapHeaderElement = fac.createOMElement(Constants.SERVICE_GROUP_ID, axis2Namespace);
+ soapHeaderElement.setText(serviceGroupId);
- SOAPEnvelope soapEnvelope = call.invokeBlocking(operationName.getLocalPart(),
- defaultEnvelope);
- String text = soapEnvelope.getBody().getFirstElement().getText();
+ sender.addHeader(soapHeaderElement);
+ OMElement result2 = sender.sendReceive(defaultEnvelope.getBody().getFirstElement());
+ String text = result2.getText();
assertEquals("Number of requests should be 2", 2, Integer.parseInt(text));
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java Thu Dec 29 02:42:30 2005
@@ -21,6 +21,9 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Call;
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.description.AxisService;
import org.apache.axis2.engine.EchoRawXMLTest;
import org.apache.axis2.integration.UtilServer;
@@ -28,7 +31,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import org.apache.axis2.soap.SOAPFactory;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
@@ -77,22 +79,28 @@
public void testEchoXMLSync() throws Exception {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
- //OMElement payload = createPayLoad();
OMElement payload = getpayLoad();
- Call call =
- new Call("target/test-resources/integrationRepo");
+// Call call =
+// new Call("target/test-resources/integrationRepo");
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setAction(operationName.getLocalPart());
- call.setClientOptions(options);
+// call.setClientOptions(options);
+
+// OMElement result = call.invokeBlocking(operationName.getLocalPart(),
+// payload);
+
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ OMElement result = sender.sendReceive(payload);
- OMElement result = call.invokeBlocking(operationName.getLocalPart(),
- payload);
assertNotNull(result);
OMElement person = (OMElement) result.getFirstOMChild();
assertEquals(person.getLocalName(), "person");
@@ -101,7 +109,7 @@
result.build();
result.serialize(writer);
writer.flush();
- call.close();
+ sender.finalizeInvoke();
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/EchoTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/EchoTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/EchoTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/EchoTest.java Thu Dec 29 02:42:30 2005
@@ -17,10 +17,6 @@
package org.apache.axis2.integration;
import junit.framework.TestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMConstants;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.soap.SOAPFactory;
import java.io.File;
import java.net.MalformedURLException;
@@ -28,23 +24,15 @@
import java.net.URLClassLoader;
public class EchoTest extends TestCase {
- private final SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
- private final OMNamespace ns =
- fac.createOMNamespace("http://apache.ws.apache.org/samples",
- "samples");
- private final OMNamespace arrayNs =
- fac.createOMNamespace(OMConstants.ARRAY_ITEM_NSURI,
- OMConstants.ARRAY_ITEM_NS_PREFIX);
- private final OMNamespace targetNs = fac.createOMNamespace(
- "http://axis.apache.org", "s");
+
private final URLClassLoader cl;
public EchoTest() throws MalformedURLException {
cl =
new URLClassLoader(
new URL[]{
- new File(
- "target/test-resources/samples/services/echo.jar").toURL()},
+ new File(
+ "target/test-resources/samples/services/echo.jar").toURL()},
EchoTest.class.getClassLoader());
}
@@ -53,8 +41,8 @@
cl =
new URLClassLoader(
new URL[]{
- new File(
- "target/test-resources/samples/services/echo.jar").toURL()},
+ new File(
+ "target/test-resources/samples/services/echo.jar").toURL()},
EchoTest.class.getClassLoader());
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java Thu Dec 29 02:42:30 2005
@@ -22,15 +22,17 @@
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.MessageContext;
import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.OutInAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.Echo;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.integration.UtilsJMSServer;
@@ -38,8 +40,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -102,14 +102,8 @@
public void testEchoXMLASync() throws Exception {
OMElement payload = createPayload();
-
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
options.setTransportInProtocol(Constants.TRANSPORT_JMS);
options.setAction(serviceName.getLocalPart());
options.setSoapAction("echoOMElement");
@@ -132,9 +126,13 @@
}
};
- call.invokeNonBlocking(operationName.getLocalPart(),
- payload,
- callback);
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setCurrentOperationName(operationName);
+ sender.setOptions(options);
+ options.setTo(targetEPR);
+ sender.sendReceiveNonblocking(payload, callback);
+
+
int index = 0;
while (!finish) {
Thread.sleep(10000);
@@ -144,38 +142,31 @@
"Server was shutdown as the async response take too long to complete");
}
}
- call.close();
+ sender.finalizeInvoke();
}
public void testEchoXMLSync() throws Exception {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createPayload();
-
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
options.setTransportInProtocol(Constants.TRANSPORT_JMS);
options.setAction(serviceName.getLocalPart());
options.setSoapAction("EchoXMLService/echoOMElement");
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setOptions(options);
+ sender.setCurrentOperationName(operationName);
+ options.setTo(targetEPR);
+
+ OMElement result = sender.sendReceive(payload);
+
- OMElement result =
- call.invokeBlocking(operationName.getLocalPart(),
- payload);
result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
- call.close();
+
+ sender.finalizeInvoke();
}
public void testEchoXMLCompleteSync() throws Exception {
- AxisService service =
- Utils.createSimpleService(serviceName,
- Echo.class.getName(),
- operationName);
OMFactory fac = OMAbstractFactory.getOMFactory();
@@ -185,22 +176,23 @@
value.setText("Isaac Asimov, The Foundation Trilogy");
payloadElement.addChild(value);
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
options.setAction(operationName.getLocalPart());
options.setTransportInProtocol(Constants.TRANSPORT_JMS);
options.setSoapAction("EchoXMLService/echoOMElement");
options.setUseSeparateListener(true);
- OMElement result = call.invokeBlocking(
- operationName.getLocalPart(), payloadElement);
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setOptions(options);
+ sender.setCurrentOperationName(operationName);
+ options.setTo(targetEPR);
+
+ OMElement result = sender.sendReceive(payloadElement);
+
result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
- call.close();
+ sender.finalizeInvoke();
}
@@ -209,9 +201,7 @@
ConfigurationContext configContext = confac.buildConfigurationContext(Constants.TESTING_REPOSITORY);
AxisOperation opdesc = new OutInAxisOperation(new QName("echoOMElement"));
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(Constants.TESTING_REPOSITORY);
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
options.setAction(operationName.getLocalPart());
options.setTransportInProtocol(Constants.TRANSPORT_JMS);
@@ -224,22 +214,36 @@
OMElement value = fac.createOMElement("myValue", omNs);
value.setText("Isaac Asimov, The Foundation Trilogy");
method.addChild(value);
- SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
- SOAPEnvelope envelope = factory.getDefaultEnvelope();
- envelope.getBody().addChild(method);
-
- MessageContext requestContext = new MessageContext(configContext);
+// SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+// SOAPEnvelope envelope = factory.getDefaultEnvelope();
+// envelope.getBody().addChild(method);
+//
+// MessageContext requestContext = new MessageContext(configContext);
AxisService srevice = new AxisService(serviceName.getLocalPart());
srevice.addOperation(opdesc);
- configContext.getAxisConfiguration().addService(srevice);
- requestContext.setAxisService(service);
- requestContext.setAxisOperation(opdesc);
+// configContext.getAxisConfiguration().addService(srevice);
+// requestContext.setAxisService(service);
+// requestContext.setAxisOperation(opdesc);
+
+// requestContext.setEnvelope(envelope);
+ // call.invokeBlocking(opdesc, requestContext);
+
+// SOAPEnvelope env = call.invokeBlocking("echoOMElement", envelope);
+
+ AxisConfiguration axisConfig = configContext.getAxisConfiguration();
+ axisConfig.addService(srevice);
+ ServiceContext serviceContext = new ServiceGroupContext(configContext,
+ srevice.getParent()).getServiceContext(srevice);
+
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setOptions(options);
+ sender.setCurrentOperationName(operationName);
+ options.setTo(targetEPR);
- requestContext.setEnvelope(envelope);
- MessageContext res = call.invokeBlocking(opdesc, requestContext);
+ OMElement result = sender.sendReceive(method);
- SOAPEnvelope env = call.invokeBlocking("echoOMElement", envelope);
- env.getBody().serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
+
+ result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
}
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java Thu Dec 29 02:42:30 2005
@@ -21,36 +21,27 @@
import org.apache.axis2.attachments.utils.ImageDataSource;
import org.apache.axis2.attachments.utils.ImageIO;
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.description.AxisService;
import org.apache.axis2.engine.Echo;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.integration.UtilServer;
-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.om.OMText;
+import org.apache.axis2.om.*;
import org.apache.axis2.om.impl.llom.OMTextImpl;
import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.activation.DataHandler;
import java.awt.*;
import java.io.InputStream;
public class EchoRawMTOMCommonsChunkingTest extends TestCase implements TestConstants {
-
-
- private Log log = LogFactory.getLog(getClass());
-
private AxisService service;
private OMElement data;
- private boolean finish = false;
-
public EchoRawMTOMCommonsChunkingTest() {
super(EchoRawMTOMCommonsChunkingTest.class.getName());
}
@@ -98,19 +89,21 @@
OMElement payload = createEnvelope();
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- Constants.TESTING_PATH + "commons-http-enabledRepository");
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- OMElement result = call.invokeBlocking(operationName
- .getLocalPart(), payload);
- OMElement ele = (OMElement) result.getFirstOMChild();
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext(Constants.TESTING_PATH + "commons-http-enabledRepository");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ options.setTo(targetEPR);
+
+ sender.sendReceive(payload);
this.campareWithCreatedOMElement(data);
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheLoadTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheLoadTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheLoadTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheLoadTest.java Thu Dec 29 02:42:30 2005
@@ -17,7 +17,6 @@
package org.apache.axis2.mtom;
import org.apache.axis2.Constants;
-import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.Echo;
import org.apache.axis2.integration.UtilServer;
@@ -30,8 +29,6 @@
private QName serviceName = new QName("EchoXMLService");
private QName operationName = new QName("echoOMElement");
-
- private ServiceContext serviceContext;
private AxisService service;
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMFileCacheTest.java Thu Dec 29 02:42:30 2005
@@ -25,9 +25,6 @@
public class EchoRawMTOMFileCacheTest extends EchoRawMTOMTest{
-
- private ServiceContext serviceContext;
-
private AxisService service;
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java Thu Dec 29 02:42:30 2005
@@ -19,19 +19,17 @@
import junit.framework.TestCase;
import org.apache.axis2.Constants;
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.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.Echo;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.integration.UtilServer;
-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.om.OMText;
+import org.apache.axis2.om.*;
import org.apache.axis2.om.impl.llom.OMTextImpl;
import org.apache.axis2.soap.SOAP12Constants;
-import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -97,29 +95,27 @@
public void testEchoXMLSync() throws Exception {
for (int i = 0; i < 10; i++) {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createEnvelope();
-
- org.apache.axis2.client.Call call =
- new org.apache.axis2.client.Call("target/test-resources/integrationRepo");
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
options.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- OMElement result = call.invokeBlocking(operationName
- .getLocalPart(),
- payload);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+ OMElement result = sender.sendReceive(payload);
+
OMElement ele = (OMElement) result.getFirstOMChild();
OMElement ele1 = (OMElement) ele.getFirstOMChild();
OMText binaryNode = (OMText) ele1.getFirstOMChild();
compareWithActualOMText(binaryNode);
log.info("" + i);
+ sender.finalizeInvoke();
UtilServer.unDeployClientService();
}
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java Thu Dec 29 02:42:30 2005
@@ -22,19 +22,18 @@
import org.apache.axis2.attachments.utils.ImageDataSource;
import org.apache.axis2.attachments.utils.ImageIO;
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.MessageContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.Echo;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.integration.UtilServer;
-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.om.OMText;
+import org.apache.axis2.om.*;
import org.apache.axis2.om.impl.llom.OMTextImpl;
import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.soap.SOAPEnvelope;
@@ -104,12 +103,7 @@
public void testEchoXMLASync() throws Exception {
OMElement payload = createEnvelope();
-
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- "target/test-resources/integrationRepo");
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setProperty(MessageContext.CHARACTER_SET_ENCODING, MessageContext.UTF_16);
@@ -131,10 +125,14 @@
finish = true;
}
};
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(options);
+
+ sender.sendReceiveNonblocking(payload, callback);
- call.invokeNonBlocking(operationName.getLocalPart(),
- payload,
- callback);
int index = 0;
while (!finish) {
Thread.sleep(1000);
@@ -144,7 +142,7 @@
"Server was shutdown as the async response take too long to complete");
}
}
- call.close();
+ sender.finalizeInvoke();
}
public void testEchoXMLSync() throws Exception {
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java Thu Dec 29 02:42:30 2005
@@ -21,22 +21,19 @@
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.attachments.ByteArrayDataSource;
-import org.apache.axis2.client.Call;
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.description.AxisService;
import org.apache.axis2.engine.Echo;
import org.apache.axis2.integration.UtilServer;
-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.om.OMText;
+import org.apache.axis2.om.*;
import org.apache.axis2.om.impl.llom.OMTextImpl;
import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -99,16 +96,10 @@
public void testEchoXMLASync() throws Exception {
OMElement payload = createPayload();
-
- String clientHome = "target/test-resources/integrationRepo";
-
Options clientOptions = new Options();
clientOptions.setTo(targetEPR);
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- Call call = new Call(clientHome);
- call.setClientOptions(clientOptions);
-
Callback callback = new Callback() {
public void onComplete(AsyncResult result) {
@@ -125,9 +116,14 @@
}
};
- call.invokeNonBlocking(operationName.getLocalPart(),
- payload,
- callback);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(clientOptions);
+
+ sender.sendReceiveNonblocking(payload, callback);
+
int index = 0;
while (!finish) {
Thread.sleep(1000);
@@ -137,33 +133,30 @@
"Server was shutdown as the async response take too long to complete");
}
}
- call.close();
+ sender.finalizeInvoke();
}
public void testEchoXMLSync() throws Exception {
for (int i = 0; i < 10; i++) {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createPayload();
- String clientHome = "target/test-resources/integrationRepo";
-
Options clientOptions = new Options();
clientOptions.setTo(targetEPR);
clientOptions.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- Call call =
- new Call(clientHome);
- call.setClientOptions(clientOptions);
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ ConfigurationContext configContext =
+ factory.buildConfigurationContext("target/test-resources/integrationRepo");
+ ServiceClient sender = new ServiceClient(configContext);
+ sender.setOptions(clientOptions);
- OMElement result = call.invokeBlocking(operationName
- .getLocalPart(), payload);
+ OMElement result = sender.sendReceive(payload);
OMElement data = (OMElement) result.getFirstOMChild();
compareWithCreatedOMText(data.getText());
- call.close();
+ sender.finalizeInvoke();
log.info("" + i);
UtilServer.unDeployClientService();
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java Thu Dec 29 02:42:30 2005
@@ -22,6 +22,7 @@
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;
@@ -40,7 +41,6 @@
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -56,11 +56,7 @@
+ "/axis/services/EchoXMLService/echoOMElement");
private QName serviceName = new QName("EchoXMLService");
private QName operationName = new QName("echoOMElement");
- private QName transportName = new QName("http://localhost/my",
- "NullTransport");
- private MessageContext mc;
- private SimpleHTTPServer sas;
private AxisService service;
private AxisService clientService;
private ServiceContext serviceContext;
@@ -85,7 +81,7 @@
Echo.class.getName(),
operationName);
UtilsTCPServer.deployService(service);
- clientService = Utils.createSimpleService(serviceName,
+ clientService = Utils.createSimpleServiceforClient(serviceName,
Echo.class.getName(),
operationName);
serviceContext = UtilServer.createAdressedEnabledClientSide(clientService);
@@ -109,14 +105,8 @@
public void testEchoXMLASync() throws Exception {
OMElement payload = createPayload();
-
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
options.setTransportInProtocol(Constants.TRANSPORT_TCP);
Callback callback = new Callback() {
@@ -137,9 +127,12 @@
}
};
- call.invokeNonBlocking(operationName.getLocalPart(),
- payload,
- callback);
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setCurrentOperationName(operationName);
+ sender.setOptions(options);
+
+ sender.sendReceiveNonblocking(payload, callback);
+
int index = 0;
while (!finish) {
Thread.sleep(1000);
@@ -149,37 +142,27 @@
"Server was shutdown as the async response take too long to complete");
}
}
- call.close();
+ sender.finalizeInvoke();
}
public void testEchoXMLSync() throws Exception {
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
OMElement payload = createPayload();
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
-
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
options.setTransportInProtocol(Constants.TRANSPORT_TCP);
- OMElement result =
- call.invokeBlocking(operationName.getLocalPart(),
- payload);
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setCurrentOperationName(operationName);
+ sender.setOptions(options);
+ OMElement result = sender.sendReceive(payload);
+
result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
- call.close();
+ sender.finalizeInvoke();
}
public void testEchoXMLCompleteSync() throws Exception {
- AxisService service =
- Utils.createSimpleService(serviceName,
- Echo.class.getName(),
- operationName);
-
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
@@ -188,25 +171,25 @@
value.setText("Isaac Asimov, The Foundation Trilogy");
payloadElement.addChild(value);
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
options.setAction(operationName.getLocalPart());
options.setTransportInProtocol(Constants.TRANSPORT_TCP);
options.setUseSeparateListener(true);
- OMElement result = call.invokeBlocking(
- operationName.getLocalPart(), payloadElement);
+ ServiceClient sender = new ServiceClient(serviceContext);
+ sender.setCurrentOperationName(operationName);
+ sender.setOptions(options);
+ OMElement result = sender.sendReceive(payloadElement);
+
result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
System.out));
- call.close();
+ sender.finalizeInvoke();
}
public void testEchoXMLSyncMC() throws Exception {
+ //TODO : Fix Me deepal , I am not complete
ConfigurationContextFactory confac = new ConfigurationContextFactory();
ConfigurationContext configContext = confac.buildConfigurationContext(Constants.TESTING_REPOSITORY);
@@ -239,7 +222,7 @@
// requestContext.setTo(targetEPR);
requestContext.setEnvelope(envelope);
- MessageContext res = call.invokeBlocking(opdesc, requestContext);
+ call.invokeBlocking(opdesc, requestContext);
SOAPEnvelope env = call.invokeBlocking("echoOMElement", envelope);
// SOAPEnvelope env= res.getEnvelope();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java?rev=359771&r1=359770&r2=359771&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java Thu Dec 29 02:42:30 2005
@@ -22,9 +22,9 @@
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.MessageContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.Echo;
@@ -34,7 +34,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -50,11 +49,6 @@
+ "/axis/services/EchoXMLService/echoOMElement");
private QName serviceName = new QName("EchoXMLService");
private QName operationName = new QName("echoOMElement");
- private QName transportName = new QName("http://localhost/my",
- "NullTransport");
-
- private MessageContext mc;
- private SimpleHTTPServer sas;
private AxisService service;
private ServiceContext serviceContext;
@@ -81,7 +75,7 @@
UtilsTCPServer.deployService(service);
AxisService service =
- Utils.createSimpleService(serviceName,
+ Utils.createSimpleServiceforClient(serviceName,
org.apache.axis2.engine.Echo.class.getName(),
operationName);
serviceContext = UtilServer.createAdressedEnabledClientSide(service);
@@ -91,25 +85,7 @@
UtilsTCPServer.stop();
}
- private OMElement createEnvelope() {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
- OMElement method = fac.createOMElement("echoOMElement", omNs);
- OMElement value = fac.createOMElement("myValue", omNs);
- value.addChild(
- fac.createText(value, "Isaac Asimov, The Foundation Trilogy"));
- method.addChild(value);
-
- return method;
- }
-
public void testEchoXMLCompleteASync() throws Exception {
- AxisService service =
- Utils.createSimpleService(serviceName,
- Echo.class.getName(),
- operationName);
-
-
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
@@ -118,13 +94,10 @@
value.setText("Isaac Asimov, The Foundation Trilogy");
method.addChild(value);
- org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(
- serviceContext);
- call.engageModule(new QName(Constants.MODULE_ADDRESSING));
+ ServiceClient sender = null;
try {
Options options = new Options();
- call.setClientOptions(options);
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_TCP);
options.setUseSeparateListener(true);
@@ -147,9 +120,12 @@
}
};
- call.invokeNonBlocking(operationName.getLocalPart(),
- method,
- callback);
+ sender = new ServiceClient(serviceContext);
+ sender.setCurrentOperationName(operationName);
+ sender.setOptions(options);
+
+ sender.sendReceiveNonblocking(method,callback);
+
int index = 0;
while (!finish) {
Thread.sleep(1000);
@@ -160,7 +136,7 @@
}
}
} finally {
- call.close();
+ sender.finalizeInvoke();
}
}