Package org.mokai.connector.http

Examples of org.mokai.connector.http.HttpConfiguration


  @Test
  public void testMapperAndAdditionalQuery() throws Exception {
    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_OK);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");
    Map<String,String> additionalParams = new HashMap<String,String>();
    additionalParams.put("account", "german");
    additionalParams.put("password", "escobar");
    configuration.setAdditionalParams(additionalParams);

    Map<String,String> mapper = new HashMap<String,String>();
    mapper.put("to", "to1");
    mapper.put("from", "from1");
    mapper.put("text", "text1");
    configuration.setMapper(mapper);

    Message message = new Message();
    message.setProperty("to", "3002175604");
    message.setProperty("from", "3542");
    message.setProperty("text", "test");
View Full Code Here


  @Test
  public void shouldNotThrowExceptionOnFailure() throws Exception {
    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_BAD_REQUEST);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");
    configuration.setThrowExceptionOnFailure(false);

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());
  }
View Full Code Here

  @Test(expectedExceptions=HttpOperationFailedException.class)
  public void shouldThrowExceptionOnFailure() throws Exception {
    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_BAD_REQUEST);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());

  }
View Full Code Here

  @Test(expectedExceptions=HttpOperationFailedException.class)
  public void shouldFailUrlNotFound() throws Exception {
    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_NOT_FOUND);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());
  }
View Full Code Here

  @Test
  public void testDontThrowExceptionOnFailure() throws Exception {
    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_NOT_FOUND);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");
    configuration.setThrowExceptionOnFailure(false);

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());
  }
View Full Code Here

        try { Thread.sleep(5000); } catch (InterruptedException e) {}
      }

    });

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");
    configuration.setThrowExceptionOnFailure(false);
    configuration.setSocketTimeout(3000);

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());
  }
View Full Code Here

  }

  @Test(expectedExceptions=ConnectTimeoutException.class)
  public void shoudlThrowConnectionTimeoutException() throws Exception {

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://www.google.com:81/");
    configuration.setThrowExceptionOnFailure(false);
    configuration.setConnectionTimeout(3000);

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());
  }
View Full Code Here

TOP

Related Classes of org.mokai.connector.http.HttpConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.