Osgis { public static BundleFinder bundleFinder(Framework framework) { return new BundleFinder(framework); }  static BundleFinder bundleFinder(Framework framework); static Framework getFramework(String felixCacheDir, boolean clean); static void ungetFramework(Framework framework); static Bundle install(Framework framework, String url); @Beta static Optional<Bundle> getBundleOf(Class<?> clazz);  }
@Test public void testFindByNameAndVersion() throws Exception { Bundle result = Osgis.bundleFinder(framework) .symbolicName("mybundle") .version("1.0.0") .find() .get(); assertEquals(result, myBundle1_0_0); }
@Test public void testFindAllByNameAndVersion() throws Exception { List<Bundle> result = Osgis.bundleFinder(framework) .symbolicName("mybundle") .version("1.0.0") .findAll(); assertEquals(result, ImmutableList.of(myBundle1_0_0)); }
@Test public void testFindByNameAndVersionRange() throws Exception { List<Bundle> result = Osgis.bundleFinder(framework) .symbolicName("mybundle") .version("[1.0.0, 1.1.0)") .findAll(); assertEquals(result, ImmutableList.of(myBundle1_0_0)); List<Bundle> result2 = Osgis.bundleFinder(framework) .symbolicName("mybundle") .version("[1.0.0, 2.0.0)") .findAll(); assertEquals(result2, ImmutableList.of(myBundle1_0_0, myBundle1_1_0)); List<Bundle> result3 = Osgis.bundleFinder(framework) .symbolicName("mybundle") .version("[1.0.0, 2.0.0]") .findAll(); assertEquals(result3, ImmutableList.of(myBundle1_0_0, myBundle1_1_0, myBundle2_0_0)); List<Bundle> result4 = Osgis.bundleFinder(framework) .symbolicName("mybundle") .version("[2.0.0, 3.0.0)") .findAll(); assertEquals(result4, ImmutableList.of(myBundle2_0_0_snapshot, myBundle2_0_0)); List<Bundle> result5 = Osgis.bundleFinder(framework) .symbolicName("snapshotbundle") .version("[1.0.0, 2.0.0)") .findAll(); assertEquals(result5, ImmutableList.of(snapshotBundle1_0_0_snapshot)); }
@Test public void testFindAllByNameOnly() throws Exception { List<Bundle> result = Osgis.bundleFinder(framework) .symbolicName("mybundle") .findAll(); assertEquals(result, ImmutableList.of(myBundle2_0_0_snapshot, myBundle1_0_0, myBundle1_1_0, myBundle2_0_0)); }