protected MessageContext getTestContext() {
SynapseConfiguration testConfig = new SynapseConfiguration();
SynapseEnvironment synEnv = new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()),
testConfig);
org.apache.axis2.context.MessageContext msgCtx = new org.apache.axis2.context.MessageContext();
MessageContext synCtx = new Axis2MessageContext(msgCtx, testConfig, synEnv);
SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
try {
envelope.getBody().addChild(AXIOMUtil.stringToOM(PAYLOAD));
SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
OMNamespace omNs = soapFactory.createOMNamespace(
ActivityPublisherConstants.BAM_ACTIVITY_ID_HEADER_NAMESPACE_URI, "ns");
SOAPHeaderBlock soapHeaderBlock = envelope.getHeader().addHeaderBlock(
"BAMEvent", omNs);
soapHeaderBlock.addAttribute("activityID", ACTIVITY_ID, null);
synCtx.setEnvelope(envelope);
} catch (Exception ignored) {
}
msgCtx.setAxisService(new AxisService(SERVICE));