Author: alessio.soldano(a)jboss.com
Date: 2008-05-13 13:00:59 -0400 (Tue, 13 May 2008)
New Revision: 7021
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java
Log:
[JBWS-2176] Removing MessageContext association once the test is over
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2008-05-13
14:22:33 UTC (rev 7020)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2008-05-13
17:00:59 UTC (rev 7021)
@@ -49,8 +49,8 @@
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.common.DOMUtils;
/**
* Test the SOAPBindingProvider
@@ -168,6 +168,11 @@
MessageContextAssociation.pushMessageContext(messageContext);
messageContext.setOperationMetaData(opMetaData);
}
+
+ protected void tearDown()
+ {
+ MessageContextAssociation.popMessageContext();
+ }
/** Test binding of the request message
*/
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2008-05-13
14:22:33 UTC (rev 7020)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2008-05-13
17:00:59 UTC (rev 7021)
@@ -142,55 +142,62 @@
OperationMetaData opMetaData = call.getOperationMetaData();
- // Associate a message context with the current thread
- SOAPMessageContextJAXRPC messageContext = new SOAPMessageContextJAXRPC();
- MessageContextAssociation.pushMessageContext(messageContext);
- messageContext.setOperationMetaData(opMetaData);
-
- CommonBindingProvider bindingProvider = new
CommonBindingProvider(CommonSOAPBinding.SOAP11HTTP_BINDING, Type.JAXRPC);
- CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
-
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- epInv.initInputParams(new Object[]{"Hello World!", "hi"});
-
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv,
null);
-
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
-
- reqMessage.saveChanges();
- reqMessage.writeTo(stream);
-
- ByteArrayInputStream in = new ByteArrayInputStream(stream.toByteArray());
-
- String type =
reqMessage.getMimeHeaders().getHeader(MimeConstants.CONTENT_TYPE)[0];
-
- MimeHeaders headers = new MimeHeaders();
- headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessageImpl msg2 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
-
- epInv = binding.unbindRequestMessage(opMetaData, msg2);
-
- assertEquals(epInv.getRequestParamValue(new
QName("String_1")).toString(), "Hello World!");
- assertEquals(epInv.getRequestParamValue(new QName("foo")).toString(),
"hi");
-
- epInv.setReturnValue("test");
-
- SOAPMessage responseMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData,
epInv);
-
- stream = new ByteArrayOutputStream();
- responseMessage.writeTo(stream);
-
- in = new ByteArrayInputStream(stream.toByteArray());
-
- type = responseMessage.getMimeHeaders().getHeader(MimeConstants.CONTENT_TYPE)[0];
-
- headers = new MimeHeaders();
- headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessageImpl msg3 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
-
- binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
-
- assertEquals("test", epInv.getReturnValue());
+ try
+ {
+ // Associate a message context with the current thread
+ SOAPMessageContextJAXRPC messageContext = new SOAPMessageContextJAXRPC();
+ MessageContextAssociation.pushMessageContext(messageContext);
+ messageContext.setOperationMetaData(opMetaData);
+
+ CommonBindingProvider bindingProvider = new
CommonBindingProvider(CommonSOAPBinding.SOAP11HTTP_BINDING, Type.JAXRPC);
+ CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
+
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+ epInv.initInputParams(new Object[]{"Hello World!", "hi"});
+
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData,
epInv, null);
+
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+
+ reqMessage.saveChanges();
+ reqMessage.writeTo(stream);
+
+ ByteArrayInputStream in = new ByteArrayInputStream(stream.toByteArray());
+
+ String type =
reqMessage.getMimeHeaders().getHeader(MimeConstants.CONTENT_TYPE)[0];
+
+ MimeHeaders headers = new MimeHeaders();
+ headers.addHeader(MimeConstants.CONTENT_TYPE, type);
+ SOAPMessageImpl msg2 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
+
+ epInv = binding.unbindRequestMessage(opMetaData, msg2);
+
+ assertEquals(epInv.getRequestParamValue(new
QName("String_1")).toString(), "Hello World!");
+ assertEquals(epInv.getRequestParamValue(new QName("foo")).toString(),
"hi");
+
+ epInv.setReturnValue("test");
+
+ SOAPMessage responseMessage =
(SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
+
+ stream = new ByteArrayOutputStream();
+ responseMessage.writeTo(stream);
+
+ in = new ByteArrayInputStream(stream.toByteArray());
+
+ type =
responseMessage.getMimeHeaders().getHeader(MimeConstants.CONTENT_TYPE)[0];
+
+ headers = new MimeHeaders();
+ headers.addHeader(MimeConstants.CONTENT_TYPE, type);
+ SOAPMessageImpl msg3 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
+
+ binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
+
+ assertEquals("test", epInv.getReturnValue());
+ }
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
}
public void testMimeMatchingAttachments() throws Exception
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java 2008-05-13
14:22:33 UTC (rev 7020)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java 2008-05-13
17:00:59 UTC (rev 7021)
@@ -112,7 +112,14 @@
public void testXOPContext()
{
SOAPMessageContextJAXRPC messageContext = new SOAPMessageContextJAXRPC();
- MessageContextAssociation.pushMessageContext(messageContext);
- assertFalse("MTOM should be disabled", XOPContext.isMTOMEnabled());
+ try
+ {
+ MessageContextAssociation.pushMessageContext(messageContext);
+ assertFalse("MTOM should be disabled", XOPContext.isMTOMEnabled());
+ }
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
}
}
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java 2008-05-13
14:22:33 UTC (rev 7020)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java 2008-05-13
17:00:59 UTC (rev 7021)
@@ -104,8 +104,15 @@
public void testXOPContext()
{
SOAPMessageContextJAXWS msgContext = new SOAPMessageContextJAXWS();
- MessageContextAssociation.pushMessageContext(msgContext);
- assertFalse("MTOM should be disabled", XOPContext.isMTOMEnabled());
+ try
+ {
+ MessageContextAssociation.pushMessageContext(msgContext);
+ assertFalse("MTOM should be disabled", XOPContext.isMTOMEnabled());
+ }
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
}
public void testNestedArray() throws Exception