This is an automated email from the ASF dual-hosted git repository. billblough pushed a commit to branch transport in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-transports.git
commit 7856ac70b4373b6c7e73d21111bd59fb31dd2fbc Author: Ruwan Linton <ru...@apache.org> AuthorDate: Wed Sep 23 03:03:18 2009 +0000 Enabling the tests for 1.0 branch --- .../axis2/transport/tcp/TCPEchoRawXMLTest.java | 174 +++++++++++---------- 1 file changed, 91 insertions(+), 83 deletions(-) diff --git a/1.0.0/modules/tcp/test/org/apache/axis2/transport/tcp/TCPEchoRawXMLTest.java b/1.0.0/modules/tcp/test/org/apache/axis2/transport/tcp/TCPEchoRawXMLTest.java index 4ec5b6b..e2f85e6 100644 --- a/1.0.0/modules/tcp/test/org/apache/axis2/transport/tcp/TCPEchoRawXMLTest.java +++ b/1.0.0/modules/tcp/test/org/apache/axis2/transport/tcp/TCPEchoRawXMLTest.java @@ -26,16 +26,24 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.util.StAXUtils; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axiom.soap.SOAPFactory; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.OperationClient; 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.description.AxisOperation; import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.OutInAxisOperation; import org.apache.axis2.util.Utils; +import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -138,89 +146,89 @@ public class TCPEchoRawXMLTest extends TestCase { sender.cleanup(); } -// public void testEchoXMLSync() throws Exception { -// OMElement payload = createPayload(); -// -// Options options = new Options(); -// options.setTo(targetEPR); -// options.setTransportInProtocol(Constants.TRANSPORT_TCP); -// options.setAction(Constants.AXIS2_NAMESPACE_URI+"/"+operationName.getLocalPart()); -// -// ServiceClient sender = new ServiceClient(configContext, clientService); -// sender.setOptions(options); -// OMElement result = sender.sendReceive(operationName, payload); -// -// result.serialize(StAXUtils.createXMLStreamWriter( -// System.out)); -// sender.cleanup(); -// } - -// public void testEchoXMLCompleteSync() throws Exception { -// OMFactory fac = OMAbstractFactory.getOMFactory(); -// -// OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my"); -// OMElement payloadElement = fac.createOMElement("echoOMElement", omNs); -// OMElement value = fac.createOMElement("myValue", omNs); -// value.setText("Isaac Asimov, The Foundation Trilogy"); -// payloadElement.addChild(value); -// -// Options options = new Options(); -// options.setTo(targetEPR); -// options.setAction(Constants.AXIS2_NAMESPACE_URI+"/"+operationName.getLocalPart()); -// options.setTransportInProtocol(Constants.TRANSPORT_TCP); -// options.setUseSeparateListener(true); -// -// ServiceClient sender = new ServiceClient(configContext, clientService); -// sender.setOptions(options); -// OMElement result = sender.sendReceive(operationName, payloadElement); -// -// result.serialize(StAXUtils.createXMLStreamWriter( -// System.out)); -// sender.cleanup(); -// -// } -// -// public void testEchoXMLSyncMC() throws Exception { -// ConfigurationContext configContext = -// ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_REPOSITORY, Constants.TESTING_REPOSITORY + "/conf/axis2.xml"); -// -// AxisOperation opdesc = new OutInAxisOperation(new QName("echoOMElement")); -// Options options = new Options(); -// options.setTo(targetEPR); -// options.setAction(operationName.getLocalPart()); -// options.setTransportInProtocol(Constants.TRANSPORT_TCP); -// -// 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.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(); -// requestContext.setConfigurationContext(configContext); -// requestContext.setAxisService(clientService); -// requestContext.setAxisOperation(opdesc); -// requestContext.setEnvelope(envelope); -// -// ServiceClient sender = new ServiceClient(configContext, clientService); -// sender.setOptions(options); -// OperationClient opClient = sender.createClient(new QName("echoOMElement")); -// opClient.addMessageContext(requestContext); -// opClient.setOptions(options); -// opClient.execute(true); -// -// MessageContext response = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); -// SOAPEnvelope env = response.getEnvelope(); -// assertNotNull(env); -// env.getBody().serialize(StAXUtils.createXMLStreamWriter( -// System.out)); -// sender.cleanup(); -// } + public void testEchoXMLSync() throws Exception { + OMElement payload = createPayload(); + + Options options = new Options(); + options.setTo(targetEPR); + options.setTransportInProtocol(Constants.TRANSPORT_TCP); + options.setAction(Constants.AXIS2_NAMESPACE_URI+"/"+operationName.getLocalPart()); + + ServiceClient sender = new ServiceClient(configContext, clientService); + sender.setOptions(options); + OMElement result = sender.sendReceive(operationName, payload); + + result.serialize(StAXUtils.createXMLStreamWriter( + System.out)); + sender.cleanup(); + } + + public void testEchoXMLCompleteSync() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + + OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my"); + OMElement payloadElement = fac.createOMElement("echoOMElement", omNs); + OMElement value = fac.createOMElement("myValue", omNs); + value.setText("Isaac Asimov, The Foundation Trilogy"); + payloadElement.addChild(value); + + Options options = new Options(); + options.setTo(targetEPR); + options.setAction(Constants.AXIS2_NAMESPACE_URI+"/"+operationName.getLocalPart()); + options.setTransportInProtocol(Constants.TRANSPORT_TCP); + options.setUseSeparateListener(true); + + ServiceClient sender = new ServiceClient(configContext, clientService); + sender.setOptions(options); + OMElement result = sender.sendReceive(operationName, payloadElement); + + result.serialize(StAXUtils.createXMLStreamWriter( + System.out)); + sender.cleanup(); + + } + + public void testEchoXMLSyncMC() throws Exception { + ConfigurationContext configContext = + ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_REPOSITORY, Constants.TESTING_REPOSITORY + "/conf/axis2.xml"); + + AxisOperation opdesc = new OutInAxisOperation(new QName("echoOMElement")); + Options options = new Options(); + options.setTo(targetEPR); + options.setAction(operationName.getLocalPart()); + options.setTransportInProtocol(Constants.TRANSPORT_TCP); + + 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.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(); + requestContext.setConfigurationContext(configContext); + requestContext.setAxisService(clientService); + requestContext.setAxisOperation(opdesc); + requestContext.setEnvelope(envelope); + + ServiceClient sender = new ServiceClient(configContext, clientService); + sender.setOptions(options); + OperationClient opClient = sender.createClient(new QName("echoOMElement")); + opClient.addMessageContext(requestContext); + opClient.setOptions(options); + opClient.execute(true); + + MessageContext response = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); + SOAPEnvelope env = response.getEnvelope(); + assertNotNull(env); + env.getBody().serialize(StAXUtils.createXMLStreamWriter( + System.out)); + sender.cleanup(); + } }