View Javadoc

1   /*
2    * $Id: FeaturesTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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  }