use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseWhenOneInstanceMetadataPresented.
@Test
public void testProviderEntriesToStackResponseWhenOneInstanceMetadataPresented() {
when(hostGroupService.findHostGroupInClusterByName(anyLong(), anyString())).thenReturn(Optional.of(TestUtil.hostGroup()));
Stack stack = TestUtil.stack();
stack.setInstanceGroups(Sets.newHashSet(TestUtil.instanceGroup(1L, InstanceGroupType.GATEWAY, TestUtil.gcpTemplate(1L))));
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 StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseClusterNotNullAndFQDNNotNull.
@Test
public void testProviderEntriesToStackResponseClusterNotNullAndFQDNNotNull() {
Stack stack = new Stack();
Cluster cluster = new Cluster();
cluster.setId(1L);
stack.setCluster(cluster);
InstanceMetaData instanceMetaData = new InstanceMetaData();
instanceMetaData.setId(1L);
instanceMetaData.setDiscoveryFQDN("fqdn");
stack.setInstanceGroups(getInstanceGroups(instanceMetaData));
StackV4Response stackResponse = new StackV4Response();
StackV4Response actual = underTest.providerEntriesToStackResponse(stack, stackResponse);
Assert.assertEquals(1L, actual.getHardwareInfoGroups().size());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseClusterNull.
@Test
public void testProviderEntriesToStackResponseClusterNull() {
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 StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseConvertsResult.
@Test
public void testProviderEntriesToStackResponseConvertsResult() {
Stack stack = new Stack();
Cluster cluster = new Cluster();
cluster.setId(1L);
stack.setCluster(cluster);
InstanceMetaData instanceMetaData = new InstanceMetaData();
instanceMetaData.setId(1L);
instanceMetaData.setDiscoveryFQDN("fqdn");
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 StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseMultipleInstanceGroup.
@Test
public void testProviderEntriesToStackResponseMultipleInstanceGroup() {
Stack stack = new Stack();
stack.setCluster(new Cluster());
Set<InstanceGroup> instanceGroups = getInstanceGroups(new InstanceMetaData());
instanceGroups.addAll(getInstanceGroups(new InstanceMetaData()));
stack.setInstanceGroups(instanceGroups);
StackV4Response actual = underTest.providerEntriesToStackResponse(stack, new StackV4Response());
Assert.assertEquals(2L, actual.getHardwareInfoGroups().size());
}
Aggregations