Search in sources :

Example 1 with FlowIdProducerIn

use of org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn in project tesb-rt-se by Talend.

the class EventFeatureImpl method initializeProvider.

/* (non-Javadoc)
     * @see org.apache.cxf.feature.AbstractFeature#initializeProvider(org.apache.cxf.interceptor.InterceptorProvider, org.apache.cxf.Bus)
     */
@Override
protected void initializeProvider(InterceptorProvider provider, Bus bus) {
    super.initializeProvider(provider, bus);
    FlowIdProducerIn<Message> flowIdProducerIn = new FlowIdProducerIn<Message>();
    provider.getInInterceptors().add(flowIdProducerIn);
    provider.getInFaultInterceptors().add(flowIdProducerIn);
    FlowIdProducerOut<Message> flowIdProducerOut = new FlowIdProducerOut<Message>();
    provider.getOutInterceptors().add(flowIdProducerOut);
    provider.getOutFaultInterceptors().add(flowIdProducerOut);
    WireTapIn wireTapIn = new WireTapIn(logMessageContent);
    provider.getInInterceptors().add(wireTapIn);
    provider.getInInterceptors().add(epi);
    provider.getInFaultInterceptors().add(epi);
    WireTapOut wireTapOut = new WireTapOut(epi, logMessageContent);
    provider.getOutInterceptors().add(wireTapOut);
    provider.getOutFaultInterceptors().add(wireTapOut);
}
Also used : Message(org.apache.cxf.message.Message) WireTapOut(org.talend.esb.sam.agent.wiretap.WireTapOut) FlowIdProducerOut(org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerOut) WireTapIn(org.talend.esb.sam.agent.wiretap.WireTapIn) FlowIdProducerIn(org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn)

Example 2 with FlowIdProducerIn

use of org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn in project tesb-rt-se by Talend.

the class FlowIdProducerTest method flowIdProducerIn2Test.

@Test
public void flowIdProducerIn2Test() {
    FlowIdProducerIn<Message> flowIdProducerIn = new FlowIdProducerIn<Message>();
    Message message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    String flowId = FlowIdHelper.getFlowId(message);
    Assert.assertNull("FlowId should be null before FlowIdProducerIn handleMessage()", flowId);
    Map<String, List<String>> headers = new HashMap<String, List<String>>();
    headers.put("flowid", Arrays.asList("flowid"));
    message.put(Message.PROTOCOL_HEADERS, headers);
    flowIdProducerIn.handleMessage(message);
    flowId = FlowIdHelper.getFlowId(message);
    Assert.assertNotNull("FlowId should not be null after FlowIdProducerIn handleMessage()", flowId);
}
Also used : Exchange(org.apache.cxf.message.Exchange) Message(org.apache.cxf.message.Message) HashMap(java.util.HashMap) List(java.util.List) FlowIdProducerIn(org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Test(org.junit.Test)

Example 3 with FlowIdProducerIn

use of org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn in project tesb-rt-se by Talend.

the class FlowIdProducerTest method flowIdProducerInTest.

@Test
public void flowIdProducerInTest() {
    FlowIdProducerIn<Message> flowIdProducerIn = new FlowIdProducerIn<Message>();
    Message message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    String flowId = FlowIdHelper.getFlowId(message);
    Assert.assertNull("FlowId should be null before FlowIdProducerIn handleMessage()", flowId);
    flowIdProducerIn.handleMessage(message);
    flowId = FlowIdHelper.getFlowId(message);
    Assert.assertNotNull("FlowId should not be null after FlowIdProducerIn handleMessage()", flowId);
}
Also used : Exchange(org.apache.cxf.message.Exchange) Message(org.apache.cxf.message.Message) FlowIdProducerIn(org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Test(org.junit.Test)

Aggregations

Message (org.apache.cxf.message.Message)3 FlowIdProducerIn (org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerIn)3 Exchange (org.apache.cxf.message.Exchange)2 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)2 MessageImpl (org.apache.cxf.message.MessageImpl)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 List (java.util.List)1 FlowIdProducerOut (org.talend.esb.sam.agent.flowidprocessor.FlowIdProducerOut)1 WireTapIn (org.talend.esb.sam.agent.wiretap.WireTapIn)1 WireTapOut (org.talend.esb.sam.agent.wiretap.WireTapOut)1