@Test @SuppressWarnings("unchecked") public void testSoftcareGenerationForPaaS() throws Exception { String adp = new Scanner(new File(Resources.getResource("softcare/paas/softcare_adp-paas.yml").toURI())).useDelimiter("\\Z").next(); dam = damGenerator.generateDam(adp); template = YamlParser.load(dam); testMetadataTemplate(template); String expectedDamString = new Scanner(new File(Resources.getResource("softcare/paas/softcare_dam-paas.yml").toURI())).useDelimiter("\\Z").next(); Map<String, Object> expectedDam = YamlParser.load(expectedDamString); assertNotNull(template); Map<String, Object> generatedTopologyTemplate = (Map<String, Object>) template.get(DamGenerator.TOPOLOGY_TEMPLATE); Map<String, Object> expectedTopologyTemplate = (Map<String, Object>) expectedDam.get(DamGenerator.TOPOLOGY_TEMPLATE); Map<String, Object> generatedNodeTemplates = (Map<String, Object>) generatedTopologyTemplate.get(DamGenerator.NODE_TEMPLATES); Map<String, Object> expectedNodeTemplates = (Map<String, Object>) expectedTopologyTemplate.get(DamGenerator.NODE_TEMPLATES); assertEquals(generatedNodeTemplates.size(), 9); assertEquals(generatedNodeTemplates.get("Softcare_dashboard"), expectedNodeTemplates.get("Softcare_dashboard")); assertEquals(generatedNodeTemplates.get("Forum"), expectedNodeTemplates.get("Forum")); assertEquals(generatedNodeTemplates.get("SoftcareWS"), expectedNodeTemplates.get("SoftcareWS")); assertEquals(generatedNodeTemplates.get("ForumDB"), expectedNodeTemplates.get("ForumDB")); assertEquals(generatedNodeTemplates.get("modacloudsDc_ForumDB"), expectedNodeTemplates.get("modacloudsDc_ForumDB")); assertEquals(generatedNodeTemplates.get("SoftcareDB"), expectedNodeTemplates.get("SoftcareDB")); assertEquals(generatedNodeTemplates.get("modacloudsDc_SoftcareDB"), expectedNodeTemplates.get("modacloudsDc_SoftcareDB")); assertEquals(generatedNodeTemplates.get("Amazon_EC2_t2_micro_eu_central_1"), expectedNodeTemplates.get("Amazon_EC2_t2_micro_eu_central_1")); assertEquals(generatedNodeTemplates.get("Amazon_EC2_t2_micro_ap_northeast_1"), expectedNodeTemplates.get("Amazon_EC2_t2_micro_ap_northeast_1")); Map<String, Object> generatedGroups = (Map<String, Object>) generatedTopologyTemplate.get(DamGenerator.GROUPS); Map<String, Object> expectedGroups = (Map<String, Object>) expectedTopologyTemplate.get(DamGenerator.GROUPS); testSeaCloudsPolicy(generatedGroups); testMonitoringConfiguration(generatedGroups); testMonitorInitializationPolicy(generatedGroups, ImmutableList.of("Softcare_dashboard", "Forum", "SoftcareWS")); assertEquals(generatedGroups.size(), 14); assertEquals(generatedGroups.get("operation_ForumDB"), expectedGroups.get("operation_ForumDB")); assertEquals(generatedGroups.get("operation_SoftcareDB"), expectedGroups.get("operation_SoftcareDB")); assertEquals(generatedGroups.get("operation_Forum"), expectedGroups.get("operation_Forum")); assertEquals(generatedGroups.get("operation_SoftcareWS"), expectedGroups.get("operation_SoftcareWS")); assertEquals(generatedGroups.get("operation_Softcare_dashboard"), expectedGroups.get("operation_Softcare_dashboard")); assertEquals(generatedGroups.get("seaclouds_configuration_policy"), expectedGroups.get("seaclouds_configuration_policy")); assertEquals(generatedGroups.get("add_brooklyn_location_Amazon_EC2_t2_micro_eu_central_1"), expectedGroups.get("add_brooklyn_location_Amazon_EC2_t2_micro_eu_central_1")); assertEquals(generatedGroups.get("add_brooklyn_location_Amazon_EC2_t2_micro_ap_northeast_1"), expectedGroups.get("add_brooklyn_location_Amazon_EC2_t2_micro_ap_northeast_1")); assertEquals(generatedGroups.get("add_brooklyn_location_Forum"), expectedGroups.get("add_brooklyn_location_Forum")); assertEquals(generatedGroups.get("add_brooklyn_location_SoftcareWS"), expectedGroups.get("add_brooklyn_location_SoftcareWS")); assertEquals(generatedGroups.get("add_brooklyn_location_Softcare_dashboard"), expectedGroups.get("add_brooklyn_location_Softcare_dashboard")); }
public String generateDam(String adp) { originalAdp = normalizeComputeTypes(YamlParser.load(adp)); ApplicationFacade applicationFacade = new ApplicationFacade(originalAdp, configBag); applicationFacade.setAgreementGenerator(agreementGenerator); applicationFacade.generateDam(); String generatedDam = applicationFacade.templateToString(); template = YamlParser.load(generatedDam); customize(); return YamlParser.dump(template); }
DamGenerator { public String generateDam(String adp) { originalAdp = normalizeComputeTypes(YamlParser.load(adp)); ApplicationFacade applicationFacade = new ApplicationFacade(originalAdp, configBag); applicationFacade.setAgreementGenerator(agreementGenerator); applicationFacade.generateDam(); String generatedDam = applicationFacade.templateToString(); template = YamlParser.load(generatedDam); customize(); return YamlParser.dump(template); } }
DamGenerator { public String generateDam(String adp) { originalAdp = normalizeComputeTypes(YamlParser.load(adp)); ApplicationFacade applicationFacade = new ApplicationFacade(originalAdp, configBag); applicationFacade.setAgreementGenerator(agreementGenerator); applicationFacade.generateDam(); String generatedDam = applicationFacade.templateToString(); template = YamlParser.load(generatedDam); customize(); return YamlParser.dump(template); } DamGenerator(DamGeneratorConfigBag configBag); }
DamGenerator { public String generateDam(String adp) { originalAdp = normalizeComputeTypes(YamlParser.load(adp)); ApplicationFacade applicationFacade = new ApplicationFacade(originalAdp, configBag); applicationFacade.setAgreementGenerator(agreementGenerator); applicationFacade.generateDam(); String generatedDam = applicationFacade.templateToString(); template = YamlParser.load(generatedDam); customize(); return YamlParser.dump(template); } DamGenerator(DamGeneratorConfigBag configBag); String generateDam(String adp); void relationManagement(); void setAgreementGenerator(AgreementGenerator agreementGenerator); }
DamGenerator { public String generateDam(String adp) { originalAdp = normalizeComputeTypes(YamlParser.load(adp)); ApplicationFacade applicationFacade = new ApplicationFacade(originalAdp, configBag); applicationFacade.setAgreementGenerator(agreementGenerator); applicationFacade.generateDam(); String generatedDam = applicationFacade.templateToString(); template = YamlParser.load(generatedDam); customize(); return YamlParser.dump(template); } DamGenerator(DamGeneratorConfigBag configBag); String generateDam(String adp); void relationManagement(); void setAgreementGenerator(AgreementGenerator agreementGenerator); static final String TYPE; static final String POLICIES; static final String GROUPS; static final String MEMBERS; static final String ID; static final String APPLICATION; static final String TOPOLOGY_TEMPLATE; static final String NODE_TEMPLATES; static final String NODE_TYPES; static final String PROPERTIES; static final String BROOKLYN_POLICY_TYPE; static final String SEACLOUDS_APPLICATION_CONFIGURATION; static final String SEACLOUDS_MONITORING_INITIALIZATION; static final String REQUIREMENTS; static final String HOST; }