Source:
public void testOverwriteInterfaceOnMysqlTopology() throws Exception { try { platform.uploadSingleYaml(new ResourceUtils(platform).getResourceFromUrl("brooklyn-resources.yaml"), "brooklyn-resources"); platform.loadTypesFromUrl(AlienSamplesLiveTest.ALIEN_SAMPLE_TYPES_GITHUB_URL, true); String templateUrl = getClasspathUrlForResource(TEMPLATES_FOLDER + "mysql-topology-overwrited-interface.tosca.yaml"); EntitySpec<?> spec = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(spec, "spec"); assertEquals(spec.getType(), BasicApplication.class); assertEquals(spec.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> compute = Iterators.getOnlyElement(spec.getChildren().iterator()); assertEquals(compute.getType(), BasicApplication.class); assertEquals(compute.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> mysql = Iterators.getOnlyElement(compute.getChildren().iterator()); assertEquals(mysql.getType(), VanillaSoftwareProcess.class); assertEquals(mysql.getConfig().get(ConfigKeys.newStringConfigKey("port")), "3306"); assertEquals(mysql.getConfig().get(ConfigKeys.newStringConfigKey("db_user")), "martin"); assertFalse(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("export PORT=3361")); assertFalse(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("export DB_USER=martin")); assertFalse(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("export DB_NAME=wordpress")); assertTrue(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("#launch mysql service")); } finally { if (platform!=null) { platform.close(); } } }

Target:
public void testOverwriteInterfaceOnMysqlTopology() throws Exception { try { platform.uploadSingleYaml(new ResourceUtils(platform).getResourceFromUrl("brooklyn-resources.yaml"), "brooklyn-resources"); platform.loadTypesFromUrl(AlienSamplesLiveTest.ALIEN_SAMPLE_TYPES_GITHUB_URL, true); String templateUrl = getClasspathUrlForResource(TEMPLATES_FOLDER + "mysql-topology-overwritten-interface.tosca.yaml"); EntitySpec<?> spec = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(spec, "spec"); assertEquals(spec.getType(), BasicApplication.class); assertEquals(spec.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> compute = Iterators.getOnlyElement(spec.getChildren().iterator()); assertEquals(compute.getType(), BasicApplication.class); assertEquals(compute.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> mysql = Iterators.getOnlyElement(compute.getChildren().iterator()); assertEquals(mysql.getType(), VanillaSoftwareProcess.class); assertFalse(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("export PORT=3361")); assertFalse(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("export DB_USER=martin")); assertFalse(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("export DB_NAME=wordpress")); assertTrue(mysql.getConfig().get(VanillaSoftwareProcess.LAUNCH_COMMAND).toString().contains("#OVERWRITTEN VALUE")); } finally { if (platform!=null) { platform.close(); } } }