use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterDetailsConverterTest method testVariantConversionWithNotNullVariant.
@Test
public void testVariantConversionWithNotNullVariant() {
StackDetails stackDetails = new StackDetails();
stackDetails.setPlatformVariant("AWS_NATIVE");
stackDetails.setMultiAz(true);
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(stackDetails);
UsageProto.CDPClusterDetails clusterDetails = underTest.convert(structuredFlowEvent);
Assertions.assertEquals(UsageProto.CDPCloudProviderVariantType.Value.AWS_NATIVE, clusterDetails.getCloudProviderVariant());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(stackDetails);
clusterDetails = underTest.convert(structuredSyncEvent);
Assertions.assertEquals(2, clusterDetails.getCloudProviderVariantValue());
Assertions.assertEquals(true, clusterDetails.getMultiAz());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterDetailsConverterTest method testUserTagsConversionWithEmptyTags.
@Test
public void testUserTagsConversionWithEmptyTags() {
StackDetails stackDetails = new StackDetails();
stackDetails.setTags(new Json(""));
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(stackDetails);
UsageProto.CDPClusterDetails clusterDetails = underTest.convert(structuredFlowEvent);
Assertions.assertEquals("", clusterDetails.getUserTags());
Assertions.assertEquals("", clusterDetails.getApplicationTags());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(stackDetails);
clusterDetails = underTest.convert(structuredSyncEvent);
Assertions.assertEquals("", clusterDetails.getUserTags());
Assertions.assertEquals("", clusterDetails.getApplicationTags());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterDetailsConverterTest method testUserTagsConversionWithNullStackDetails.
@Test
public void testUserTagsConversionWithNullStackDetails() {
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(null);
UsageProto.CDPClusterDetails clusterDetails = underTest.convert(structuredFlowEvent);
Assertions.assertEquals("", clusterDetails.getUserTags());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(null);
clusterDetails = underTest.convert(structuredSyncEvent);
Assertions.assertEquals("", clusterDetails.getUserTags());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterShapeConverterTest method testConversionWithoutTemporaryStorage.
@Test
public void testConversionWithoutTemporaryStorage() {
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
StackDetails stackDetails = new StackDetails();
InstanceGroupDetails master = createInstanceGroupDetails("master", 2, null);
stackDetails.setInstanceGroups(List.of(master));
structuredFlowEvent.setStack(stackDetails);
UsageProto.CDPClusterShape flowClusterShape = underTest.convert(structuredFlowEvent);
Assert.assertEquals(2, flowClusterShape.getNodes());
Assert.assertEquals("master=2", flowClusterShape.getHostGroupNodeCount());
Assert.assertFalse(flowClusterShape.getTemporaryStorageUsed());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(stackDetails);
UsageProto.CDPClusterShape syncClusterShape = underTest.convert(structuredSyncEvent);
Assert.assertEquals(2, syncClusterShape.getNodes());
Assert.assertEquals("master=2", syncClusterShape.getHostGroupNodeCount());
Assert.assertFalse(syncClusterShape.getTemporaryStorageUsed());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterShapeConverterTest method testConversionWithEmptyStructuredEvent.
@Test
public void testConversionWithEmptyStructuredEvent() {
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
UsageProto.CDPClusterShape flowClusterShape = underTest.convert(structuredFlowEvent);
Assert.assertEquals("", flowClusterShape.getClusterTemplateName());
Assert.assertEquals(-1, flowClusterShape.getNodes());
Assert.assertEquals("", flowClusterShape.getDefinitionDetails());
Assert.assertFalse(flowClusterShape.getTemporaryStorageUsed());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
UsageProto.CDPClusterShape syncClusterShape = underTest.convert(structuredSyncEvent);
Assert.assertEquals("", syncClusterShape.getClusterTemplateName());
Assert.assertEquals(-1, syncClusterShape.getNodes());
Assert.assertEquals("", syncClusterShape.getDefinitionDetails());
Assert.assertFalse(syncClusterShape.getTemporaryStorageUsed());
}
Aggregations