use of io.fabric8.utils.BundleUtils in project fabric8 by jboss-fuse.
the class ResolverTest method testResolverInheritanceOnChild.
@Test
public void testResolverInheritanceOnChild() throws Exception {
System.out.println(CommandSupport.executeCommand("fabric:create --force --clean -n --wait-for-provisioning -g localip -r manualip --manual-ip localhost -b localhost"));
// System.out.println(executeCommand("shell:info"));
// System.out.println(executeCommand("fabric:info"));
// System.out.println(executeCommand("fabric:profile-list"));
BundleContext moduleContext = ServiceLocator.getSystemContext();
ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(moduleContext, FabricService.class);
try {
FabricService fabricService = fabricProxy.getService();
CuratorFramework curator = fabricService.adapt(CuratorFramework.class);
Set<Container> containers = ContainerBuilder.create(1, 1).withName("basic.cntG").withProfiles("default").assertProvisioningResult().build(fabricService);
try {
Container cntG = containers.iterator().next();
Assert.assertEquals("manualip", getSubstitutedPath(curator, ZkPath.CONTAINER_RESOLVER.getPath(cntG.getId())));
Assert.assertEquals("manualip", fabricService.getCurrentContainer().getResolver());
// We stop the config admin bridge, since the next step is going to hung the container if we do propagate the change to config admin.
// new BundleUtils(bundleContext).findAndStopBundle("io.fabric8.fabric-configadmin");
// We want to make sure that the child points to the parent, so we change the parent resolvers and assert.
System.out.println(CommandSupport.executeCommand("fabric:container-resolver-set --container root localip"));
Assert.assertEquals("localip", getSubstitutedPath(curator, ZkPath.CONTAINER_RESOLVER.getPath(cntG.getId())));
} finally {
ContainerBuilder.destroy(fabricService, containers);
}
} finally {
fabricProxy.close();
}
}
use of io.fabric8.utils.BundleUtils in project fabric8 by jboss-fuse.
the class JoinAction method installBundles.
public void installBundles() throws BundleException {
BundleUtils bundleUtils = new BundleUtils(bundleContext);
Bundle bundleFabricCommands = bundleUtils.findBundle("io.fabric8.fabric-commands");
if (bundleFabricCommands == null) {
bundleFabricCommands = bundleUtils.installBundle("mvn:io.fabric8/fabric-commands/" + FabricConstants.FABRIC_VERSION);
}
bundleFabricCommands.start();
Bundle bundleFabricAgent = bundleUtils.findBundle("io.fabric8.fabric-agent");
if (nonManaged && bundleFabricAgent == null) {
// do nothing
} else if (nonManaged && bundleFabricAgent != null) {
bundleFabricAgent.stop();
} else if (bundleFabricAgent == null) {
bundleFabricAgent = bundleUtils.installBundle("mvn:io.fabric8/fabric-agent/" + FabricConstants.FABRIC_VERSION);
bundleFabricAgent.start();
} else {
bundleFabricAgent.start();
}
}
Aggregations