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