Esempio n. 1
0
  public FrameworkEvent waitForStop(long timeout) throws InterruptedException {
    long deadline = System.currentTimeMillis() + timeout;

    while (state != Bundle.UNINSTALLED) {
      if (timeout != 0) {
        long wait = deadline - System.currentTimeMillis();
        if (wait <= 0) return new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, this, null);
      }
      Thread.sleep(100);
    }
    return new FrameworkEvent(FrameworkEvent.STOPPED, this, null);
  }
Esempio n. 2
0
  private File create(String bsn, Version v) throws Exception {
    String name = bsn + "-" + v;
    Builder b = new Builder();
    b.setBundleSymbolicName(bsn);
    b.setBundleVersion(v);
    b.setProperty("Random", random++ + "");
    b.setProperty("-resourceonly", true + "");
    b.setIncludeResource("foo;literal='foo'");
    Jar jar = b.build();
    assertTrue(b.check());

    File file = IO.getFile(tmp, name + ".jar");
    file.getParentFile().mkdirs();
    jar.updateModified(System.currentTimeMillis(), "Force it to now");
    jar.write(file);
    b.close();
    return file;
  }