Package org.mokai.connector.http

Examples of org.mokai.connector.http.HttpConfiguration


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

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

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


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

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

    Message message = new Message();
    message.setProperty("from", "3542");

    HttpConnector connector = new HttpConnector(configuration);
View Full Code Here

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

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://invalid:port/");

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

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

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("htp://invalidscheme/");

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

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

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

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

  public void shouldNotConfigureWithNullUrl() throws Exception {

    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_OK);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();

    HttpConnector connector = new HttpConnector(configuration);
    connector.configure();

  }
View Full Code Here

  public void shouldNotProcessWithNullUrl() throws Exception {

    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_OK);
    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();

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

  }
View Full Code Here

  public void shouldNotConfigureUnknownHttpMethod() throws Exception {

    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_OK);
    testServer.register("/", mockHandler);

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

    HttpConnector connector = new HttpConnector(configuration);
    connector.configure();

  }
View Full Code Here

  public void shouldNotProcessUnknownHttpMethod() throws Exception {

    MockRequestHandler mockHandler = new MockRequestHandler(HttpStatus.SC_OK);
    testServer.register("/", mockHandler);

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

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

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

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");
    configuration.setMethod("GET");
    configuration.setBasicAuth(true);
    configuration.setUsername("german");
    configuration.setPassword("password");

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

    Header header = mockHandler.getHeader("Authorization");
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.