1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.cxf;
12
13 import org.mule.api.endpoint.ImmutableEndpoint;
14 import org.mule.api.processor.MessageProcessor;
15 import org.mule.module.cxf.builder.WebServiceMessageProcessorBuilder;
16 import org.mule.module.cxf.config.FlowConfiguringMessageProcessor;
17 import org.mule.tck.FunctionalTestCase;
18
19 import java.util.List;
20
21 import org.apache.cxf.feature.AbstractFeature;
22 import org.apache.cxf.feature.LoggingFeature;
23
24 public class FeaturesTestCase extends FunctionalTestCase
25 {
26
27 @Override
28 protected String getConfigResources()
29 {
30 return "features-test.xml";
31 }
32
33 public void testFeatures() throws Exception
34 {
35 ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointBuilder("endpoint").buildInboundEndpoint();
36 assertNotNull(endpoint);
37
38 List<MessageProcessor> mps = endpoint.getMessageProcessors();
39 assertTrue(mps.get(0) instanceof FlowConfiguringMessageProcessor);
40
41 FlowConfiguringMessageProcessor mp = (FlowConfiguringMessageProcessor) mps.get(0);
42 WebServiceMessageProcessorBuilder builder = (WebServiceMessageProcessorBuilder) mp.getMessageProcessorBuilder();
43
44 List<AbstractFeature> features = builder.getFeatures();
45 assertNotNull(features);
46 boolean found = false;
47 for (AbstractFeature f : features)
48 {
49 if (f instanceof LoggingFeature)
50 {
51 found = true;
52 break;
53 }
54 }
55 assertTrue(found);
56 }
57
58 }