Package com.openshift.client.utils

Examples of com.openshift.client.utils.TestConnectionBuilder


    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);
View Full Code Here


        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

        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

        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

  private HttpClientMockDirector mockDirector;

  @Before
  public void setup() throws Throwable {
    this.mockDirector = new HttpClientMockDirector();
    this.connection = new TestConnectionBuilder().defaultCredentials().create(mockDirector.client());
  }
View Full Code Here

  @Before
  public void setup() throws Throwable {
    IHttpClient client = new HttpClientMockDirector()
        .mockGetCartridges(Samples.GET_CARTRIDGES)
        .client();
    this.connection = new TestConnectionBuilder().defaultCredentials().create(client);
  }
View Full Code Here

  private IUser user;

  @Before
  public void setUp() throws Exception {
    this.user = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create().getUser();
  }
View Full Code Here

    IOpenShiftSSHKey key = null;
    int originalNumOfKeys = user.getSSHKeys().size();
    try {
      // pre-conditions
      String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
      IUser user = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create().getUser();
     
      // operation
      int newNumOfKeys = user.getSSHKeys().size();
      assertThat(user.getSSHKeys().size()).isEqualTo(originalNumOfKeys);
      String newKeyName = SSHKeyTestUtils.createRandomKeyName();
View Full Code Here

  @Before
  public void setup() throws Throwable {
    this.mockDirector = new HttpClientMockDirector();
    this.clientMock = mockDirector.mockGetDomains(Samples.GET_DOMAINS).client();
    this.user = new TestConnectionBuilder().defaultCredentials().create(clientMock).getUser();
    this.domain = user.getDomain("foobarz");
  }
View Full Code Here

  @Test
  public void shouldLoadEmptyListOfDomains() throws Throwable {
    // pre-conditions
    HttpClientMockDirector mockBuilder = new HttpClientMockDirector();
    IHttpClient clientMock =  mockBuilder.mockGetDomains(GET_DOMAINS_EMPTY).client();
    IUser user = new TestConnectionBuilder().defaultCredentials().create(clientMock).getUser();
    // operation
    final List<IDomain> domains = user.getDomains();
    // verifications
    assertThat(domains).hasSize(0);
    // 3 calls: /API + /API/user + /API/domains
View Full Code Here

TOP

Related Classes of com.openshift.client.utils.TestConnectionBuilder

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.