Search in sources :

Example 1 with BlueprintTestDto

use of com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto in project cloudbreak by hortonworks.

the class ResourceCreator method createDefaultBlueprintInternal.

public BlueprintTestDto createDefaultBlueprintInternal(TestContext testContext, String accountId, String runtimeVersion) {
    try {
        String bluepint = ResourceUtil.readResourceAsString(testContext.getApplicationContext(), "classpath:/blueprint/clouderamanager.bp").replaceAll("CDH_RUNTIME", runtimeVersion);
        BlueprintTestDto testDto = testContext.given(BlueprintTestDto.class).withAccountId(accountId).withBlueprint(bluepint).when(blueprintTestClient.createInternalV4());
        testDto.validate();
        return testDto;
    } catch (IOException e) {
        throw new TestFailException(e.getMessage());
    }
}
Also used : BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) IOException(java.io.IOException)

Example 2 with BlueprintTestDto

use of com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto in project cloudbreak by hortonworks.

the class BlueprintV4Action method post.

public static void post(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(" post ".concat(blueprintEntity.getName()).concat(" private blueprint. "));
    blueprintEntity.setResponse(client.getDefaultClient().blueprintV4Endpoint().post(workspaceId, blueprintEntity.getRequest()));
    integrationTestContext.putCleanUpParam(blueprintEntity.getName(), blueprintEntity.getResponse().getCrn());
}
Also used : CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto)

Example 3 with BlueprintTestDto

use of com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto in project cloudbreak by hortonworks.

the class BlueprintV4Action method get.

public static void get(IntegrationTestContext integrationTestContext, Entity entity) throws IOException {
    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 ".concat(blueprintEntity.getName()).concat(" private blueprint by Name. "));
    blueprintEntity.setResponse(client.getDefaultClient().blueprintV4Endpoint().getByName(workspaceId, blueprintEntity.getName()));
    Log.whenJson(" getByName ".concat(blueprintEntity.getName()).concat(" blueprint response: "), blueprintEntity.getResponse());
}
Also used : CloudbreakClient(com.sequenceiq.it.cloudbreak.CloudbreakClient) BlueprintTestDto(com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto)

Example 4 with BlueprintTestDto

use of com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto 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 5 with BlueprintTestDto

use of com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto 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

BlueprintTestDto (com.sequenceiq.it.cloudbreak.dto.blueprint.BlueprintTestDto)6 CloudbreakClient (com.sequenceiq.it.cloudbreak.CloudbreakClient)4 IOException (java.io.IOException)2 BlueprintV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4Response)1 BlueprintV4ViewResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.BlueprintV4ViewResponse)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 CloudbreakTest (com.sequenceiq.it.cloudbreak.CloudbreakTest)1 Entity (com.sequenceiq.it.cloudbreak.Entity)1 Description (com.sequenceiq.it.cloudbreak.context.Description)1 RunningParameter (com.sequenceiq.it.cloudbreak.context.RunningParameter)1 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)1 DistroXClusterTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto)1 DistroXImageTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto)1 DistroXNetworkTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.instancegroup.DistroXNetworkTestDto)1 RecipeTestDto (com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto)1 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)1 Log (com.sequenceiq.it.cloudbreak.log.Log)1 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)1 Collection (java.util.Collection)1 Set (java.util.Set)1