StartProcessingUsrMessage extends AbstractUserMessageHandler { @Override protected InvocationResponse doProcessing(final IUserMessageEntity um, final IMessageProcessingContext procCtx, final Logger log) throws PersistenceException { final String msgId = um.getMessageId(); log.trace("Change processing state to indicate start of processing of message [" + msgId + "]" ); if (!HolodeckB2BCore.getStorageManager().setProcessingState(um, ProcessingState.RECEIVED, ProcessingState.PROCESSING)) { log.warn("User message [msgId= " + msgId + "] is already being processed"); procCtx.setUserMessage(null); } else log.trace("User message [msgId= " + msgId + "] is ready for processing"); return InvocationResponse.CONTINUE; }    }
@Test public void testDoProcessing() throws Exception { MessageContext mc = new MessageContext(); mc.setFLOW(MessageContext.IN_FLOW); StorageManager updateManager = HolodeckB2BCore.getStorageManager(); IUserMessageEntity userMessageEntity = updateManager.storeIncomingMessageUnit(new UserMessage()); IMessageProcessingContext procCtx = MessageProcessingContext.getFromMessageContext(mc); procCtx.setUserMessage(userMessageEntity); try { assertEquals(InvocationResponse.CONTINUE, new StartProcessingUsrMessage().invoke(mc)); } catch (Exception e) { fail(e.getMessage()); } assertEquals(ProcessingState.PROCESSING, userMessageEntity.getCurrentProcessingState().getState()); }