1   /*
2    * $Id: AxisServletBindingTestCase.java 12305 2008-07-11 20:13:23Z dandiep $
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.tck.providers.soap.AbstractSoapFunctionalTestCase;
14  import org.mule.transport.servlet.MuleReceiverServlet;
15  
16  import org.mortbay.jetty.Server;
17  import org.mortbay.jetty.nio.SelectChannelConnector;
18  import org.mortbay.jetty.servlet.ServletHandler;
19  
20  public class AxisServletBindingTestCase extends AbstractSoapFunctionalTestCase
21  {
22      public static final int HTTP_PORT = 62088;
23  
24      private Server httpServer;
25  
26      // @Override
27      protected void doSetUp() throws Exception
28      {
29          super.doSetUp();
30          httpServer = new Server();
31          SelectChannelConnector conn = new SelectChannelConnector();
32          conn.setPort(HTTP_PORT);
33          httpServer.addConnector(conn);
34  
35          ServletHandler handler = new ServletHandler();
36          handler.addServletWithMapping(MuleReceiverServlet.class, "/services/*");
37          
38          httpServer.addHandler(handler);
39          
40          httpServer.start();
41      }
42  
43      // @Override
44      protected void doTearDown() throws Exception
45      {
46          super.doTearDown();
47          // this generates an exception in GenericServlet which we can safely ignore
48          if (httpServer != null)
49          {
50              httpServer.stop();
51              httpServer.destroy();
52          }
53      }
54  
55      public String getConfigResources()
56      {
57          return "axis-test-servlet-mule-config.xml";
58      }
59  
60      protected String getRequestResponseEndpoint()
61      {
62          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=echo";
63      }
64  
65      protected String getReceiveEndpoint()
66      {
67          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getDate";
68      }
69  
70      protected String getReceiveComplexEndpoint()
71      {
72          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPerson&param=Fred";
73      }
74  
75      protected String getSendReceiveComplexEndpoint1()
76      {
77          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=addPerson";
78      }
79  
80      protected String getSendReceiveComplexEndpoint2()
81      {
82          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPerson&param=Dino";
83      }
84  
85      protected String getReceiveComplexCollectionEndpoint()
86      {
87          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPeople";
88      }
89  
90      protected String getDispatchAsyncComplexEndpoint1()
91      {
92          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=addPerson";
93      }
94  
95      protected String getDispatchAsyncComplexEndpoint2()
96      {
97          return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPerson&param=Betty";
98      }
99  
100     protected String getTestExceptionEndpoint()
101     {
102         return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getDate";
103     }
104 
105     protected String getWsdlEndpoint()
106     {
107         return "http://localhost:" + HTTP_PORT + "/services/mycomponent?wsdl";
108     }
109 }