use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterDetailsConverterTest method testVariantConversionWithNullVariant.
@Test
public void testVariantConversionWithNullVariant() {
StackDetails stackDetails = new StackDetails();
stackDetails.setPlatformVariant(null);
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(stackDetails);
UsageProto.CDPClusterDetails clusterDetails = underTest.convert(structuredFlowEvent);
Assertions.assertEquals(UsageProto.CDPCloudProviderVariantType.Value.UNSET, clusterDetails.getCloudProviderVariant());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(stackDetails);
clusterDetails = underTest.convert(structuredSyncEvent);
Assertions.assertEquals(0, clusterDetails.getCloudProviderVariantValue());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterDetailsConverterTest method testUserTagsConversionWithNullTags.
@Test
public void testUserTagsConversionWithNullTags() {
StackDetails stackDetails = new StackDetails();
stackDetails.setTags(null);
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(stackDetails);
UsageProto.CDPClusterDetails clusterDetails = underTest.convert(structuredFlowEvent);
Assertions.assertEquals("", clusterDetails.getUserTags());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(stackDetails);
clusterDetails = underTest.convert(structuredSyncEvent);
Assertions.assertEquals("", clusterDetails.getUserTags());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterDetailsConverterTest method testUserTagsConversionWithCorrectTags.
@Test
public void testUserTagsConversionWithCorrectTags() {
StackDetails stackDetails = new StackDetails();
Map<String, String> userTags = new HashMap<>();
userTags.put("key1", "value1");
userTags.put("key2", "value2");
Map<String, String> appTags = new HashMap<>();
appTags.put("appKey1", "appValue1");
appTags.put("appKey2", "appValue2");
stackDetails.setTags(new Json(new StackTags(userTags, appTags, new HashMap<>())));
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(stackDetails);
UsageProto.CDPClusterDetails clusterDetails = underTest.convert(structuredFlowEvent);
Assertions.assertEquals("{\"key1\":\"value1\",\"key2\":\"value2\"}", clusterDetails.getUserTags());
Assertions.assertEquals("{\"appKey1\":\"appValue1\",\"appKey2\":\"appValue2\"}", clusterDetails.getApplicationTags());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(stackDetails);
clusterDetails = underTest.convert(structuredSyncEvent);
Assertions.assertEquals("{\"key1\":\"value1\",\"key2\":\"value2\"}", clusterDetails.getUserTags());
Assertions.assertEquals("{\"appKey1\":\"appValue1\",\"appKey2\":\"appValue2\"}", clusterDetails.getApplicationTags());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterShapeConverterTest method testConversionWithBlueprintDetails.
@Test
public void testConversionWithBlueprintDetails() {
String blueprintJson = "{ \"cdhVersion\": \"7.2.14\", \"displayName\": \"dataengineering ha\", \"services\": [{ \"refName\": \"zookeeper\", " + "\"serviceType\": \"ZOOKEEPER\", \"roleConfigGroups\": [{ \"refName\": \"zookeeper-SERVER-BASE\", \"roleType\": \"SERVER\", \"base\": true " + "}]},{ \"refName\": \"hdfs\", \"serviceType\": \"HDFS\", \"serviceConfigs\": [{ \"name\": \"zookeeper_service\", \"ref\": \"zookeeper\" }]}," + "{ \"refName\": \"hms\", \"serviceType\": \"HIVE\", \"displayName\": \"Hive Metastore\", \"roleConfigGroups\": [{ \"refName\": " + "\"hms-GATEWAY-BASE\", \"roleType\": \"GATEWAY\", \"base\": true }] }, { \"refName\": \"hive\", \"serviceType\": \"HIVE_ON_TEZ\", " + "\"displayName\": \"Hive\", \"serviceConfigs\": [{ \"name\": \"tez_auto_reducer_parallelism\", \"value\": \"false\" }] }, " + "{ \"refName\": \"hue\", \"serviceType\": \"HUE\", \"serviceConfigs\": [{ \"name\": \"hue_service_safety_valve\", \"value\": \"[desktop]" + "\\napp_blacklist=spark,zookeeper,hbase,impala,search,sqoop,security,pig\" }] }, { \"refName\": \"livy\", \"serviceType\": \"LIVY\", " + "\"roleConfigGroups\": [{ \"refName\": \"livy-GATEWAY-BASE\", \"roleType\": \"GATEWAY\", \"base\": true }] }, { \"refName\": \"oozie\", " + "\"serviceType\": \"OOZIE\", \"roleConfigGroups\": [{ \"refName\": \"oozie-OOZIE_SERVER-BASE\", \"roleType\": \"OOZIE_SERVER\", " + "\"base\": true }] }, { \"refName\": \"sqoop\", \"serviceType\": \"SQOOP_CLIENT\", \"roleConfigGroups\": [{ \"refName\": " + "\"sqoop-SQOOP_CLIENT-GATEWAY-BASE\", \"roleType\": \"GATEWAY\", \"configs\": [], \"base\": true }] }, { \"refName\": \"yarn\", " + "\"serviceType\": \"YARN\", \"serviceConfigs\": [{ \"name\": \"yarn_admin_acl\", \"value\": \"yarn,hive,hdfs,mapred\" }] }, { \"refName\": " + "\"spark_on_yarn\", \"serviceType\": \"SPARK_ON_YARN\", \"roleConfigGroups\": [{ \"refName\": " + "\"spark_on_yarn-SPARK_YARN_HISTORY_SERVER-BASE\", \"roleType\": \"SPARK_YARN_HISTORY_SERVER\", \"base\": true }] }, { \"refName\": \"tez\"," + "\"serviceType\": \"TEZ\", \"roleConfigGroups\": [{ \"refName\": \"tez-GATEWAY-BASE\", \"roleType\": \"GATEWAY\", \"base\": true }] }, " + "{ \"refName\": \"das\", \"serviceType\": \"DAS\" }] }";
StructuredFlowEvent structuredFlowEvent = new StructuredFlowEvent();
structuredFlowEvent.setStack(createStackDetails());
BlueprintDetails flowBlueprintDetails = new BlueprintDetails();
flowBlueprintDetails.setName("My Blueprint");
flowBlueprintDetails.setBlueprintJson(blueprintJson);
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\":{\"HIVE_ON_TEZ\":1,\"HIVE\":1,\"LIVY\":1,\"DAS\":1,\"HDFS\":1," + "\"OOZIE\":1,\"TEZ\":1,\"HUE\":1,\"SQOOP_CLIENT\":1,\"ZOOKEEPER\":1,\"YARN\":1,\"SPARK_ON_YARN\":1}}", flowClusterShape.getClusterTemplateDetails());
StructuredSyncEvent structuredSyncEvent = new StructuredSyncEvent();
structuredSyncEvent.setStack(createStackDetails());
BlueprintDetails syncBlueprintDetails = new BlueprintDetails();
syncBlueprintDetails.setName("My Blueprint");
syncBlueprintDetails.setBlueprintJson(blueprintJson);
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\":{\"HIVE_ON_TEZ\":1,\"HIVE\":1,\"LIVY\":1,\"DAS\":1,\"HDFS\":1," + "\"OOZIE\":1,\"TEZ\":1,\"HUE\":1,\"SQOOP_CLIENT\":1,\"ZOOKEEPER\":1,\"YARN\":1,\"SPARK_ON_YARN\":1}}", syncClusterShape.getClusterTemplateDetails());
}
use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent in project cloudbreak by hortonworks.
the class StructuredEventToCDPClusterShapeConverterTest method testConversionWithoutCustomConfigurations.
@Test
public void testConversionWithoutCustomConfigurations() {
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.assertEquals("null", flowClusterShape.getClusterTemplateOverridesDetails());
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.assertEquals("null", syncClusterShape.getClusterTemplateOverridesDetails());
}
Aggregations