@Test(enabled = true) @SuppressWarnings("unchecked") public void testSplittedNuroGenerationForIaaS() throws Exception { String adp = new Scanner(new File(Resources.getResource("splitted-nuro/iaas/splittednuro_adp-iaas.yml").toURI())).useDelimiter("\\Z").next(); dam = damGenerator.generateDam(adp); template = YamlParser.load(dam); testMetadataTemplate(template); String expectedDamString = new Scanner(new File(Resources.getResource("splitted-nuro/iaas/splittednuro_dam-iaas.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("nuro-gui"), expectedNodeTemplates.get("nuro-gui")); assertEquals(generatedNodeTemplates.get("modacloudsDc_nuro-gui"), expectedNodeTemplates.get("modacloudsDc_nuro-gui")); assertEquals(generatedNodeTemplates.get("nuro-api"), expectedNodeTemplates.get("nuro-api")); assertEquals(generatedNodeTemplates.get("modacloudsDc_nuro-api"), expectedNodeTemplates.get("modacloudsDc_nuro-api")); assertEquals(generatedNodeTemplates.get("db"), expectedNodeTemplates.get("db")); assertEquals(generatedNodeTemplates.get("modacloudsDc_db"), expectedNodeTemplates.get("modacloudsDc_db")); assertEquals(generatedNodeTemplates.get("Amazon_EC2_m4_large_us_west_1"), expectedNodeTemplates.get("Amazon_EC2_m4_large_us_west_1")); assertEquals(generatedNodeTemplates.get("Amazon_EC2_c3_large_ap_northeast_1"), expectedNodeTemplates.get("Amazon_EC2_c3_large_ap_northeast_1")); assertEquals(generatedNodeTemplates.get("Amazon_EC2_r3_large_us_west_2"), expectedNodeTemplates.get("Amazon_EC2_r3_large_us_west_2")); 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("nuro-gui", "nuro-api")); assertEquals(generatedGroups.get("operation_db"), expectedGroups.get("operation_db")); assertEquals(generatedGroups.get("operation_nuro-api"), expectedGroups.get("operation_nuro-api")); assertEquals(generatedGroups.get("operation_nuro-gui"), expectedGroups.get("operation_nuro-gui")); assertEquals(generatedGroups.get("add_brooklyn_location_Amazon_EC2_m4_large_us_west_1"), expectedGroups.get("add_brooklyn_location_Amazon_EC2_m4_large_us_west_1")); assertEquals(generatedGroups.get("add_brooklyn_location_Amazon_EC2_c3_large_ap_northeast_1"), expectedGroups.get("add_brooklyn_location_Amazon_EC2_c3_large_ap_northeast_1")); assertEquals(generatedGroups.get("add_brooklyn_location_Amazon_EC2_r3_large_us_west_2"), expectedGroups.get("add_brooklyn_location_Amazon_EC2_r3_large_us_west_2")); }
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; }