use of org.apache.felix.bundlerepository.RepositoryAdmin in project aries by apache.
the class MinimumImportsTest method testAppUsingAriesApplicationManager.
@Test
public void testAppUsingAriesApplicationManager() throws Exception {
// Register a BlueprintListener to listen for the events from the BlueprintContainer for the bundle in the appmgrclienttest.eba
AppMgrClientBlueprintListener acbl = new AppMgrClientBlueprintListener();
ServiceRegistration sr = bundleContext.registerService("org.osgi.service.blueprint.container.BlueprintListener", acbl, null);
AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("appmgrclienttest.eba")));
RepositoryAdmin repositoryAdmin = context().getService(RepositoryAdmin.class);
Repository[] repos = repositoryAdmin.listRepositories();
for (Repository repo : repos) {
repositoryAdmin.removeRepository(repo.getURI());
}
repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());
AriesApplicationContext ctx = manager.install(app);
ctx.start();
int sleepfor = 3000;
while ((acbl.success == null || acbl.success == false) && sleepfor > 0) {
Thread.sleep(100);
sleepfor -= 100;
}
assertNotNull("Timed out - didn't receive Blueprint CREATED or FAILURE event", acbl.success);
assertTrue("Received Blueprint FAILURE event", acbl.success);
ctx.stop();
manager.uninstall(ctx);
sr.unregister();
}
use of org.apache.felix.bundlerepository.RepositoryAdmin in project aries by apache.
the class Aries1523Test method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
BundleContext context = context();
ServiceReference<RepositoryAdmin> ref = context.getServiceReference(RepositoryAdmin.class);
assertNotNull("The RepositoryAdmin service does not exist", ref);
try {
repositoryAdmin = (RepositoryAdmin) context.getService(ref);
DataModelHelper helper = repositoryAdmin.getHelper();
url = createRepositoryXml(helper);
Repository repository = repositoryAdmin.addRepository(url);
Resource resource = repository.getResources()[0];
System.out.println(resource.getURI());
} finally {
context.ungetService(ref);
}
}
use of org.apache.felix.bundlerepository.RepositoryAdmin in project aries by apache.
the class Aries1608Test method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
BundleContext context = context();
ServiceReference<RepositoryAdmin> ref = context.getServiceReference(RepositoryAdmin.class);
assertNotNull("The RepositoryAdmin service does not exist", ref);
try {
repositoryAdmin = (RepositoryAdmin) context.getService(ref);
DataModelHelper helper = repositoryAdmin.getHelper();
url = createRepositoryXml(helper);
Repository repository = repositoryAdmin.addRepository(url);
Resource resource = repository.getResources()[0];
System.out.println(resource.getURI());
} finally {
context.ungetService(ref);
}
}
use of org.apache.felix.bundlerepository.RepositoryAdmin in project aries by apache.
the class Aries1522Test method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
BundleContext context = context();
ServiceReference<RepositoryAdmin> ref = context.getServiceReference(RepositoryAdmin.class);
assertNotNull("The RepositoryAdmin service does not exist", ref);
try {
repositoryAdmin = (RepositoryAdmin) context.getService(ref);
DataModelHelper helper = repositoryAdmin.getHelper();
url = createRepositoryXml(helper);
Repository repository = repositoryAdmin.addRepository(url);
Resource resource = repository.getResources()[0];
System.out.println(resource.getURI());
} finally {
context.ungetService(ref);
}
}
Aggregations