use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class DatahubPollerProviderTest method testStopDistroXPoller.
@ParameterizedTest
@MethodSource("distroxStopStatuses")
void testStopDistroXPoller(Status s1Status, Status c1Status, Status s2Status, Status c2Status, AttemptState attemptState, String message, List<String> remaining) throws Exception {
List<String> pollingCrn = new ArrayList<>();
pollingCrn.add("crn1");
pollingCrn.add("crn2");
StackV4Response stack1 = getStackV4Response(s1Status, c1Status, "crn1");
StackV4Response stack2 = getStackV4Response(s2Status, c2Status, "crn2");
Mockito.when(datahubService.getByCrn("crn1", Collections.emptySet())).thenReturn(stack1);
Mockito.when(datahubService.getByCrn("crn2", Collections.emptySet())).thenReturn(stack2);
AttemptResult<Void> result = underTest.stopDatahubClustersPoller(pollingCrn, ENV_ID).process();
assertEquals(attemptState, result.getState());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class DatahubPollerProviderTest method getStackV4Response.
private StackV4Response getStackV4Response(Status status, Status clusterStatus, String crn) {
StackV4Response stack1 = new StackV4Response();
stack1.setStatus(status);
ClusterV4Response cluster = new ClusterV4Response();
cluster.setStatus(clusterStatus);
cluster.setName(crn);
cluster.setStatusReason("cluster reason");
stack1.setCluster(cluster);
stack1.setName(crn);
stack1.setCrn(crn);
stack1.setStatusReason("reason");
return stack1;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class DatahubPollerServiceTest method getStack.
private StackV4Response getStack(Status status) {
StackV4Response stack = new StackV4Response();
stack.setStatus(status);
stack.setCrn(STACK_CRN);
ClusterV4Response cluster = new ClusterV4Response();
cluster.setStatus(status);
stack.setCluster(cluster);
return stack;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class DatahubPollerServiceTest method getStackView.
private StackViewV4Response getStackView(Status status) {
StackViewV4Response stack = new StackViewV4Response();
stack.setCrn(STACK_CRN);
stack.setStatus(status);
return stack;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class DistroXV1RequestToStackV4RequestConverterTest method testStackV4RequestToDistroXV1RequestRegardlessOfTheStateOfTheEnvironment.
@ParameterizedTest
@EnumSource(EnvironmentStatus.class)
void testStackV4RequestToDistroXV1RequestRegardlessOfTheStateOfTheEnvironment(EnvironmentStatus status) {
StackV4Request source = new StackV4Request();
source.setName("SomeStack");
source.setEnvironmentCrn("SomeEnvCrn");
DetailedEnvironmentResponse env = createAwsEnvironment();
env.setCrn(source.getEnvironmentCrn());
env.setEnvironmentStatus(status);
when(environmentClientService.getByCrn(source.getEnvironmentCrn())).thenReturn(env);
DistroXV1Request result = assertDoesNotThrow(() -> underTest.convert(source));
verify(environmentClientService, times(1)).getByCrn(any());
verify(environmentClientService, times(1)).getByCrn(source.getEnvironmentCrn());
Assertions.assertEquals(env.getName(), result.getEnvironmentName());
}
Aggregations