Search in sources :

Example 81 with StackV4Response

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());
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 82 with StackV4Response

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());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 83 with StackV4Response

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());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 84 with StackV4Response

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());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 85 with StackV4Response

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());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Test(org.junit.Test)

Aggregations

StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)101 Test (org.junit.jupiter.api.Test)26 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)22 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)19 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)14 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)13 Test (org.junit.Test)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)8 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)7 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)7 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)7 ArrayList (java.util.ArrayList)7 Test (org.testng.annotations.Test)7 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)6 TagsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response)6 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)6 TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)6 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)6