View Javadoc

1   /*
2    * $Id: AjaxEmbeddedConnectorTestCase.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  package org.mule.transport.ajax;
11  
12  import org.mule.api.transport.Connector;
13  import org.mule.transport.AbstractConnectorTestCase;
14  import org.mule.transport.ajax.embedded.AjaxConnector;
15  
16  import java.net.URL;
17  
18  public class AjaxEmbeddedConnectorTestCase extends AbstractConnectorTestCase
19  {
20      @Override
21      public Connector createConnector() throws Exception
22      {
23          AjaxConnector c = new AjaxConnector(muleContext);
24          c.setName("test");
25          //By default the connector is not started until the servlet container is up.  We start it here because
26          //this test looks at the connector lifecycle
27          c.setInitialStateStopped(false);
28          c.setServerUrl(new URL("http://0.0.0.0:12345"));
29          return c;
30      }
31  
32      @Override
33      public Object getValidMessage() throws Exception
34      {
35          return "{\"value1\" : \"foo\", \"value2\" : \"bar\"}";
36      }
37  
38      @Override
39      public String getTestEndpointURI()
40      {
41          return "ajax:///request";
42      }
43  }