}
public void testLogSetup()
{
final MockBundleContext bundleContext = new MockBundleContext();
ConfigurationManager configMgr = createConfigurationManager( null );
// ensure the configuration data goes to target
bundleContext.setProperty( "felix.cm.dir", "target/config" );
// default value is 2
bundleContext.setProperty( "felix.cm.loglevel", null );
configMgr.start( bundleContext );
assertEquals( 2, getLogLevel( configMgr ) );
configMgr.stop( bundleContext );
// illegal number yields default value
bundleContext.setProperty( "felix.cm.loglevel", "not-a-number" );
configMgr.start( bundleContext );
assertEquals( 2, getLogLevel( configMgr ) );
configMgr.stop( bundleContext );
bundleContext.setProperty( "felix.cm.loglevel", "-100" );
configMgr.start( bundleContext );
assertEquals( -100, getLogLevel( configMgr ) );
configMgr.stop( bundleContext );
bundleContext.setProperty( "felix.cm.loglevel", "4" );
configMgr.start( bundleContext );
assertEquals( 4, getLogLevel( configMgr ) );
configMgr.stop( bundleContext );
}