Hi,
I have written 50+ Integration Tests for the Google Drive Cloud Connector
using a ServiceClient to send messages to the ESB. I use the following
method to build the client:
public static OperationClient buildMEPClient(EndpointReference endpoint,
OMElement request) throws AxisFault {
ServiceClient serviceClient = new ServiceClient();
Options serviceOptions = new Options();
serviceOptions.setTo(endpoint);
serviceOptions.setAction("mediate");
serviceClient.setOptions(serviceOptions);
MessageContext messageContext = new MessageContext();
SOAPEnvelope soapEnvelope =
TransportUtils.createSOAPEnvelope(request);
messageContext.setEnvelope(soapEnvelope);
OperationClient mepClient =
serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
mepClient.addMessageContext(messageContext);
return mepClient;
}
after which I call mepClient.execute(true) to receive a response in the
following manner within each test:
mepClient = ConnectorIntegrationUtil.buildMEPClient(new EndpointReference(
getProxyServiceURL(CONNECTOR_NAME + "_" + methodName)),
requestEnvelope);
mepClient.execute(true);
MessageContext responseMsgCtx =
mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
However, when running this test suite, sometimes I receive random
NullPointerExceptions on different methods. Note that I do not get this
exception on the same test methods, rather I might get it on one or two
random methods during a single test run or I might not get it at all. The
stack trace for a typical occurrence is;
java.lang.NullPointerException
at
org.apache.axis2.context.AbstractContext.needPropertyDifferences(AbstractContext.java:239)
at
org.apache.axis2.context.AbstractContext.setProperty(AbstractContext.java:202)
at
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:270)
at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:398)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at
org.wso2.carbon.connector.integration.test.googledrive.GoogledriveConnectorIntegrationTest.testgetCommentByIDOptionalParams(GoogledriveConnectorIntegrationTest.java:1316)
In these instances, I have noticed that the correct response is returned by
the backend API via monitoring the wire log, however, the test will simply
fail giving the above stack trace.
Is there any way to overcome this issue?
Thanks.
--
View this message in context:
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Getting-random-NullPointerException-on-Operation-Client-during-Connector-Integration-Tests-tp93294.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev