Search in sources :

Example 26 with StructuredSyncEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.

the class StructuredEventToCDPClusterShapeConverterTest method testConversionWithValues.

@Test
public void testConversionWithValues() {
    StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
    structuredFlowEvent.setStack(createStackDetails());
    BlueprintDetails flowBlueprintDetails = new BlueprintDetails();
    flowBlueprintDetails.setName("My Blueprint");
    structuredFlowEvent.setBlueprintDetails(flowBlueprintDetails);
    UsageProto.CDPClusterShape flowClusterShape = underTest.convert(structuredFlowEvent);
    Assert.assertEquals("My Blueprint", flowClusterShape.getClusterTemplateName());
    Assert.assertEquals(10, flowClusterShape.getNodes());
    Assert.assertEquals("compute=3, gw=4, master=1, worker=2", flowClusterShape.getHostGroupNodeCount());
    Assert.assertTrue(flowClusterShape.getTemporaryStorageUsed());
    Assert.assertEquals("{\"services\":[\"service1\",\"service2\",\"service3\"]," + "\"roles\":[\"role1\",\"role2\"],\"runtimeVersion\":\"7.2.15\"}", flowClusterShape.getClusterTemplateOverridesDetails());
    StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
    structuredSyncEvent.setStack(createStackDetails());
    BlueprintDetails syncBlueprintDetails = new BlueprintDetails();
    syncBlueprintDetails.setName("My Blueprint");
    structuredSyncEvent.setBlueprintDetails(syncBlueprintDetails);
    UsageProto.CDPClusterShape syncClusterShape = underTest.convert(structuredSyncEvent);
    Assert.assertEquals("My Blueprint", syncClusterShape.getClusterTemplateName());
    Assert.assertEquals(10, syncClusterShape.getNodes());
    Assert.assertEquals("compute=3, gw=4, master=1, worker=2", syncClusterShape.getHostGroupNodeCount());
    Assert.assertTrue(syncClusterShape.getTemporaryStorageUsed());
    Assert.assertEquals("{\"services\":[\"service1\",\"service2\",\"service3\"]," + "\"roles\":[\"role1\",\"role2\"],\"runtimeVersion\":\"7.2.15\"}", syncClusterShape.getClusterTemplateOverridesDetails());
}
Also used : BlueprintDetails(com.sequenceiq.cloudbreak.structuredevent.event.BlueprintDetails) 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 27 with StructuredSyncEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.

the class StructuredEventToCDPDatalakeFeaturesConverterTest method testRazDisabled.

@Test
public void testRazDisabled() {
    ClusterDetails clusterDetails = new ClusterDetails();
    clusterDetails.setRazEnabled(false);
    StructuredFlowEvent flowEvent = new StructuredFlowEvent();
    flowEvent.setCluster(clusterDetails);
    UsageProto.CDPDatalakeFeatures features = underTest.convert(flowEvent);
    assertEquals("DISABLED", features.getRaz().getStatus());
    StructuredSyncEvent syncEvent = new StructuredSyncEvent();
    syncEvent.setCluster(clusterDetails);
    features = underTest.convert(syncEvent);
    assertEquals("DISABLED", features.getRaz().getStatus());
}
Also used : ClusterDetails(com.sequenceiq.cloudbreak.structuredevent.event.ClusterDetails) 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 28 with StructuredSyncEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.

the class StructuredEventToCDPImageDetailsConverterTest method testConversionWithFilledOutValuesStructuredEvent.

@Test
public void testConversionWithFilledOutValuesStructuredEvent() {
    StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
    structuredFlowEvent.setStack(createStackDetails());
    UsageProto.CDPImageDetails flowdetails = underTest.convert(structuredFlowEvent);
    Assert.assertEquals(IMAGE_CATALOG, flowdetails.getImageCatalog());
    Assert.assertEquals(IMAGE_ID, flowdetails.getImageId());
    Assert.assertEquals(IMAGE_CATALOG_URL, flowdetails.getImageCatalogUrl());
    Assert.assertEquals(OS_TYPE, flowdetails.getOsType());
    StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
    structuredSyncEvent.setStack(createStackDetails());
    UsageProto.CDPImageDetails syncDetails = underTest.convert(structuredSyncEvent);
    Assert.assertEquals(IMAGE_CATALOG, syncDetails.getImageCatalog());
    Assert.assertEquals(IMAGE_ID, syncDetails.getImageId());
    Assert.assertEquals(IMAGE_CATALOG_URL, syncDetails.getImageCatalogUrl());
    Assert.assertEquals(OS_TYPE, syncDetails.getOsType());
}
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 29 with StructuredSyncEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.

the class StructuredEventToCDPImageDetailsConverterTest method testConversionWithEmptyStructuredEvent.

@Test
public void testConversionWithEmptyStructuredEvent() {
    StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
    UsageProto.CDPImageDetails flowdetails = underTest.convert(structuredFlowEvent);
    Assert.assertEquals("", flowdetails.getImageCatalog());
    Assert.assertEquals("", flowdetails.getImageId());
    Assert.assertEquals("", flowdetails.getOsType());
    Assert.assertEquals("", flowdetails.getImageCatalogUrl());
    StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
    UsageProto.CDPImageDetails syncDetails = underTest.convert(structuredSyncEvent);
    Assert.assertEquals("", syncDetails.getImageCatalog());
    Assert.assertEquals("", syncDetails.getImageId());
    Assert.assertEquals("", syncDetails.getOsType());
    Assert.assertEquals("", syncDetails.getImageCatalogUrl());
}
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 30 with StructuredSyncEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.

the class StructuredEventToCDPOperationDetailsConverterTest method testFlowRelatedOperationDetailsFieldsReturnEmptyStringWhenConvertingStructuredSyncEvent.

@Test
public void testFlowRelatedOperationDetailsFieldsReturnEmptyStringWhenConvertingStructuredSyncEvent() {
    StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
    OperationDetails operationDetails = new OperationDetails();
    operationDetails.setTenant("tenant1");
    operationDetails.setResourceCrn("crn1");
    operationDetails.setResourceName("name1");
    operationDetails.setUserCrn("crn2");
    structuredSyncEvent.setOperation(operationDetails);
    UsageProto.CDPOperationDetails details = underTest.convert(structuredSyncEvent);
    Assert.assertEquals("tenant1", details.getAccountId());
    Assert.assertEquals("crn1", details.getResourceCrn());
    Assert.assertEquals("name1", details.getResourceName());
    Assert.assertEquals("crn2", details.getInitiatorCrn());
    Assert.assertEquals("", details.getFlowId());
    Assert.assertEquals("", details.getFlowChainId());
    Assert.assertEquals("", details.getFlowState());
}
Also used : OperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.legacy.OperationDetails) StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) 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