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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations