PackagePullRequestSignal extends AbstractBaseHandler { @Override protected InvocationResponse doProcessing(final IMessageProcessingContext procCtx, final Logger log) throws AxisFault { IPullRequestEntity pullReq = procCtx.getSendingPullRequest(); if (pullReq == null) return InvocationResponse.CONTINUE; log.trace("Adding pull request signal to the message"); final SOAPHeaderBlock messaging = Messaging.getElement(procCtx.getParentContext().getEnvelope()); log.trace("Add eb:SignalMessage element to the existing eb:Messaging header"); PullRequestElement.createElement(messaging, pullReq); log.trace("eb:SignalMessage element for Pull Request succesfully added to header"); return InvocationResponse.CONTINUE; }    }
@Test public void testDoProcessing() throws Exception { SOAPEnvelope env = SOAPEnv.createEnvelope(SOAPEnv.SOAPVersion.SOAP_12); SOAPHeaderBlock messaging = Messaging.createElement(env); MessageContext mc = new MessageContext(); mc.setFLOW(MessageContext.OUT_FLOW); IMessageProcessingContext procCtx = MessageProcessingContext.getFromMessageContext(mc); try { mc.setEnvelope(env); } catch (AxisFault axisFault) { fail(axisFault.getMessage()); } PullRequest pullRequest = new PullRequest(); pullRequest.setMessageId(MessageIdUtils.createMessageId()); pullRequest.setMPC("http: StorageManager updateManager = HolodeckB2BCore.getStorageManager(); procCtx.setPullRequest(updateManager.storeOutGoingMessageUnit(pullRequest)); try { assertEquals(Handler.InvocationResponse.CONTINUE, new PackagePullRequestSignal().invoke(mc)); } catch (Exception e) { fail(e.getMessage()); } assertTrue(messaging.getChildElements().hasNext()); OMElement signalElem = (OMElement) messaging.getChildElements().next(); assertEquals("SignalMessage", signalElem.getLocalName()); assertEquals(EbMSConstants.EBMS3_NS_URI, signalElem.getNamespaceURI()); assertNotNull(signalElem.getFirstChildWithName(new QName(EbMSConstants.EBMS3_NS_URI, "PullRequest"))); OMElement msgInfoElem = signalElem.getFirstChildWithName(new QName(EbMSConstants.EBMS3_NS_URI, "MessageInfo")); assertNotNull(msgInfoElem); assertEquals(pullRequest.getMessageId(), msgInfoElem.getFirstChildWithName(new QName(EbMSConstants.EBMS3_NS_URI, "MessageId")).getText()); }