@Test
public void testDoProcessing() throws Exception {

    PMode pmode = TestUtils.create1WaySendPushPMode();        
    Leg leg = pmode.getLeg(Label.REQUEST);
    UserMessageFlow umFlow = new UserMessageFlow();
    PayloadProfile plProfile = new PayloadProfile();
    plProfile.setCompressionType(CompressionFeature.COMPRESSED_CONTENT_TYPE);
    umFlow.setPayloadProfile(plProfile);
    leg.setUserMessageFlow(umFlow);
    HolodeckB2BCoreInterface.getPModeSet().add(pmode);
    UserMessage userMessage = new UserMessage();
    userMessage.setPModeId(pmode.getId());
    Payload payload = new Payload();
    payload.setContainment(IPayload.Containment.ATTACHMENT);
    String payloadPath = "file://./uncompressed.jpg";
    payload.setPayloadURI(payloadPath);
    userMessage.addPayload(payload);
    MessageContext mc = new MessageContext();
    mc.setFLOW(MessageContext.OUT_FLOW);
    Attachments attachments = new Attachments();
    DataHandler attDataHandler = new DataHandler(new URL(payload.getPayloadURI()));
    attachments.addDataHandler(payloadPath, attDataHandler);
    mc.setAttachmentMap(attachments);
    IUserMessageEntity userMessageEntity =
            HolodeckB2BCore.getStorageManager().storeOutGoingMessageUnit(userMessage);
    
    IMessageProcessingContext procCtx = MessageProcessingContext.getFromMessageContext(mc);
    procCtx.setUserMessage(userMessageEntity);
    try {
        Handler.InvocationResponse invokeResp = new CompressionHandler().invoke(mc);
        assertEquals(Handler.InvocationResponse.CONTINUE, invokeResp);
    } catch (Exception e) {
        fail(e.getMessage());
    }
    // Check that attachment payload contains compression enabling properties
    for (final IPayload p : userMessageEntity.getPayloads()) {
        // Only payloads contained in attachment can use compression
        if (p.getContainment() == IPayload.Containment.ATTACHMENT) {
            Collection<IProperty> properties = p.getProperties();
            assertNotNull(properties);
            Iterator<IProperty> it = properties.iterator();
            IProperty property = it.next();
            assertEquals(CompressionFeature.FEATURE_PROPERTY_NAME,
                    property.getName());
            assertEquals(CompressionFeature.COMPRESSED_CONTENT_TYPE,
                    property.getValue());
            property = it.next();
            assertEquals(CompressionFeature.MIME_TYPE_PROPERTY_NAME,
                    property.getName());
            assertEquals(attDataHandler.getContentType(),
                    property.getValue());
            assertTrue(mc.getAttachment(p.getPayloadURI()) instanceof CompressionDataHandler);
            assertEquals(CompressionFeature.COMPRESSED_CONTENT_TYPE, 
            				mc.getAttachment(p.getPayloadURI()).getContentType()); 
                    
        }
    }
}