View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.ajax;
8   
9   import org.mule.api.transport.Connector;
10  import org.mule.transport.AbstractConnectorTestCase;
11  import org.mule.transport.ajax.embedded.AjaxConnector;
12  
13  import java.net.URL;
14  
15  public class AjaxEmbeddedConnectorTestCase extends AbstractConnectorTestCase
16  {
17      @Override
18      public Connector createConnector() throws Exception
19      {
20          AjaxConnector c = new AjaxConnector(muleContext);
21          c.setName("test");
22          //By default the connector is not started until the servlet container is up.  We start it here because
23          //this test looks at the connector lifecycle
24          c.setInitialStateStopped(false);
25          c.setServerUrl(new URL("http://0.0.0.0:12345"));
26          return c;
27      }
28  
29      @Override
30      public Object getValidMessage() throws Exception
31      {
32          return "{\"value1\" : \"foo\", \"value2\" : \"bar\"}";
33      }
34  
35      @Override
36      public String getTestEndpointURI()
37      {
38          return "ajax:///request";
39      }
40  }