Package com.openshift.client.fakes

Examples of com.openshift.client.fakes.HttpServerFake


    }
  }

  @Test
  public void shouldHaveURLInExceptionMessage() throws Exception {
    HttpServerFake server = null;
    try {
      // precondition
      this.serverFake.stop();
      // RFC 1945 6.1.1 / Reason Phrase is optional
      server = startHttpServerFake("HTTP/1.0 404 Not Found");

      // operation
      httpClient.get(server.getUrl(), IHttpClient.NO_TIMEOUT);
      fail("Expected NotFoundException not thrown");
    } catch (NotFoundException e) {
      assertTrue(e.getMessage().contains(server.getUrl().toString()));
    } finally {
      server.stop();
    }
  }
View Full Code Here


    assertThat(connection.getSupportedCiphers()).isEqualTo(connection.getFilteredCiphers());
  }
 
  private HttpServerFake startHttpServerFake(String statusLine) throws Exception {
    int port = new Random().nextInt(9 * 1024) + 1024;
    HttpServerFake serverFake = null;
    if (statusLine == null) {
      serverFake = new HttpServerFake(port);
    } else {
      serverFake = new HttpServerFake(port, null, statusLine);
    }
    serverFake.start();
    return serverFake;
  }
View Full Code Here

    assertThat(clientFake.getAcceptHeader(connection)).endsWith("; version=" + version);
  }

  @Test(expected = NotFoundException.class)
  public void shouldThrowNotFoundException() throws Exception {
    HttpServerFake server = null;
    try {
      // precondition
      this.serverFake.stop();
      server = startHttpServerFake("HTTP/1.0 404 Not Found");

      // operation
      httpClient.get(server.getUrl(), IHttpClient.NO_TIMEOUT);
    } finally {
      server.stop();
    }
  }
View Full Code Here

   *
   * @throws IOException
   */
  @Test(expected = NotFoundException.class)
  public void shouldReasonPhraseIsOptional() throws Exception {
    HttpServerFake server = null;
    try {
      // precondition
      this.serverFake.stop();
      // RFC 1945 6.1.1 / Reason Phrase is optional
      server = startHttpServerFake("HTTP/1.0 404 ");

      // operation
      httpClient.get(server.getUrl(), IHttpClient.NO_TIMEOUT);
    } finally {
      server.stop();
    }
  }
View Full Code Here

TOP

Related Classes of com.openshift.client.fakes.HttpServerFake

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.