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); }
public MiniFramework(Map<Object, Object> properties) { this.properties = new Properties(System.getProperties()); this.properties.putAll(properties); bundles.put(new Long(0), this); last = loader = getClass().getClassLoader(); }
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; }