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 sc...@apache.org on 2008/05/03 04:23:19 UTC
svn commit: r652968 [1/3] - in
/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws:
anytype/tests/ catalog/ client/ client/dispatch/ client/proxy/ description/
dispatch/ nonanonymous/complextype/ provider/ proxy/ rpclit/...
Author: scheu
Date: Fri May 2 19:23:18 2008
New Revision: 652968
URL: http://svn.apache.org/viewvc?rev=652968&view=rev
Log:
Updates to jaxws-integration tests only.
1) Some tests are deleted because they already exist in the jaxws unit test module.
2) Dispatch/Proxy tests are changed to invoke the service multiple times to verify correct behavior.
Removed:
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/DispatchSoapActionTest.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationController.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationControllerFactory.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/proxy/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/description/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/spi/
Modified:
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceMessageProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/StringMessageProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/StringProviderTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/GorillaDLWProxyTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/ProxyTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/RPCLitSWAProxyTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/RPCLitEnumTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/rpclit/stringarray/tests/RPCLitStringArrayTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddressBookTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/BareTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DocLitBareMinTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleByteArrayTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/NonWrapTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/StringListTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WSGenTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WrapTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/jaxb/DispatchXPayloadJAXBTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXMessageSourceTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXPayloadSourceTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXMessageStringTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/string/DispatchXPayloadStringTests.java
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java Fri May 2 19:23:18 2008
@@ -39,21 +39,29 @@
public void testAnyTypeElementinWrappedWSDL(){
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- AnyTypeMessageService service = new AnyTypeMessageService();
- AnyTypeMessagePortType portType = service.getAnyTypePort();
- BindingProvider p = (BindingProvider) portType;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+
+ // Run test a few times to ensure correct
+ _testAnyTypeElementinWrappedWSDL();
+ _testAnyTypeElementinWrappedWSDL();
+ _testAnyTypeElementinWrappedWSDL();
+
+ System.out.print("---------------------------------");
+ }
+
+ public void _testAnyTypeElementinWrappedWSDL(){
+ try{
+ AnyTypeMessageService service = new AnyTypeMessageService();
+ AnyTypeMessagePortType portType = service.getAnyTypePort();
+ BindingProvider p = (BindingProvider) portType;
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
- String req = new String("Request as String");
- Object response = portType.echoMessage(req);
- assertTrue(response instanceof String);
+ String req = new String("Request as String");
+ Object response = portType.echoMessage(req);
+ assertTrue(response instanceof String);
TestLogger.logger.debug("Response =" + response);
- System.out.print("---------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
-
- }
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java Fri May 2 19:23:18 2008
@@ -106,6 +106,20 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time
+ response = dispatch.invoke(request);
+ assertNotNull("dispatch invoke returned null",response);
+
+ // Turn the Source into a String so we can check it
+ responseText = createStringFromSource(response);
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncCallbackPayloadMode() throws Exception {
@@ -144,6 +158,31 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time
+ // Setup the callback for async responses
+ callbackHandler = new AsyncCallback<Source>();
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ monitor = dispatch.invokeAsync(request, callbackHandler);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callbackHandler.getValue();
+ assertNotNull(response);
+
+ // Turn the Source into a String so we can check it
+ responseText = createStringFromSource(response);
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncCallbackMessageMode() throws Exception {
@@ -182,6 +221,33 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+
+ // Invoke a second time
+ // Setup the callback for async responses
+ callbackHandler = new AsyncCallback<Source>();
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ monitor = dispatch.invokeAsync(request, callbackHandler);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callbackHandler.getValue();
+ assertNotNull(response);
+
+ // Turn the Source into a String so we can check it
+ responseText = createStringFromSource(response);
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncPollingPayloadMode() throws Exception {
@@ -217,6 +283,28 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time
+ TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
+ asyncResponse = dispatch.invokeAsync(request);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull(response);
+
+ // Turn the Source into a String so we can check it
+ responseText = createStringFromSource(response);
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncPollingMessageMode() throws Exception {
@@ -252,6 +340,29 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ asyncResponse = dispatch.invokeAsync(request);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull(response);
+
+ // Turn the Source into a String so we can check it
+ responseText = createStringFromSource(response);
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testOneWayPayloadMode() throws Exception {
@@ -269,6 +380,10 @@
TestLogger.logger.debug(">> Invoking One Way Dispatch");
dispatch.invokeOneWay(request);
+
+ // Invoke a second time
+ TestLogger.logger.debug(">> Invoking One Way Dispatch");
+ dispatch.invokeOneWay(request);
}
public void testOneWayMessageMode() throws Exception {
@@ -286,6 +401,10 @@
TestLogger.logger.debug(">> Invoking One Way Dispatch");
dispatch.invokeOneWay(request);
+
+ // Invoke a second time
+ TestLogger.logger.debug(">> Invoking One Way Dispatch");
+ dispatch.invokeOneWay(request);
}
public void testBadDOMSource() throws Exception {
@@ -311,6 +430,17 @@
fail("WebServiceException was expected, but received " + e);
}
+ // Invoke a second time
+ try {
+ dispatch.invokeOneWay(request);
+ fail("WebServiceException was expected");
+ } catch (WebServiceException e) {
+ TestLogger.logger.debug("A Web Service Exception was expected: " + e.toString());
+ assertTrue(e.getMessage() != null);
+ } catch (Exception e) {
+ fail("WebServiceException was expected, but received " + e);
+ }
+
}
/**
* Create a DOMSource with the provided String as the content
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java Fri May 2 19:23:18 2008
@@ -80,6 +80,18 @@
assertTrue("[ERROR] - Response object was null", response != null);
assertTrue("[ERROR] - No content in response object", response.getEchoStringReturn() != null);
assertTrue("[ERROR] - Zero length content in response", response.getEchoStringReturn().length() > 0);
+
+ // Invoke the Dispatch<Object> a second time
+ TestLogger.logger.debug(">> Invoking sync Dispatch with JAX-B Parameter");
+ response = (EchoStringResponse) dispatchPayload.invoke(request);
+
+ assertNotNull(response);
+
+ TestLogger.logger.debug(">> Response content: " + response.getEchoStringReturn());
+
+ assertTrue("[ERROR] - Response object was null", response != null);
+ assertTrue("[ERROR] - No content in response object", response.getEchoStringReturn() != null);
+ assertTrue("[ERROR] - Zero length content in response", response.getEchoStringReturn().length() > 0);
}
public void testAysncPayload() throws Exception {
@@ -112,6 +124,29 @@
assertTrue("[ERROR] - No content in response object", response.getEchoStringReturn() != null);
assertTrue("[ERROR] - Zero length content in response", response.getEchoStringReturn().length() > 0);
+
+ // Invoke a second time
+
+ // Create the callback for async responses
+ callback = new JAXBCallbackHandler<Object>();
+
+ // Invoke the Dispatch<Object> asynchronously
+ TestLogger.logger.debug(">> Invoking async(callback) Dispatch with JAX-B Parameter");
+ monitor = dispatchPayload.invokeAsync(request, callback);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = (EchoStringResponse) callback.getData();
+ assertNotNull(response);
+
+ TestLogger.logger.debug(">> Response content: " + response.getEchoStringReturn());
+
+ assertTrue("[ERROR] - Response object was null", response != null);
+ assertTrue("[ERROR] - No content in response object", response.getEchoStringReturn() != null);
+ assertTrue("[ERROR] - Zero length content in response", response.getEchoStringReturn().length() > 0);
}
public void testOneWayPayload() throws Exception {
@@ -126,6 +161,10 @@
// Invoke the Dispatch<Object> one-way
TestLogger.logger.debug(">> Invoking one-way Dispatch with JAX-B Parameter");
dispatchPayload.invokeOneWay(request);
+
+ // Invoke the Dispatch<Object> one-way a second time
+ TestLogger.logger.debug(">> Invoking one-way Dispatch with JAX-B Parameter");
+ dispatchPayload.invokeOneWay(request);
}
public void testSyncMessage() throws Exception {
@@ -155,6 +194,22 @@
TestLogger.logger.debug(">> Response content: " + echoStringResponse.getEchoStringReturn());
assertTrue("[ERROR] - No content in response object", echoStringResponse.getEchoStringReturn() != null);
assertTrue("[ERROR] - Zero length content in response", echoStringResponse.getEchoStringReturn().length() > 0);
+
+
+
+ // Invoke the Dispatch<Object> a second time
+ TestLogger.logger.debug(">> Invoking sync Dispatch with JAX-B Parameter");
+ jaxbResponse = (JAXBElement<Envelope>) dispatchMessage.invoke(request);
+
+ assertNotNull(jaxbResponse);
+ response = jaxbResponse.getValue();
+ assertNotNull(response);
+ assertNotNull(response.getBody());
+ echoStringResponse = (EchoStringResponse) response.getBody().getAny().get(0);
+
+ TestLogger.logger.debug(">> Response content: " + echoStringResponse.getEchoStringReturn());
+ assertTrue("[ERROR] - No content in response object", echoStringResponse.getEchoStringReturn() != null);
+ assertTrue("[ERROR] - Zero length content in response", echoStringResponse.getEchoStringReturn().length() > 0);
}
public void testAysncMessage() throws Exception {
@@ -195,6 +250,32 @@
assertTrue("[ERROR] - No content in response object", echoStringResponse.getEchoStringReturn() != null);
assertTrue("[ERROR] - Zero length content in response", echoStringResponse.getEchoStringReturn().length() > 0);
+ // Invoke a second time
+ // Create the callback for async responses
+ callback = new JAXBCallbackHandler<Object>();
+
+ // Invoke the Dispatch<Object> asynchronously
+ TestLogger.logger.debug(">> Invoking async(callback) Dispatch with JAX-B Parameter");
+ monitor = dispatchMessage.invokeAsync(request, callback);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ jaxbResponse = (JAXBElement<Envelope>) callback.getData();
+
+ assertNotNull(jaxbResponse);
+ response = jaxbResponse.getValue();
+
+ assertNotNull(response);
+ assertNotNull(response.getBody());
+ echoStringResponse = (EchoStringResponse) response.getBody().getAny().get(0);
+
+ TestLogger.logger.debug(">> Response content: " + echoStringResponse.getEchoStringReturn());
+ assertTrue("[ERROR] - No content in response object", echoStringResponse.getEchoStringReturn() != null);
+ assertTrue("[ERROR] - Zero length content in response", echoStringResponse.getEchoStringReturn().length() > 0);
+
}
@@ -213,6 +294,10 @@
// Invoke the Dispatch<Object> one-way
TestLogger.logger.debug(">> Invoking one-way Dispatch with JAX-B Parameter");
dispatchMessage.invokeOneWay(request);
+
+ // Invoke the Dispatch<Object> one-way a second time
+ TestLogger.logger.debug(">> Invoking one-way Dispatch with JAX-B Parameter");
+ dispatchMessage.invokeOneWay(request);
}
private JAXBElement<Envelope> createJAXBEnvelope() {
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java Fri May 2 19:23:18 2008
@@ -62,34 +62,50 @@
TestLogger.logger.debug("---------------------------------------");
TestLogger.logger.debug("test: " + getName());
try{
- // Initialize the JAX-WS client artifacts
- Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
- Dispatch<Source> dispatch = svc.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
-
- //Create JAXBContext and JAXBSource here.
- ObjectFactory factory = new ObjectFactory();
- Invoke invokeObj = factory.createInvoke();
- invokeObj.setInvokeStr("Some Request");
- JAXBContext ctx = JAXBContext.newInstance("org.test.dispatch.jaxbsource");
-
- JAXBSource jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
- // Invoke the Dispatch
+ // Initialize the JAX-WS client artifacts
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, url);
+ Dispatch<Source> dispatch = svc.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
+
+ //Create JAXBContext and JAXBSource here.
+ ObjectFactory factory = new ObjectFactory();
+ Invoke invokeObj = factory.createInvoke();
+ invokeObj.setInvokeStr("Some Request");
+ JAXBContext ctx = JAXBContext.newInstance("org.test.dispatch.jaxbsource");
+
+ JAXBSource jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
+ // Invoke the Dispatch
TestLogger.logger.debug(">> Invoking sync Dispatch");
- //Invoke Server endpoint and read response
- Source response = dispatch.invoke(jbSrc);
-
- assertNotNull("dispatch invoke returned null", response);
- //Print the response as string.
- StringWriter writer = new StringWriter();
- Transformer t = TransformerFactory.newInstance().newTransformer();
- Result result = new StreamResult(writer);
- t.transform(response, result);
+ //Invoke Server endpoint and read response
+ Source response = dispatch.invoke(jbSrc);
+
+ assertNotNull("dispatch invoke returned null", response);
+ //Print the response as string.
+ StringWriter writer = new StringWriter();
+ Transformer t = TransformerFactory.newInstance().newTransformer();
+ Result result = new StreamResult(writer);
+ t.transform(response, result);
+
+ TestLogger.logger.debug("Response On Client: \n" + writer.getBuffer().toString());
+
+ // Invoke a second time
+ jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
+ // Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ //Invoke Server endpoint and read response
+ response = dispatch.invoke(jbSrc);
+
+ assertNotNull("dispatch invoke returned null", response);
+ //Print the response as string.
+ writer = new StringWriter();
+ t = TransformerFactory.newInstance().newTransformer();
+ result = new StreamResult(writer);
+ t.transform(response, result);
TestLogger.logger.debug("Response On Client: \n" + writer.getBuffer().toString());
TestLogger.logger.debug("---------------------------------------");
}catch(Exception e){
- e.printStackTrace();
+ e.printStackTrace();
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java Fri May 2 19:23:18 2008
@@ -55,20 +55,20 @@
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
- Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT,
- Source.class, Service.Mode.PAYLOAD);
-
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+ Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT,
+ Source.class, Service.Mode.PAYLOAD);
+
// Create a SAXSource out of the string content
byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
- ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+ ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
InputSource input = new InputSource(stream);
- Source request = new SAXSource(input);
+ Source request = new SAXSource(input);
TestLogger.logger.debug(">> Invoking sync Dispatch");
- Source response = dispatch.invoke(request);
-
- assertNotNull("dispatch invoke returned null", response);
+ Source response = dispatch.invoke(request);
+
+ assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
@@ -81,7 +81,30 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
- }
+
+ // Invoke a second time
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ response = dispatch.invoke(request);
+
+ assertNotNull("dispatch invoke returned null", response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
+
+ }
public void testSyncMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
@@ -115,6 +138,29 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking sync Dispatch with Message Mode");
+ response = dispatch.invoke(request);
+
+ assertNotNull("dispatch invoke returned null", response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncCallbackPayloadMode() throws Exception {
@@ -158,6 +204,37 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+
+ // Invoke a second time
+ callbackHandler = new AsyncCallback<Source>();
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ monitor = dispatch.invokeAsync(request, callbackHandler);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callbackHandler.getValue();
+ assertNotNull("dispatch invoke returned null", response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncCallbackMessageMode() throws Exception {
@@ -201,6 +278,37 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ callbackHandler = new AsyncCallback<Source>();
+
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ monitor = dispatch.invokeAsync(request, callbackHandler);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callbackHandler.getValue();
+ assertNotNull("dispatch invoke returned null", response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncPollingPayloadMode() throws Exception {
@@ -241,6 +349,35 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
+ asyncResponse = dispatch.invokeAsync(request);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull("dispatch invoke returned null", response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testAsyncPollingMessageMode() throws Exception {
@@ -281,6 +418,35 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ asyncResponse = dispatch.invokeAsync(request);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull("dispatch invoke returned null", response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
public void testOneWayPayloadMode() throws Exception {
@@ -301,6 +467,15 @@
TestLogger.logger.debug(">> Invoking One Way Dispatch");
dispatch.invokeOneWay(request);
+
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking One Way Dispatch");
+ dispatch.invokeOneWay(request);
}
public void testOneWayMessageMode() throws Exception {
@@ -320,7 +495,15 @@
Source request = new SAXSource(input);
TestLogger.logger.debug(">> Invoking One Way Dispatch");
- dispatch.invokeOneWay(request);
+ dispatch.invokeOneWay(request);
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ input = new InputSource(stream);
+ request = new SAXSource(input);
+
+ TestLogger.logger.debug(">> Invoking One Way Dispatch");
+ dispatch.invokeOneWay(request);
}
public void testBadSAXSource() throws Exception {
@@ -346,6 +529,17 @@
fail("WebServiceException was expected, but received:" + e);
}
+ // Invoke a second time to verify
+ try {
+ dispatch.invoke(request);
+ fail("WebServiceException was expected");
+ } catch (WebServiceException e) {
+ TestLogger.logger.debug("A Web Service Exception was expected: " + e.toString());
+ assertTrue(e.getMessage() != null);
+ } catch (Exception e) {
+ fail("WebServiceException was expected, but received:" + e);
+ }
+
try {
dispatch.invokeOneWay(request);
fail("WebServiceException was expected");
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java Fri May 2 19:23:18 2008
@@ -117,7 +117,33 @@
assertTrue(!responseText.contains("soap"));
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
- assertTrue(responseText.contains("echoStringResponse"));
+ assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ bais = new ByteArrayInputStream(bytes);
+ request = new StreamSource(bais);
+
+ // Send the SOAP 1.2 request
+ response = dispatch.invoke(request);
+
+ assertTrue("The response was null. We expected content to be returned.", response != null);
+
+ // Convert the response to a more consumable format
+ baos = new ByteArrayOutputStream();
+ result = new StreamResult(baos);
+
+ factory = TransformerFactory.newInstance();
+ trans = factory.newTransformer();
+ trans.transform(response, result);
+
+ // Check to make sure the contents are correct. Again, since we're
+ // in PAYLOAD mode, we shouldn't have anything related to the envelope
+ // in the return, just the contents of the Body.
+ responseText = baos.toString();
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
@@ -157,6 +183,32 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ bais = new ByteArrayInputStream(bytes);
+ request = new StreamSource(bais);
+
+ // Send the SOAP 1.2 request
+ response = dispatch.invoke(request);
+
+ assertTrue("The response was null. We expected content to be returned.", response != null);
+
+ // Convert the response to a more consumable format
+ baos = new ByteArrayOutputStream();
+ result = new StreamResult(baos);
+
+ factory = TransformerFactory.newInstance();
+ trans = factory.newTransformer();
+ trans.transform(response, result);
+
+ // Check to make sure the contents are correct. Again, since we're
+ // in PAYLOAD mode, we shouldn't have anything related to the envelope
+ // in the return, just the contents of the Body.
+ responseText = baos.toString();
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
@@ -201,6 +253,34 @@
// purposes of the test.
assertTrue(responseText.contains("http://www.w3.org/2003/05/soap-envelope"));
assertTrue(!responseText.contains("http://schemas.xmlsoap.org/soap/envelope"));
+
+ // Invoke a second time to verify
+ bais = new ByteArrayInputStream(bytes);
+ request = new StreamSource(bais);
+
+ response = dispatch.invoke(request);
+
+ // Convert the response to a more consumable format
+ baos = new ByteArrayOutputStream();
+ result = new StreamResult(baos);
+
+ factory = TransformerFactory.newInstance();
+ trans = factory.newTransformer();
+ trans.transform(response, result);
+
+ // Check to make sure the contents of the message are correct
+ responseText = baos.toString();
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("echoStringResponse"));
+
+ // Check to make sure the message returned had the right protocol version
+ // TODO: Need to determine whether or not we should be using the hard
+ // coded URLs here, or whether we should be using a constant for the
+ // purposes of the test.
+ assertTrue(responseText.contains("http://www.w3.org/2003/05/soap-envelope"));
+ assertTrue(!responseText.contains("http://schemas.xmlsoap.org/soap/envelope"));
}
/**
@@ -230,6 +310,20 @@
assertNotNull("We should have an exception, but none was thrown.", e);
assertEquals("FaultCode should be \"MustUnderstand\"", "MustUnderstand", e.getFault().getFaultCodeAsQName().getLocalPart());
+ // Invoke a second time to verify
+ bais = new ByteArrayInputStream(bytes);
+ request = new StreamSource(bais);
+
+ e = null;
+ try {
+ Source response = dispatch.invoke(request);
+ } catch (SOAPFaultException ex) {
+ e = ex;
+ }
+
+ assertNotNull("We should have an exception, but none was thrown.", e);
+ assertEquals("FaultCode should be \"MustUnderstand\"", "MustUnderstand", e.getFault().getFaultCodeAsQName().getLocalPart());
+
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java Fri May 2 19:23:18 2008
@@ -47,68 +47,92 @@
return getTestSetup(new TestSuite(SOAPMessageDispatchTests.class));
}
- public void testSOAPMessageSyncMessageMode() throws Exception {
-
+ public void testSOAPMessageSyncMessageMode() throws Exception {
+
String basedir = new File(System.getProperty("basedir",".")).getAbsolutePath();
String messageResource = new File(basedir, this.messageResource).getAbsolutePath();
TestLogger.logger.debug("---------------------------------------");
TestLogger.logger.debug("test: " + getName());
- //Initialize the JAX-WS client artifacts
- Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
- Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
- SOAPMessage.class, Service.Mode.MESSAGE);
-
- //Create SOAPMessage Object no attachments here.
- FileInputStream inputStream = new FileInputStream(messageResource);
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage msgObject = factory.createMessage(null, inputStream);
+ //Initialize the JAX-WS client artifacts
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, url);
+ Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
+ SOAPMessage.class, Service.Mode.MESSAGE);
+
+ //Create SOAPMessage Object no attachments here.
+ FileInputStream inputStream = new FileInputStream(messageResource);
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage msgObject = factory.createMessage(null, inputStream);
+
+ //Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking Async Dispatch");
+ SOAPMessage response = dispatch.invoke(msgObject);
- //Invoke the Dispatch
+ assertNotNull("dispatch invoke returned null", response);
+ response.writeTo(System.out);
+
+ // Invoke a second time to verify
+ // Invoke the Dispatch
TestLogger.logger.debug(">> Invoking Async Dispatch");
- SOAPMessage response = dispatch.invoke(msgObject);
+ response = dispatch.invoke(msgObject);
+
+ assertNotNull("dispatch invoke returned null", response);
+ response.writeTo(System.out);
+ }
+
+ public void testSOAPMessageAsyncCallbackMessageMode() throws Exception {
- assertNotNull("dispatch invoke returned null", response);
- response.writeTo(System.out);
- }
-
- public void testSOAPMessageAsyncCallbackMessageMode() throws Exception {
-
String basedir = new File(System.getProperty("basedir",".")).getAbsolutePath();
String messageResource = new File(basedir, this.messageResource).getAbsolutePath();
TestLogger.logger.debug("---------------------------------------");
TestLogger.logger.debug("test: " + getName());
- //Initialize the JAX-WS client artifacts
- Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
- Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
- SOAPMessage.class, Service.Mode.MESSAGE);
-
- //Create SOAPMessage Object no attachments here.
- FileInputStream inputStream = new FileInputStream(messageResource);
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage msgObject = factory.createMessage(null, inputStream);
-
+ //Initialize the JAX-WS client artifacts
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, url);
+ Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
+ SOAPMessage.class, Service.Mode.MESSAGE);
+
+ //Create SOAPMessage Object no attachments here.
+ FileInputStream inputStream = new FileInputStream(messageResource);
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage msgObject = factory.createMessage(null, inputStream);
+
AsyncCallback<SOAPMessage> ac = new AsyncCallback<SOAPMessage>();
- //Invoke the Dispatch
+ //Invoke the Dispatch
TestLogger.logger.debug(">> Invoking sync Dispatch");
- Future<?> monitor = dispatch.invokeAsync(msgObject, ac);
+ Future<?> monitor = dispatch.invokeAsync(msgObject, ac);
- assertNotNull("dispatch invokeAsync returned null Future<?>", monitor);
- while (!monitor.isDone()) {
+ assertNotNull("dispatch invokeAsync returned null Future<?>", monitor);
+ while (!monitor.isDone()) {
TestLogger.logger.debug(">> Async invocation still not complete");
Thread.sleep(1000);
}
-
+
SOAPMessage response = ac.getValue();
assertNotNull("dispatch invoke returned null", response);
response.writeTo(System.out);
- }
-
- public void testSOAPMessageAsyncPollingMessageMode() throws Exception {
+ // Invoke a second time to verify
+ ac = new AsyncCallback<SOAPMessage>();
+ //Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ monitor = dispatch.invokeAsync(msgObject, ac);
+
+ assertNotNull("dispatch invokeAsync returned null Future<?>", monitor);
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = ac.getValue();
+ assertNotNull("dispatch invoke returned null", response);
+ response.writeTo(System.out);
+ }
+
+ public void testSOAPMessageAsyncPollingMessageMode() throws Exception {
+
String basedir = new File(System.getProperty("basedir",".")).getAbsolutePath();
String messageResource = new File(basedir, this.messageResource).getAbsolutePath();
@@ -118,7 +142,7 @@
Service svc = Service.create(serviceName);
svc.addPort(portName, null, url);
Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
- SOAPMessage.class, Service.Mode.MESSAGE);
+ SOAPMessage.class, Service.Mode.MESSAGE);
//Create SOAPMessage Object no attachments here.
FileInputStream inputStream = new FileInputStream(messageResource);
@@ -134,10 +158,26 @@
TestLogger.logger.debug(">> Async invocation still not complete");
Thread.sleep(1000);
}
-
+
SOAPMessage response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
response.writeTo(System.out);
+
+
+ // Invoke a second time to verify
+ // Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ asyncResponse = dispatch.invokeAsync(msgObject);
+
+ assertNotNull("dispatch invokeAsync returned null Response", asyncResponse);
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull("dispatch invoke returned null", response);
+ response.writeTo(System.out);
}
-
+
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java Fri May 2 19:23:18 2008
@@ -84,7 +84,28 @@
assertTrue(!responseText.contains("soap"));
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
- assertTrue(responseText.contains("echoStringResponse"));
+ assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ // Invoke the Dispatch<Source>
+ TestLogger.logger.debug(">> Invoking sync Dispatch with PAYLOAD mode");
+ response = dispatch.invoke(srcStream);
+ assertNotNull(response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
@@ -119,7 +140,27 @@
assertTrue(responseText.contains("soap"));
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
- assertTrue(responseText.contains("echoStringResponse"));
+ assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ TestLogger.logger.debug(">> Invoking sync Dispatch with MESSAGE Mode");
+ response = (StreamSource) dispatch.invoke(srcStream);
+ assertNotNull(response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
@@ -166,6 +207,35 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch with PAYLOAD mode");
+ monitor = dispatch.invokeAsync(srcStream, callbackHandler);
+
+ // Wait for the async response to be returned
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callbackHandler.getValue();
+ assertNotNull(response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
@@ -212,6 +282,40 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ // We'll need a callback instance to handle the async responses
+ callbackHandler = new AsyncCallback<Source>();
+
+ // Create a StreamSource with the desired content
+ bytes = DispatchTestConstants.sampleSoapMessage.getBytes();
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch with MESSAGE mode");
+ monitor = dispatch.invokeAsync(srcStream, callbackHandler);
+
+ // Wait for the async response to be returned
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callbackHandler.getValue();
+ assertNotNull(response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
@@ -254,6 +358,34 @@
assertTrue(!responseText.contains("Envelope"));
assertTrue(!responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch with PAYLOAD mode");
+ asyncResponse = dispatch.invokeAsync(srcStream);
+
+ // Wait for the async response to be returned
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull(response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(!responseText.contains("soap"));
+ assertTrue(!responseText.contains("Envelope"));
+ assertTrue(!responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
@@ -297,27 +429,63 @@
assertTrue(responseText.contains("Envelope"));
assertTrue(responseText.contains("Body"));
assertTrue(responseText.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch with MESSAGE mode");
+ asyncResponse = dispatch.invokeAsync(srcStream);
+
+ // Wait for the async response to be returned
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull(response);
+
+ // Prepare the response content for checking
+ reader = inputFactory.createXMLStreamReader(response);
+ r2w = new Reader2Writer(reader);
+ responseText = r2w.getAsString();
+ TestLogger.logger.debug(responseText);
+
+ // Check to make sure the content is correct
+ assertTrue(responseText.contains("soap"));
+ assertTrue(responseText.contains("Envelope"));
+ assertTrue(responseText.contains("Body"));
+ assertTrue(responseText.contains("echoStringResponse"));
}
/**
* Invoke a Dispatch<Source> one-way operation
*/
- public void testOneWayPayloadMode() throws Exception {
+ public void testOneWayPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
TestLogger.logger.debug("test: " + getName());
-
+
// Initialize the JAX-WS client artifacts
- Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
- Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
- Service.Mode.PAYLOAD);
-
- // Create a StreamSource with the desired content
+ Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+ Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
+ Service.Mode.PAYLOAD);
+
+ // Create a StreamSource with the desired content
byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
- Source srcStream = new StreamSource((InputStream) stream);
+ Source srcStream = new StreamSource((InputStream) stream);
TestLogger.logger.debug(">> Invoking One Way Dispatch");
- dispatch.invokeOneWay(srcStream);
- }
+ dispatch.invokeOneWay(srcStream);
+
+ // Invoke a second time to verify
+ stream = new ByteArrayInputStream(bytes);
+ srcStream = new StreamSource((InputStream) stream);
+
+ TestLogger.logger.debug(">> Invoking One Way Dispatch");
+ dispatch.invokeOneWay(srcStream);
+ }
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java Fri May 2 19:23:18 2008
@@ -65,6 +65,20 @@
assertTrue(!response.contains("Envelope"));
assertTrue(!response.contains("Body"));
assertTrue(response.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ // Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ response = dispatch.invoke(DispatchTestConstants.sampleBodyContent);
+
+ assertNotNull("dispatch invoke returned null", response);
+ TestLogger.logger.debug(response);
+
+ // Check to make sure the content is correct
+ assertTrue(!response.contains("soap"));
+ assertTrue(!response.contains("Envelope"));
+ assertTrue(!response.contains("Body"));
+ assertTrue(response.contains("echoStringResponse"));
}
/**
@@ -96,6 +110,22 @@
assertNotNull("No exception received", e);
assertTrue("'e' should be of type ProtocolException", e instanceof ProtocolException);
+
+ // Invoke a second time to verify
+
+ // Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ e = null;
+ try {
+ // The _bad string passes "THROW EXCEPTION", which causes the echo function on the
+ // server to throw a RuntimeException. We should get a ProtocolException here on the client
+ String response = dispatch.invoke(DispatchTestConstants.sampleBodyContent_bad);
+ } catch (Exception ex) {
+ e = ex;
+ }
+
+ assertNotNull("No exception received", e);
+ assertTrue("'e' should be of type ProtocolException", e instanceof ProtocolException);
}
@@ -124,11 +154,26 @@
assertTrue(response.contains("Envelope"));
assertTrue(response.contains("Body"));
assertTrue(response.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ // Invoke the Dispatch
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ response = dispatch.invoke(DispatchTestConstants.sampleSoapMessage);
+
+ assertNotNull("dispatch invoke returned null", response);
+ TestLogger.logger.debug(response);
+
+ // Check to make sure the content is correct
+ assertTrue(response.contains("soap"));
+ assertTrue(response.contains("Envelope"));
+ assertTrue(response.contains("Body"));
+ assertTrue(response.contains("echoStringResponse"));
}
- /**
+ /**
* Invoke a Dispatch<String> using the async callback API in PAYLOAD mode
- */
+ */
public void testAsyncCallbackPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
TestLogger.logger.debug("test: " + getName());
@@ -159,6 +204,29 @@
assertTrue(!response.contains("Envelope"));
assertTrue(!response.contains("Body"));
assertTrue(response.contains("echoStringResponse"));
+
+
+ // Invoke a second time to verify
+ // Create the callback for async responses
+ callback = new AsyncCallback<String>();
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
+ monitor = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent, callback);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callback.getValue();
+ assertNotNull("dispatch invoke returned null", response);
+ TestLogger.logger.debug(response);
+
+ // Check to make sure the content is correct
+ assertTrue(!response.contains("soap"));
+ assertTrue(!response.contains("Envelope"));
+ assertTrue(!response.contains("Body"));
+ assertTrue(response.contains("echoStringResponse"));
}
/**
@@ -194,6 +262,28 @@
assertTrue(response.contains("Envelope"));
assertTrue(response.contains("Body"));
assertTrue(response.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ // Create the callback for async responses
+ callback = new AsyncCallback<String>();
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch with Message Mode");
+ monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callback);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = callback.getValue();
+ assertNotNull("dispatch invoke returned null", response);
+ TestLogger.logger.debug(response);
+
+ // Check to make sure the content is correct
+ assertTrue(response.contains("soap"));
+ assertTrue(response.contains("Envelope"));
+ assertTrue(response.contains("Body"));
+ assertTrue(response.contains("echoStringResponse"));
}
/**
@@ -226,6 +316,25 @@
assertTrue(!response.contains("Envelope"));
assertTrue(!response.contains("Body"));
assertTrue(response.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
+ asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull("dispatch invoke returned null", response);
+ TestLogger.logger.debug(response);
+
+ // Check to make sure the content is correct
+ assertTrue(!response.contains("soap"));
+ assertTrue(!response.contains("Envelope"));
+ assertTrue(!response.contains("Body"));
+ assertTrue(response.contains("echoStringResponse"));
}
/**
@@ -258,6 +367,25 @@
assertTrue(response.contains("Envelope"));
assertTrue(response.contains("Body"));
assertTrue(response.contains("echoStringResponse"));
+
+ // Invoke a second time to verify
+ TestLogger.logger.debug(">> Invoking async (polling) Dispatch with Message Mode");
+ asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ response = asyncResponse.get();
+ assertNotNull("dispatch invoke returned null", response);
+ TestLogger.logger.debug(response);
+
+ // Check to make sure the content is correct
+ assertTrue(response.contains("soap"));
+ assertTrue(response.contains("Envelope"));
+ assertTrue(response.contains("Body"));
+ assertTrue(response.contains("echoStringResponse"));
}
/**
@@ -275,6 +403,10 @@
TestLogger.logger.debug(">> Invoking one-way Dispatch");
dispatch.invokeOneWay(DispatchTestConstants.sampleBodyContent);
+
+ // Invoke a second time to verify
+ TestLogger.logger.debug(">> Invoking one-way Dispatch");
+ dispatch.invokeOneWay(DispatchTestConstants.sampleBodyContent);
}
/**
@@ -292,6 +424,10 @@
TestLogger.logger.debug(">> Invoking one-way Dispatch");
dispatch.invokeOneWay(DispatchTestConstants.sampleSoapMessage);
+
+ // Invoke a second time to verify
+ TestLogger.logger.debug(">> Invoking one-way Dispatch");
+ dispatch.invokeOneWay(DispatchTestConstants.sampleSoapMessage);
}
@@ -316,6 +452,19 @@
ttemp = t;
}
assertNotNull(ttemp);
+
+ // Invoke a second time to verify
+ // Invoke the Dispatch
+ ttemp = null;
+ try {
+ TestLogger.logger.debug(">> Invoking sync Dispatch");
+ String response = dispatch.invoke(DispatchTestConstants.sampleBodyContent);
+ } catch (Throwable t) {
+ assertTrue(t instanceof WebServiceException);
+ assertTrue(t.getCause() instanceof UnknownHostException);
+ ttemp = t;
+ }
+ assertNotNull(ttemp);
}
@@ -356,6 +505,35 @@
} else {
fail("No fault thrown. Should have retrieved an UnknownHostException from callback");
}
+
+ // Invoke a second time to verify
+ // Create the callback for async responses
+ callback = new AsyncCallback<String>();
+
+ TestLogger.logger.debug(">> Invoking async (callback) Dispatch with Message Mode");
+ monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callback);
+
+ while (!monitor.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ if (callback.hasError()) {
+ Throwable t = callback.getError();
+ t.printStackTrace();
+
+ assertTrue(t.getClass().getName() + " does not match expected type ExecutionException", t instanceof ExecutionException);
+
+ Throwable cause = t.getCause();
+ assertNotNull("There must be a cause under the ExecutionException", cause);
+ assertTrue(cause.getClass().getName() + " does not match expected type WebServiceException" ,cause instanceof WebServiceException);
+
+ Throwable hostException = t.getCause().getCause();
+ assertNotNull("There must be a cause under the WebServiceException", hostException);
+ assertTrue(hostException.getClass().getName() + " does not match expected type UnknownHostException", hostException instanceof UnknownHostException);
+ } else {
+ fail("No fault thrown. Should have retrieved an UnknownHostException from callback");
+ }
}
public void testAsyncPollingPayloadMode_badHostName() throws Exception {
@@ -386,6 +564,27 @@
ttemp = t;
}
assertNotNull(ttemp);
+
+
+ // Invoke a second time to verify
+ TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
+ asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent);
+
+ while (!asyncResponse.isDone()) {
+ TestLogger.logger.debug(">> Async invocation still not complete");
+ Thread.sleep(1000);
+ }
+
+ ttemp = null;
+ try {
+ asyncResponse.get();
+ } catch (Throwable t) {
+ assertTrue(t instanceof ExecutionException);
+ assertTrue(t.getCause() instanceof WebServiceException);
+ assertTrue(t.getCause().getCause() instanceof UnknownHostException);
+ ttemp = t;
+ }
+ assertNotNull(ttemp);
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java Fri May 2 19:23:18 2008
@@ -40,23 +40,27 @@
return getTestSetup(new TestSuite(NonAnonymousComplexTypeTests.class));
}
- public void testSimpleProxy() {
+ public void testSimpleProxy() {
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try {
- String msg = "Hello Server";
- EchoMessagePortType myPort = (new EchoMessageService()).getEchoMessagePort();
- BindingProvider p = (BindingProvider) myPort;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ try {
+ String msg = "Hello Server";
+ EchoMessagePortType myPort = (new EchoMessageService()).getEchoMessagePort();
+ BindingProvider p = (BindingProvider) myPort;
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
- String response = myPort.echoMessage(msg);
+ String response = myPort.echoMessage(msg);
+ TestLogger.logger.debug(response);
+
+ // Try a second time to verify
+ response = myPort.echoMessage(msg);
TestLogger.logger.debug(response);
TestLogger.logger.debug("------------------------------");
- } catch (WebServiceException webEx) {
- webEx.printStackTrace();
- fail();
- }
- }
+ } catch (WebServiceException webEx) {
+ webEx.printStackTrace();
+ fail();
+ }
+ }
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java Fri May 2 19:23:18 2008
@@ -88,7 +88,14 @@
assertResponseXML(response, "Hello Response");
- System.out.println(response.toString());
+ System.out.println(response.toString());
+
+ // Try Again to verify
+ response = dispatch.invoke(request);
+
+ assertResponseXML(response, "Hello Response");
+
+ System.out.println(response.toString());
}
/**
@@ -113,7 +120,14 @@
assertResponseXML(response, "Hello Response");
- System.out.println(response.toString());
+ System.out.println(response.toString());
+
+ // Try again to verify
+ response = dispatch.invoke(request);
+
+ assertResponseXML(response, "Hello Response");
+
+ System.out.println(response.toString());
}
private SOAPElement assertResponseXML(SOAPMessage msg, String expectedText) throws Exception {
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java Fri May 2 19:23:18 2008
@@ -128,6 +128,11 @@
SendImageResponse response = (SendImageResponse) dispatch.invoke(request);
TestLogger.logger.debug(">> Response [" + response.toString() + "]");
+
+ // Try again to verify
+ response = (SendImageResponse) dispatch.invoke(request);
+
+ TestLogger.logger.debug(">> Response [" + response.toString() + "]");
}
/**
@@ -167,6 +172,11 @@
SendImageResponse response = (SendImageResponse) dispatch.invoke(request);
TestLogger.logger.debug(">> Response [" + response.toString() + "]");
+
+ // Try again to verify
+ response = (SendImageResponse) dispatch.invoke(request);
+
+ TestLogger.logger.debug(">> Response [" + response.toString() + "]");
}
/**
@@ -207,6 +217,11 @@
SendImage response = (SendImage) dispatch.invoke(request);
assertTrue(response != null);
+
+ // Try again to verify
+ response = (SendImage) dispatch.invoke(request);
+
+ assertTrue(response != null);
}
/**
@@ -244,6 +259,11 @@
SendImage response = (SendImage) dispatch.invoke(request);
assertTrue(response != null);
+
+ // Try again to verify
+ response = (SendImage) dispatch.invoke(request);
+
+ assertTrue(response != null);
}
/**
@@ -283,5 +303,10 @@
SendImage response = (SendImage) dispatch.invoke(request);
assertTrue(response != null);
+
+ // Try again to verify
+ response = (SendImage) dispatch.invoke(request);
+
+ assertTrue(response != null);
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java Fri May 2 19:23:18 2008
@@ -87,6 +87,15 @@
catch (Exception e) {
fail("Caught unexpected exception " + e.toString());
}
+
+ // Try again
+ // Test that a Provider receives the full fault. If not, it will throw an exception
+ try {
+ String response = dispatch.invoke(request);
+ }
+ catch (Exception e) {
+ fail("Caught unexpected exception " + e.toString());
+ }
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java?rev=652968&r1=652967&r2=652968&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java Fri May 2 19:23:18 2008
@@ -74,6 +74,13 @@
String string = AttachmentUtil.toString(response);
assertTrue(string.equalsIgnoreCase(AttachmentUtil.XML_HEADER
+ AttachmentUtil.msgEnvPlain));
+
+ // Try a second time
+ response = dispatch.invoke(message);
+
+ string = AttachmentUtil.toString(response);
+ assertTrue(string.equalsIgnoreCase(AttachmentUtil.XML_HEADER
+ + AttachmentUtil.msgEnvPlain));
} catch (Exception e) {
fail("Unexpected Exception: " + e.getMessage());
}
@@ -107,6 +114,14 @@
} catch (Exception e) {
// Expected path
}
+
+ // Try a second time
+ try {
+ dispatch.invoke(message);
+ fail("Should have received fault for not understood headers on request");
+ } catch (Exception e) {
+ // Expected path
+ }
}
/**
@@ -137,6 +152,14 @@
} catch (Exception e) {
// Expected path
}
+
+ // Try a second time
+ try {
+ dispatch.invoke(message);
+ fail("Should have received fault for not understood headers on response");
+ } catch (Exception e) {
+ // Expected path
+ }
}
/**
@@ -166,6 +189,13 @@
} catch (Exception e) {
fail("Should not have received fault for headers that were understood. " + e.getMessage());
}
+
+ // Try a second time
+ try {
+ dispatch.invoke(message);
+ } catch (Exception e) {
+ fail("Should not have received fault for headers that were understood. " + e.getMessage());
+ }
}
/**
@@ -195,5 +225,12 @@
} catch (Exception e) {
fail("Should not have received fault for headers that were understood. " + e.getMessage());
}
+
+ // Try a second time
+ try {
+ dispatch.invoke(message);
+ } catch (Exception e) {
+ fail("Should not have received fault for headers that were understood. " + e.getMessage());
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org