コード例 #1
0
  private void loggingDeactivate(final ConfigurationAdmin configAdmin) throws Exception {

    final org.osgi.service.cm.Configuration config = configAdmin.getConfiguration(PAX_PID, null);

    config.delete();

    Thread.sleep(500);
  }
コード例 #2
0
  private void loggingActivate(final ConfigurationAdmin configAdmin) throws Exception {

    final URL propsURL = TestAny.class.getResource("/log4j.properties");

    final Properties props = new Properties();

    props.load(propsURL.openStream());

    final org.osgi.service.cm.Configuration config = configAdmin.getConfiguration(PAX_PID, null);

    config.update(props);

    final ServiceTracker tracker = new ServiceTracker(context, PAX_SERVICE, null);

    tracker.open(true);

    final Object service = tracker.waitForService(3 * 1000);

    assertNotNull(service);

    Thread.sleep(500);
  }