Search in sources :

Example 11 with StructuredSyncEvent

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());
}
Also used : StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) StackDetails(com.sequenceiq.cloudbreak.structuredevent.event.StackDetails) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 12 with StructuredSyncEvent

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());
}
Also used : StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) StackDetails(com.sequenceiq.cloudbreak.structuredevent.event.StackDetails) Json(com.sequenceiq.cloudbreak.common.json.Json) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 13 with StructuredSyncEvent

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());
}
Also used : StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 14 with StructuredSyncEvent

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());
}
Also used : StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) InstanceGroupDetails(com.sequenceiq.cloudbreak.structuredevent.event.InstanceGroupDetails) StackDetails(com.sequenceiq.cloudbreak.structuredevent.event.StackDetails) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Example 15 with StructuredSyncEvent

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());
}
Also used : StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto) Test(org.junit.jupiter.api.Test)

Aggregations

StructuredSyncEvent (com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent)32 Test (org.junit.jupiter.api.Test)30 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)28 StructuredFlowEvent (com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent)22 StackDetails (com.sequenceiq.cloudbreak.structuredevent.event.StackDetails)10 BlueprintDetails (com.sequenceiq.cloudbreak.structuredevent.event.BlueprintDetails)5 ClusterDetails (com.sequenceiq.cloudbreak.structuredevent.event.ClusterDetails)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)3 Json (com.sequenceiq.cloudbreak.common.json.Json)2 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)2 InstanceGroupDetails (com.sequenceiq.cloudbreak.structuredevent.event.InstanceGroupDetails)2 OperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.legacy.OperationDetails)2 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)1 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)1 HashMap (java.util.HashMap)1 JobExecutionException (org.quartz.JobExecutionException)1