1   /*
2    * $Id: AxisConnectorHttpFunctionalTestCase.java 10961 2008-02-22 19:01:02Z dfeist $
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.soap.axis;
12  
13  import org.mule.api.MuleException;
14  import org.mule.api.endpoint.InboundEndpoint;
15  import org.mule.api.lifecycle.InitialisationException;
16  import org.mule.api.service.Service;
17  import org.mule.config.ExceptionHelper;
18  import org.mule.tck.MuleTestUtils;
19  import org.mule.tck.providers.soap.AbstractSoapUrlEndpointFunctionalTestCase;
20  
21  public class AxisConnectorHttpFunctionalTestCase extends AbstractSoapUrlEndpointFunctionalTestCase
22  {
23      public static class ComponentWithoutInterfaces
24      {
25          public String echo(String msg)
26          {
27              return msg;
28          }
29      }
30  
31      public String getConfigResources()
32      {
33          return "axis-" + getTransportProtocol() + "-mule-config.xml";
34      }
35  
36      protected String getTransportProtocol()
37      {
38          return "http";
39      }
40  
41      protected String getSoapProvider()
42      {
43          return "axis";
44      }
45  
46      /**
47       * The Axis service requires that the service implements at least one interface
48       * This just tests that we get the correct exception if no interfaces are
49       * implemented
50       * 
51       * @throws Throwable
52       */
53      public void testComponentWithoutInterfaces() throws Throwable
54      {
55          try
56          {
57              // TODO MULE-2228 Simplify this API
58              Service c = MuleTestUtils.getTestService("testComponentWithoutInterfaces", ComponentWithoutInterfaces.class, null, muleContext, false);
59              InboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(getComponentWithoutInterfacesEndpoint());
60              c.getInboundRouter().addEndpoint(ep);
61              muleContext.getRegistry().registerService(c);
62              fail("Expected exception");
63          }
64          catch (MuleException e)
65          {
66              e = ExceptionHelper.getRootMuleException(e);
67              assertTrue(e instanceof InitialisationException);
68              assertTrue(e.getMessage(), e.getMessage().indexOf("must implement at least one interface") > -1);
69          }
70      }
71  }