Exemplo n.º 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);
  }
 private boolean waitForBundle(Bundle bundle) throws Exception {
   int timeout = 10000;
   int time = 0;
   boolean started = false;
   while (bundle.getState() != Bundle.ACTIVE) {
     Thread.sleep(100);
     time += 100;
     if (time == timeout) break;
   }
   if (time == timeout) return false;
   else return true;
 }
Exemplo n.º 3
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);
  }
 protected void setThreadContextClassLoader() {
   // set the thread context classloader current bundle classloader
   Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
 }