Search in sources :

Example 6 with CloudbreakClient

use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.

the class ClusterTemplateTest method validateDefaultCount.

private ClusterTemplateTestDto validateDefaultCount(TestContext tc, ClusterTemplateTestDto entity, CloudbreakClient cc) {
    try {
        assertNotNull(entity);
        assertNotNull(entity.getResponses());
        long defaultCount = entity.getResponses().stream().filter(template -> ResourceStatus.DEFAULT.equals(template.getStatus())).count();
        long expectedCount = 602;
        assertEquals("Should have " + expectedCount + " of default cluster templates.", expectedCount, defaultCount);
    } catch (Exception e) {
        throw new TestFailException(String.format("Failed to validate default count of cluster templates: %s", e.getMessage()), e);
    }
    return entity;
}
Also used : ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) DistroXTemplateTestDto(com.sequenceiq.it.cloudbreak.dto.clustertemplate.DistroXTemplateTestDto) ResourceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) ClusterTemplateTestDto(com.sequenceiq.it.cloudbreak.dto.clustertemplate.ClusterTemplateTestDto) Test(org.testng.annotations.Test) StringUtils(org.apache.commons.lang3.StringUtils) MockCloudProvider(com.sequenceiq.it.cloudbreak.cloud.v4.mock.MockCloudProvider) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) DistroXNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXNetworkTestDto) StackTemplateTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTemplateTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) BadRequestException(javax.ws.rs.BadRequestException) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ClusterTemplateAuditGrpcServiceAssertion(com.sequenceiq.it.cloudbreak.assertion.audit.ClusterTemplateAuditGrpcServiceAssertion) Assert.assertNotNull(org.junit.Assert.assertNotNull) PlacementSettingsTestDto(com.sequenceiq.it.cloudbreak.dto.PlacementSettingsTestDto) DistroXClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.clouderamanager.DistroXClouderaManagerTestDto) ClusterTemplateV4Type(com.sequenceiq.cloudbreak.api.endpoint.v4.clustertemplate.ClusterTemplateV4Type) LdapTestClient(com.sequenceiq.it.cloudbreak.client.LdapTestClient) ClusterTemplateTestAssertion(com.sequenceiq.it.cloudbreak.assertion.clustertemplate.ClusterTemplateTestAssertion) NotFoundException(javax.ws.rs.NotFoundException) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) ClusterTemplateTestClient(com.sequenceiq.it.cloudbreak.client.ClusterTemplateTestClient) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) DistroXTestClient(com.sequenceiq.it.cloudbreak.client.DistroXTestClient) RunningParameter(com.sequenceiq.it.cloudbreak.context.RunningParameter) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) RecipeTestClient(com.sequenceiq.it.cloudbreak.client.RecipeTestClient) RunningParameter.expectedMessage(com.sequenceiq.it.cloudbreak.context.RunningParameter.expectedMessage) Assert.assertEquals(org.junit.Assert.assertEquals) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) BadRequestException(javax.ws.rs.BadRequestException) NotFoundException(javax.ws.rs.NotFoundException)

Example 7 with CloudbreakClient

use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.

the class TestContext method as.

public TestContext as(CloudbreakUser cloudbreakUser) {
    checkShutdown();
    LOGGER.info(" Acting user as: \ndisplay name: {} \naccess key: {} \nsecret key: {} \ncrn: {} \nadmin: {} ", cloudbreakUser.getDisplayName(), cloudbreakUser.getAccessKey(), cloudbreakUser.getSecretKey(), cloudbreakUser.getCrn(), cloudbreakUser.getAdmin());
    Log.as(LOGGER, cloudbreakUser.toString());
    setActingUser(cloudbreakUser);
    if (clients.get(cloudbreakUser.getAccessKey()) == null) {
        CloudbreakClient cloudbreakClient = CloudbreakClient.createProxyCloudbreakClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
        FreeIpaClient freeIpaClient = FreeIpaClient.createProxyFreeIpaClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
        EnvironmentClient environmentClient = EnvironmentClient.createProxyEnvironmentClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
        SdxClient sdxClient = SdxClient.createProxySdxClient(testParameter, cloudbreakUser);
        UmsClient umsClient = UmsClient.createProxyUmsClient(tracer, umsHost);
        SdxSaasItClient sdxSaasItClient = SdxSaasItClient.createProxySdxSaasClient(tracer, umsHost, regionAwareInternalCrnGeneratorFactory);
        RedbeamsClient redbeamsClient = RedbeamsClient.createProxyRedbeamsClient(testParameter, cloudbreakUser);
        Map<Class<? extends MicroserviceClient>, MicroserviceClient> clientMap = Map.of(CloudbreakClient.class, cloudbreakClient, FreeIpaClient.class, freeIpaClient, EnvironmentClient.class, environmentClient, SdxClient.class, sdxClient, RedbeamsClient.class, redbeamsClient, UmsClient.class, umsClient, SdxSaasItClient.class, sdxSaasItClient);
        clients.put(cloudbreakUser.getAccessKey(), clientMap);
        cloudbreakClient.setWorkspaceId(0L);
    }
    return this;
}
Also used : MicroserviceClient(com.sequenceiq.it.cloudbreak.MicroserviceClient) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) RedbeamsClient(com.sequenceiq.it.cloudbreak.RedbeamsClient) EnvironmentClient(com.sequenceiq.it.cloudbreak.EnvironmentClient) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) UmsClient(com.sequenceiq.it.cloudbreak.UmsClient) SdxSaasItClient(com.sequenceiq.it.cloudbreak.SdxSaasItClient)

Example 8 with CloudbreakClient

use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.

the class DistroXTestDto method deleteForCleanup.

@Override
public void deleteForCleanup() {
    try {
        CloudbreakClient clientForCleanup = getClientForCleanup();
        clientForCleanup.getDefaultClient().distroXV1Endpoint().deleteByCrn(getCrn(), true);
        awaitWithClient(STACK_DELETED, clientForCleanup);
    } catch (NotFoundException nfe) {
        LOGGER.info("resource not found, thus cleanup not needed.");
    }
}
Also used : CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) NotFoundException(javax.ws.rs.NotFoundException)

Example 9 with CloudbreakClient

use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.

the class BlueprintV4Action method getAll.

public static void getAll(IntegrationTestContext integrationTestContext, Entity entity) {
    BlueprintTestDto blueprintEntity = (BlueprintTestDto) entity;
    CloudbreakClient client;
    client = integrationTestContext.getContextParam(CloudbreakClient.CLOUDBREAK_CLIENT, CloudbreakClient.class);
    Long workspaceId = integrationTestContext.getContextParam(CloudbreakTest.WORKSPACE_ID, Long.class);
    Log.log(" getByName all private blueprints. ");
    Collection<BlueprintV4ViewResponse> blueprints = client.getDefaultClient().blueprintV4Endpoint().list(workspaceId, true).getResponses();
    Set<BlueprintV4Response> detailedBlueprints = blueprints.stream().map(bp -> client.getDefaultClient().blueprintV4Endpoint().getByName(workspaceId, bp.getName())).collect(Collectors.toSet());
    blueprintEntity.setResponses(detailedBlueprints);
}
Also used : Collection(java.util.Collection) BlueprintV4ViewResponse(com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4ViewResponse) BlueprintV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4Response) CloudbreakTest(com.sequenceiq.it.cloudbreak.CloudbreakTest) Log(com.sequenceiq.it.cloudbreak.log.Log) Set(java.util.Set) Entity(com.sequenceiq.it.cloudbreak.Entity) IOException(java.io.IOException) IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) Collectors(java.util.stream.Collectors) CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto) BlueprintV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4Response) BlueprintV4ViewResponse(com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4ViewResponse)

Example 10 with CloudbreakClient

use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.

the class BlueprintV4Action method delete.

public static void delete(IntegrationTestContext integrationTestContext, Entity entity) {
    BlueprintTestDto blueprintEntity = (BlueprintTestDto) entity;
    CloudbreakClient client;
    client = integrationTestContext.getContextParam(CloudbreakClient.CLOUDBREAK_CLIENT, CloudbreakClient.class);
    Long workspaceId = integrationTestContext.getContextParam(CloudbreakTest.WORKSPACE_ID, Long.class);
    Log.log(" deleteByName ".concat(blueprintEntity.getName()).concat(" private blueprint with Name. "));
    client.getDefaultClient().blueprintV4Endpoint().deleteByName(workspaceId, blueprintEntity.getName());
}
Also used : CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto)

Aggregations

CloudbreakClient (com.sequenceiq.it.cloudbreak.CloudbreakClient)13 ClusterTemplateV4TestDto (com.sequenceiq.it.cloudbreak.dto.ClusterTemplateV4TestDto)4 BlueprintTestDto (com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto)4 NotFoundException (javax.ws.rs.NotFoundException)3 EnvironmentClient (com.sequenceiq.it.cloudbreak.EnvironmentClient)2 FreeIpaClient (com.sequenceiq.it.cloudbreak.FreeIpaClient)2 MicroserviceClient (com.sequenceiq.it.cloudbreak.MicroserviceClient)2 RedbeamsClient (com.sequenceiq.it.cloudbreak.RedbeamsClient)2 SdxClient (com.sequenceiq.it.cloudbreak.SdxClient)2 SdxSaasItClient (com.sequenceiq.it.cloudbreak.SdxSaasItClient)2 UmsClient (com.sequenceiq.it.cloudbreak.UmsClient)2 BlueprintV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4Response)1 BlueprintV4ViewResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4ViewResponse)1 ClusterTemplateV4Type (com.sequenceiq.cloudbreak.api.endpoint.v4.clustertemplate.ClusterTemplateV4Type)1 ResourceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus)1 EnvironmentStatus (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 CloudbreakTest (com.sequenceiq.it.cloudbreak.CloudbreakTest)1 Entity (com.sequenceiq.it.cloudbreak.Entity)1 ClusterTemplateAuditGrpcServiceAssertion (com.sequenceiq.it.cloudbreak.assertion.audit.ClusterTemplateAuditGrpcServiceAssertion)1