Search in sources :

Example 1 with MessageHeaderFilter

use of org.apache.camel.component.cxf.common.header.MessageHeaderFilter in project camel by apache.

the class CxfMessageHeadersRelayTest method testMessageHeadersRelaysSpringContext.

@Test
public void testMessageHeadersRelaysSpringContext() throws Exception {
    CxfEndpoint endpoint = context.getEndpoint("cxf:bean:serviceExtraRelays?headerFilterStrategy=#customMessageFilterStrategy", CxfEndpoint.class);
    CxfHeaderFilterStrategy strategy = (CxfHeaderFilterStrategy) endpoint.getHeaderFilterStrategy();
    List<MessageHeaderFilter> filters = strategy.getMessageHeaderFilters();
    assertEquals("Expected number of filters ", 2, filters.size());
    Map<String, MessageHeaderFilter> messageHeaderFilterMap = strategy.getMessageHeaderFiltersMap();
    for (String ns : new CustomHeaderFilter().getActivationNamespaces()) {
        assertEquals("Expected a filter class for namespace: " + ns, CustomHeaderFilter.class, messageHeaderFilterMap.get(ns).getClass());
    }
}
Also used : MessageHeaderFilter(org.apache.camel.component.cxf.common.header.MessageHeaderFilter) CxfHeaderFilterStrategy(org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) Test(org.junit.Test)

Aggregations

CxfEndpoint (org.apache.camel.component.cxf.CxfEndpoint)1 CxfHeaderFilterStrategy (org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy)1 MessageHeaderFilter (org.apache.camel.component.cxf.common.header.MessageHeaderFilter)1 Test (org.junit.Test)1