@Test
public void testDoProcessing() throws Exception {


	PMode pmode = TestUtils.create1WaySendPushPMode();        
    Leg leg = pmode.getLeg(Label.REQUEST);
    ReceiptConfiguration receiptConfiguration = new ReceiptConfiguration();
    leg.setReceiptConfiguration(receiptConfiguration);
    
    HolodeckB2BCore.getPModeSet().add(pmode);
    MessageContext mc = new MessageContext();
    mc.setFLOW(MessageContext.IN_FLOW);
    StorageManager storageManager = HolodeckB2BCore.getStorageManager();
    // Setting input message property
    UserMessage userMessage = new UserMessage();
    userMessage.setMessageId(MessageIdUtils.createMessageId());
    userMessage.setPModeId(pmode.getId());
    
    IUserMessageEntity userMessageEntity = storageManager.storeOutGoingMessageUnit(userMessage);
    storageManager.setProcessingState(userMessageEntity, ProcessingState.AWAITING_RECEIPT);
    
    // Setting input receipts property
    Receipt receipt = new Receipt();
    receipt.setRefToMessageId(userMessage.getMessageId());
    receipt.setMessageId(MessageIdUtils.createMessageId());
    
    IReceiptEntity receiptEntity = storageManager.storeIncomingMessageUnit(receipt);
    
    IMessageProcessingContext procCtx = MessageProcessingContext.getFromMessageContext(mc);
    procCtx.addReceivedReceipt(receiptEntity);
    
    try {           
        assertEquals(Handler.InvocationResponse.CONTINUE, new ProcessReceipts().invoke(mc));
    } catch (Exception e) {
        fail(e.getMessage());
    }
    
    assertEquals(ProcessingState.DELIVERED, HolodeckB2BCoreInterface.getQueryManager()
    												.getMessageUnitsWithId(userMessage.getMessageId())
    												.iterator().next().getCurrentProcessingState().getState());        												
    assertEquals(ProcessingState.READY_FOR_DELIVERY, receiptEntity.getCurrentProcessingState().getState());        
}