Search in sources :

Example 1 with SimpleEnvironmentResponses

use of com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses in project cloudbreak by hortonworks.

the class EnvironmentDeleteMultipleByCrnsAction method environmentAction.

@Override
protected EnvironmentTestDto environmentAction(TestContext testContext, EnvironmentTestDto testDto, EnvironmentClient client) throws Exception {
    SimpleEnvironmentResponses delete = client.getDefaultClient().environmentV1Endpoint().deleteMultipleByCrns(crns, true, false);
    testDto.setResponseSimpleEnvSet(delete.getResponses());
    Log.whenJson("Environments delete response: ", delete);
    return testDto;
}
Also used : SimpleEnvironmentResponses(com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses)

Example 2 with SimpleEnvironmentResponses

use of com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses in project cloudbreak by hortonworks.

the class EnvironmentServiceDecoratorTest method testPrepareEnvironmentsAndCredentialWithoutNameAndCrnWhenNameProvidedThenShouldCallGetEnvironmentList.

@Test
void testPrepareEnvironmentsAndCredentialWithoutNameAndCrnWhenNameProvidedThenShouldCallGetEnvironmentList() {
    SimpleEnvironmentResponses simpleEnvironmentResponses = new SimpleEnvironmentResponses();
    SimpleEnvironmentResponse simpleEnvironmentResponse = new SimpleEnvironmentResponse();
    CredentialViewResponse credentialViewResponse = new CredentialViewResponse();
    NameOrCrn nameOrCrn = mock(NameOrCrn.class);
    StackViewV4Response stackViewV4Response = new StackViewV4Response();
    stackViewV4Response.setEnvironmentCrn("env-crn");
    Set<StackViewV4Response> stackViewResponses = Set.of(stackViewV4Response);
    when(nameOrCrn.hasCrn()).thenReturn(false);
    when(nameOrCrn.hasName()).thenReturn(false);
    credentialViewResponse.setName("credential-name");
    simpleEnvironmentResponse.setCredential(credentialViewResponse);
    simpleEnvironmentResponse.setName("env-name");
    simpleEnvironmentResponse.setCrn("env-crn");
    simpleEnvironmentResponses.setResponses(Set.of(simpleEnvironmentResponse));
    when(environmentClientService.list()).thenReturn(simpleEnvironmentResponses);
    underTest.prepareEnvironmentsAndCredentialName(stackViewResponses, nameOrCrn);
    verify(environmentClientService, times(1)).list();
    assertEquals(stackViewResponses.iterator().next().getEnvironmentName(), "env-name");
    assertEquals(stackViewResponses.iterator().next().getCredentialName(), "credential-name");
    assertEquals(stackViewResponses.iterator().next().isGovCloud(), false);
}
Also used : CredentialViewResponse(com.sequenceiq.environment.api.v1.credential.model.response.CredentialViewResponse) StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) SimpleEnvironmentResponses(com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses) SimpleEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponse) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) Test(org.junit.jupiter.api.Test)

Example 3 with SimpleEnvironmentResponses

use of com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses in project cloudbreak by hortonworks.

the class EnvironmentDeleteMultipleByNamesAction method environmentAction.

@Override
protected EnvironmentTestDto environmentAction(TestContext testContext, EnvironmentTestDto testDto, EnvironmentClient client) throws Exception {
    SimpleEnvironmentResponses delete = client.getDefaultClient().environmentV1Endpoint().deleteMultipleByNames(envNames, true, false);
    testDto.setResponseSimpleEnvSet(delete.getResponses());
    Log.whenJson("Environments delete response: ", delete);
    return testDto;
}
Also used : SimpleEnvironmentResponses(com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses)

Aggregations

SimpleEnvironmentResponses (com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponses)3 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)1 StackViewV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response)1 CredentialViewResponse (com.sequenceiq.environment.api.v1.credential.model.response.CredentialViewResponse)1 SimpleEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponse)1 Test (org.junit.jupiter.api.Test)1