Search in sources :

Example 1 with ApiClient

use of bio.terra.buffer.client.ApiClient in project terra-workspace-manager by DataBiosphere.

the class BufferService method getApiClient.

private ApiClient getApiClient(String accessToken) {
    ApiClient client = new ApiClient().setHttpClient(commonHttpClient);
    client.setAccessToken(accessToken);
    return client;
}
Also used : ApiClient(bio.terra.buffer.client.ApiClient)

Example 2 with ApiClient

use of bio.terra.buffer.client.ApiClient in project terra-resource-buffer by DataBiosphere.

the class HandoutResource method userJourney.

@Override
public void userJourney(TestUserSpecification testUser) throws Exception {
    ApiClient apiClient = BufferServiceUtils.getClient(server);
    BufferApi bufferApi = new BufferApi(apiClient);
    String handoutRequestId = UUID.randomUUID().toString();
    logger.info("Generated handoutRequestId: {}", handoutRequestId);
    String projectId = retryHandout(bufferApi, handoutRequestId);
    successCount++;
    logger.info("project Id: {} for handoutRequestId: {}", projectId, handoutRequestId);
}
Also used : BufferApi(bio.terra.buffer.api.BufferApi) ApiClient(bio.terra.buffer.client.ApiClient)

Example 3 with ApiClient

use of bio.terra.buffer.client.ApiClient in project terra-resource-buffer by DataBiosphere.

the class HandoutResource method setup.

@Override
public void setup(List<TestUserSpecification> testUsers) throws Exception {
    // Verify pool is full before the test. If pool is not empty, poll until it is full.
    ApiClient apiClient = BufferServiceUtils.getClient(server);
    BufferApi bufferApi = new BufferApi(apiClient);
    poolSize = bufferApi.getPoolInfo(POOL_ID).getPoolConfig().getSize();
    // Poll until pool is full.
    pollUntilResourceCountExceeds(server, Duration.ofMinutes(30), poolSize);
    assertThat(bufferApi.getPoolInfo(POOL_ID).getResourceStateCount().get("READY"), greaterThanOrEqualTo(poolSize));
    beforeCount = bufferApi.getPoolInfo(POOL_ID).getResourceStateCount().get("READY");
}
Also used : BufferApi(bio.terra.buffer.api.BufferApi) ApiClient(bio.terra.buffer.client.ApiClient)

Example 4 with ApiClient

use of bio.terra.buffer.client.ApiClient in project terra-resource-buffer by DataBiosphere.

the class ServiceStatus method userJourney.

@Override
public void userJourney(TestUserSpecification testUser) throws Exception {
    ApiClient apiClient = BufferServiceUtils.getClient(server);
    UnauthenticatedApi unauthenticatedApi = new UnauthenticatedApi(apiClient);
    SystemStatus systemStatus = unauthenticatedApi.serviceStatus();
    logger.info("systemStatus: {}", systemStatus);
    int httpCode = unauthenticatedApi.getApiClient().getStatusCode();
    logger.info("Service status HTTP code: {}", httpCode);
}
Also used : SystemStatus(bio.terra.buffer.model.SystemStatus) ApiClient(bio.terra.buffer.client.ApiClient) UnauthenticatedApi(bio.terra.buffer.api.UnauthenticatedApi)

Example 5 with ApiClient

use of bio.terra.buffer.client.ApiClient in project terra-resource-buffer by DataBiosphere.

the class UnauthorizedAccess method userJourney.

@Override
public void userJourney(TestUserSpecification testUser) throws Exception {
    ApiClient apiClient = BufferServiceUtils.getClient(server);
    BufferApi bufferApi = new BufferApi(apiClient);
    try {
        retryHandout(bufferApi, UUID.randomUUID().toString());
        assertThat("Invalid SA account access not throwing exception", false);
    } catch (ApiException apiEx) {
        assertThat(apiEx.getCode(), equalTo(401));
    }
}
Also used : BufferApi(bio.terra.buffer.api.BufferApi) ApiClient(bio.terra.buffer.client.ApiClient) ApiException(bio.terra.buffer.client.ApiException)

Aggregations

ApiClient (bio.terra.buffer.client.ApiClient)8 BufferApi (bio.terra.buffer.api.BufferApi)5 ApiException (bio.terra.buffer.client.ApiException)2 PoolInfo (bio.terra.buffer.model.PoolInfo)2 UnauthenticatedApi (bio.terra.buffer.api.UnauthenticatedApi)1 SystemStatus (bio.terra.buffer.model.SystemStatus)1 AccessToken (com.google.auth.oauth2.AccessToken)1 GoogleCredentials (com.google.auth.oauth2.GoogleCredentials)1 Instant (java.time.Instant)1