Examples of IOpenShiftConnection


Examples of com.openshift.client.IOpenShiftConnection

    // pre-conditions
    IAuthorization authorization = user.createAuthorization("my note", IAuthorization.SCOPE_SESSION);
    assertNotNull(authorization.getToken());

    // operations
    IOpenShiftConnection connection =
        new TestConnectionBuilder().token(authorization.getToken()).create();
    authorization = connection.getUser().getAuthorization();

    // verifications
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);
    assertEquals(authorization.getNote(), "my note");
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

    // pre-conditions
    IAuthorization authorization = user.createAuthorization("my note", IAuthorization.SCOPE_SESSION, 600);
    assertNotNull(authorization.getToken());

    // operations
    IOpenShiftConnection connection =
        new TestConnectionBuilder().token(authorization.getToken()).create();
    authorization = connection.getUser().getAuthorization();

    // verifications
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);
    assertEquals(authorization.getNote(), "my note");
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

  private IDomain domain;
  private IApplication application;

  @Before
  public void setUp() throws Exception {
    IOpenShiftConnection connection = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create();
    this.user = connection.getUser();
    this.domain = DomainTestUtils.ensureHasDomain(user);
    ApplicationTestUtils.silentlyDestroyAllApplications(domain);
    this.application = ApplicationTestUtils.getOrCreateApplication(domain);
  }
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

  // TODO: add tests for expired tokens
  private IUser user;

  @Before
  public void setUp() throws HttpClientException, OpenShiftException, IOException {
    final IOpenShiftConnection connection = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create();
    this.user = connection.getUser();
  }
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

    IAuthorization authorization = user.getAuthorization();
    assertNotNull(authorization.getToken());
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);

    // operations
    IOpenShiftConnection connection =
        new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();
    authorization = connection.getUser().getAuthorization();
   
    // verifications
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);

    authorization.destroy();
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

    IAuthorization authorization = user.createAuthorization("my note", IAuthorization.SCOPE_SESSION);
    assertNotNull(authorization.getToken());
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);

    // operations
    IOpenShiftConnection connection =
        new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();
    authorization = connection.getUser().getAuthorization();

    // verifications
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);
    assertEquals(authorization.getNote(), "my note");
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

    IAuthorization authorization = user.createAuthorization("my note", IAuthorization.SCOPE_SESSION, 600);
    assertNotNull(authorization.getToken());
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);

    // operations
    IOpenShiftConnection connection =
        new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();

    authorization = connection.getUser().getAuthorization();

    // verifications
    assertEquals(authorization.getScopes(), IAuthorization.SCOPE_SESSION);
    assertEquals(authorization.getNote(), "my note");
        //check for time remaining on the token now
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

        assertNotNull(authorization.getToken());
        assertEquals(authorization.getScopes(), IAuthorization.SCOPE_READ);

        try {
        //read scope should not be allowed to create new authorizations
        IOpenShiftConnection connection =
            new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();
        connection.getUser().createAuthorization("shouldn't be allowed", IAuthorization.SCOPE_SESSION, 600);
        //should never get here
        assertTrue(false);
        } catch (OpenShiftEndpointException ex){
            assertThat(ex.getMessage(), StringContains.containsString("This action is not allowed with your current authorization"));
        }
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

        assertNotNull(authorization.getToken());
        assertEquals(authorization.getScopes(), IAuthorization.SCOPE_USERINFO);

        try {
            //userinfo scope should not be allowed to obtain SSH keys
      IOpenShiftConnection connection =
          new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();
      connection.getUser().getSSHKeys();
            //should never get here
            assertTrue(false);
        } catch (OpenShiftEndpointException ex){
            assertThat(ex.getMessage(), StringContains.containsString("This action is not allowed with your current authorization"));
        }
View Full Code Here

Examples of com.openshift.client.IOpenShiftConnection

        //sleep for 5 seconds
        Thread.sleep(5000);

        try {
            //an expired token should fail getting user info
            IOpenShiftConnection connection =
                new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();
            connection.getUser();
            //should never get here
            assertTrue(false);
        } catch (OpenShiftEndpointException ex){
            assertThat(ex.getMessage(), StringContains.containsString("Your credentials are not authorized to access"));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.