Package com.openshift.client.configuration

Examples of com.openshift.client.configuration.IOpenShiftConfiguration


   * @throws FileNotFoundException
   * @throws IOException
   * @throws OpenShiftException
   */
  public IOpenShiftConnection getConnection(final String clientId, final String password) throws OpenShiftException {
    IOpenShiftConfiguration configuration = null;
    try {
      configuration = new OpenShiftConfiguration();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Failed to load OpenShift configuration file.");
    }
    return getConnection(clientId, configuration.getRhlogin(), password, configuration.getLibraServer());
  }
View Full Code Here


   * @throws IOException
   * @throws OpenShiftException
   */
  public IOpenShiftConnection getConnection(final String clientId, final String username, final String password)
      throws OpenShiftException {
    IOpenShiftConfiguration configuration;
    try {
      configuration = new OpenShiftConfiguration();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Failed to load OpenShift configuration file.");
    }
    return getConnection(clientId, username, password, configuration.getLibraServer());
  }
View Full Code Here

   * @throws FileNotFoundException
   * @throws IOException
   * @throws OpenShiftException
   */
  public IOpenShiftConnection getConnection(final String clientId, final String password) throws OpenShiftException {
    IOpenShiftConfiguration configuration = getConfiguration();
    return getConnection(clientId, configuration.getRhlogin(), password, configuration.getLibraServer());
  }
View Full Code Here

   * @throws FileNotFoundException
   * @throws IOException
   * @throws OpenShiftException
   */
  public IOpenShiftConnection getConnection(final String clientId, final String password) throws OpenShiftException {
    IOpenShiftConfiguration configuration = null;
    try {
      configuration = new OpenShiftConfiguration();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Failed to load OpenShift configuration file.");
    }
    return getConnection(clientId, configuration.getRhlogin(), password, configuration.getLibraServer());
  }
View Full Code Here

   * @throws IOException
   * @throws OpenShiftException
   */
  public IOpenShiftConnection getConnection(final String clientId, final String login, final String password)
      throws OpenShiftException {
    IOpenShiftConfiguration configuration;
    try {
      configuration = new OpenShiftConfiguration();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Failed to load OpenShift configuration file.");
    }
    return getConnection(clientId, login, password, configuration.getLibraServer());
  }
View Full Code Here

  @Test
  public void shouldRespectDefaultTimeout() throws Throwable {
    // pre-conditions
    final int timeout = 1000;
    final int serverDelay = timeout * 10000;
    IOpenShiftConfiguration configuration = new OpenShiftConfigurationFake(null,null,null,"5000");
    IHttpClient httpClient = new UrlConnectionHttpClientBuilder()
        .setAcceptMediaType(ACCEPT_APPLICATION_JSON)
        .setUserAgent("com.openshift.client.test")
        .setConfigTimeout(configuration.getTimeout())
        .client();
    WaitingHttpServerFake serverFake = startWaitingHttpServerFake(serverDelay);
    long startTime = System.currentTimeMillis();
    // operations
    try {
      httpClient.get(serverFake.getUrl(), IHttpClient.NO_TIMEOUT);
      fail("Timeout expected.");
    } catch (SocketTimeoutException e) {
      // assert
      assertThat(System.currentTimeMillis() - startTime)
          .isGreaterThan(configuration.getTimeout() - 20)
          .isLessThan(configuration.getTimeout() + 20);
    } finally {
      serverFake.stop();
    }
  }
View Full Code Here

  @Test
  public void shouldRespectSystemConfigurationTimeoutOverridingDefaultTimeout() throws Throwable {
    // pre-conditions
    final int timeout = 1000;
    final int serverDelay = timeout * 15;
    IOpenShiftConfiguration configuration = new OpenShiftConfigurationFake(null,null,"2000","1000");
    IHttpClient httpClient = new UrlConnectionHttpClientBuilder()
        .setAcceptMediaType(ACCEPT_APPLICATION_JSON)
        .setUserAgent("com.openshift.client.test")
        .setConfigTimeout(configuration.getTimeout())
        .client();
    WaitingHttpServerFake serverFake = startWaitingHttpServerFake(serverDelay);
    long startTime = System.currentTimeMillis();
    // operations
    try {
      httpClient.get(serverFake.getUrl(), IHttpClient.NO_TIMEOUT);
      fail("Timeout expected.");
    } catch (SocketTimeoutException e) {
      // assert
      assertThat(System.currentTimeMillis() - startTime)
          .isGreaterThan(configuration.getTimeout() - 20)
          .isLessThan(configuration.getTimeout() + 20);
    } finally {
      serverFake.stop();
    }
  }
View Full Code Here

  @Test
  public void shouldRespectUserConfigurationTimeoutOverridingSystemConfigurationTimeout() throws Throwable {
    // pre-conditions
    final int timeout = 1000;
    final int serverDelay = timeout * 15;
    IOpenShiftConfiguration configuration = new OpenShiftConfigurationFake(null,"3000","2000","1000");
    IHttpClient httpClient = new UrlConnectionHttpClientBuilder()
        .setAcceptMediaType(ACCEPT_APPLICATION_JSON)
        .setUserAgent("com.openshift.client.test")
        .setConfigTimeout(configuration.getTimeout())
        .client();
    WaitingHttpServerFake serverFake = startWaitingHttpServerFake(serverDelay);
    long startTime = System.currentTimeMillis();
    // operations
    try {
      httpClient.get(serverFake.getUrl(), IHttpClient.NO_TIMEOUT);
      fail("Timeout expected.");
    } catch (SocketTimeoutException e) {
      // assert
      assertThat(System.currentTimeMillis() - startTime)
          .isGreaterThan(configuration.getTimeout() - 20)
          .isLessThan(configuration.getTimeout() + 20);
    } finally {
      serverFake.stop();
    }
  }
View Full Code Here

  @Test
  public void shouldRespectSystemPropertiesTimeoutOverridingUserConfigurationTimeout() throws Throwable {
    // pre-conditions
    final int timeout = 1000;
    final int serverDelay = timeout * 15;
    IOpenShiftConfiguration configuration = new OpenShiftConfigurationFake("4000","3000","2000","1000");
    IHttpClient httpClient = new UrlConnectionHttpClientBuilder()
        .setAcceptMediaType(ACCEPT_APPLICATION_JSON)
        .setUserAgent("com.openshift.client.test")
        .setConfigTimeout(configuration.getTimeout())
        .client();
    WaitingHttpServerFake serverFake = startWaitingHttpServerFake(serverDelay);
    long startTime = System.currentTimeMillis();
    // operations
    try {
      httpClient.get(serverFake.getUrl(), IHttpClient.NO_TIMEOUT);
      fail("Timeout expected.");
    } catch (SocketTimeoutException e) {
      // assert
      assertThat(System.currentTimeMillis() - startTime)
          .isGreaterThan(configuration.getTimeout() - 20)
          .isLessThan(configuration.getTimeout() + 20);
    } finally {
      serverFake.stop();
    }
  }
View Full Code Here

   * @throws FileNotFoundException
   * @throws IOException
   * @throws OpenShiftException
   */
  public IOpenShiftConnection getConnection(final String clientId, final String password) throws OpenShiftException {
    IOpenShiftConfiguration configuration = getConfiguration();
    return getConnection(clientId, configuration.getRhlogin(), password, configuration.getLibraServer());
  }
View Full Code Here

TOP

Related Classes of com.openshift.client.configuration.IOpenShiftConfiguration

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.