use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response 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.stacks.response.StackV4Response 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.stacks.response.StackV4Response 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.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseClusterNotNullButFQDNNull.
@Test
public void testProviderEntriesToStackResponseClusterNotNullButFQDNNull() {
Stack stack = new Stack();
InstanceMetaData instanceMetaData = new InstanceMetaData();
stack.setInstanceGroups(getInstanceGroups(instanceMetaData));
StackV4Response actual = underTest.providerEntriesToStackResponse(stack, new StackV4Response());
Assert.assertEquals(1L, actual.getHardwareInfoGroups().size());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class StackOperationsTest method testGetWhenNameOrCrnCrnFilledThenProperGetCalled.
@Test
public void testGetWhenNameOrCrnCrnFilledThenProperGetCalled() {
StackV4Response expected = stackResponse();
NameOrCrn nameOrCrn = NameOrCrn.ofCrn(stack.getResourceCrn());
when(stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE)).thenReturn(expected);
StackV4Response result = underTest.get(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE);
assertEquals(expected, result);
verify(stackCommonService, times(1)).findStackByNameOrCrnAndWorkspaceId(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE);
}
Aggregations