Map<String, String> props = new HashMap<String, String>();
props.put("osgi.clean", "true");
props.put("osgi.dev", "target/classes");
FrameworkFactory frameworkFactory = FrameworkFactoryFinder.loadSingleFrameworkFactory();
Framework framework = frameworkFactory.newFramework(props);
framework.start();
BundleContext bc = framework.getBundleContext();
assertNotNull(bc);
String reference = "reference:file:" + PathUtils.getBaseDir()
+ "/target/pax-exam-sample9-pde";
Bundle bundle = bc.installBundle(reference);
assertNotNull(bundle);
assertEquals("org.ops4j.pax.exam.sample9.pde", bundle.getSymbolicName());
bundle.start();
ServiceReference serviceRef = bc
.getServiceReference("org.ops4j.pax.exam.sample9.pde.HelloService");
Object service = bc.getService(serviceRef);
assertNotNull(service);
assertEquals("org.ops4j.pax.exam.sample9.pde.impl.EnglishHelloService", service
.getClass().getName());
bundle.uninstall();
framework.stop();
}