* Ensure no exceptions are thrown and that we get the same values back that
* were put into the configuration.
*/
public void testConfigLoadingValidConfig()
{
SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();
XMLConfiguration xmlconfig = new XMLConfiguration();
long DELAY=10;
String TIMEUNIT=TimeUnit.MICROSECONDS.toString();
xmlconfig.addProperty("delay", String.valueOf(DELAY));
xmlconfig.addProperty("timeunit", TIMEUNIT);
// Create a CompositeConfiguration as this is what the broker uses
CompositeConfiguration composite = new CompositeConfiguration();
composite.addConfiguration(xmlconfig);
try
{
config.setConfiguration("", composite);
}
catch (ConfigurationException e)
{
e.printStackTrace();
fail(e.getMessage());
}
assertEquals("Delay not correctly returned.", DELAY, config.getDelay());
assertEquals("TimeUnit not correctly returned.",
TIMEUNIT, String.valueOf(config.getTimeUnit()));
}