1   /*
2    * $Id: ConfigurationTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.transport.cxf;
12  
13  import org.mule.api.transport.Connector;
14  import org.mule.tck.FunctionalTestCase;
15  import org.mule.transport.cxf.CxfConnector;
16  
17  import java.util.Collection;
18  import java.util.Iterator;
19  
20  import org.apache.cxf.Bus;
21  import org.apache.cxf.interceptor.Interceptor;
22  import org.apache.cxf.interceptor.LoggingInInterceptor;
23  
24  public class ConfigurationTestCase extends FunctionalTestCase
25  {
26      public void testBusConfiguration() throws Exception
27      {
28          boolean found = false;
29          Collection connectors = muleContext.getRegistry().lookupObjects(Connector.class);
30          for (Iterator itr = connectors.iterator(); itr.hasNext();)
31          {
32              Connector c = (Connector) itr.next();
33  
34              if (c instanceof CxfConnector)
35              {
36                  System.out.println("Found connector");
37  
38                  Bus cxfBus = ((CxfConnector) c).getCxfBus();
39  
40                  for (Iterator itr2 = cxfBus.getInInterceptors().iterator(); itr2.hasNext();)
41                  {
42                      Interceptor i = (Interceptor) itr2.next();
43                      if (i instanceof LoggingInInterceptor)
44                      {
45                          found = true;
46                          break;
47                      }
48                  }
49              }
50          }
51  
52          assertTrue("Did not find logging interceptor.", found);
53      }
54  
55      protected String getConfigResources()
56      {
57          return "configuration-conf.xml";
58      }
59  
60  }