System.setProperty(systemKey1, "value1");
System.setProperty(systemKey2, "value2");
resetConfigurationHandler();
ConfigurationHandler configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);
assertEquals(configurationHandler.get(systemKey1, "default1"), "value1");
assertEquals(configurationHandler.get(systemKey2, "default2"), "value2");
// System props should *not* be persisted, they are not in our control...
System.clearProperty(systemKey1);
System.clearProperty(systemKey2);
resetConfigurationHandler();
configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);
assertEquals(configurationHandler.get(systemKey1, "qux"), "qux");
assertEquals(configurationHandler.get(systemKey2, "quu"), "quu");
// System props should not override the configured values...
System.setProperty(systemKey1, "value1");
System.setProperty(systemKey2, "value2");
configureAgent(configurationHandler, systemKey1, "newvalue1", systemKey2, "newvalue2");
resetConfigurationHandler();
configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);
assertEquals(configurationHandler.get(systemKey1, "qux"), "newvalue1");
assertEquals(configurationHandler.get(systemKey2, "quu"), "newvalue2");
// System props should not override if explicitly configured values are present...
System.setProperty(systemKey1, "valueX");
System.setProperty(systemKey2, "valueY");
resetConfigurationHandler();
configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);
assertEquals(configurationHandler.get(systemKey1, "qqq"), "newvalue1");
assertEquals(configurationHandler.get(systemKey2, "qqq"), "newvalue2");
}