InputStream input = getClass().getClassLoader().getResourceAsStream("overridden.properties");
FileOutputStream output = new FileOutputStream(tempProps);
IOUtils.copy(input, output);
input.close();
output.close();
ApplicationDescriptor descriptor = new ApplicationDescriptor();
DefaultAppBloodhound dab = new DefaultAppBloodhound();
dab.setApplicationProperties(descriptor, tempProps);
Map<String, String>appProps = descriptor.getAppProperties();
assertEquals("state", appProps.get("texas"));
assertEquals("country", appProps.get("peru"));
assertEquals("austin", appProps.get("texas.capital"));
assertEquals("4", appProps.get("peru.capital.numberOfletters"));
assertEquals("esb", appProps.get("mule"));
assertEquals("ipaas", appProps.get("mule.ion"));
try
{
setSystemProperties();
descriptor = new ApplicationDescriptor();
dab.setApplicationProperties(descriptor, tempProps);
appProps = descriptor.getAppProperties();
assertEquals("state", appProps.get("texas"));
assertEquals("nation", appProps.get("peru"));
assertEquals("austin", appProps.get("texas.capital"));
assertEquals("4", appProps.get("peru.capital.numberOfletters"));
assertEquals("wayCool", appProps.get("mule"));
assertEquals("ipaas", appProps.get("mule.ion"));
assertEquals("evenCooler", appProps.get("mule.mmc"));
descriptor = new ApplicationDescriptor();
dab.setApplicationProperties(descriptor, new File("nonexistent.nonexistent"));
appProps = descriptor.getAppProperties();
assertNull(appProps.get("texas"));
assertEquals("nation", appProps.get("peru"));
assertNull(appProps.get("texas.capital"));
assertNull(appProps.get("peru.capital.numberOfletters"));
assertEquals("wayCool", appProps.get("mule"));