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