use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class DeploymentAgentTest method testFeatureRepoResolution.
@Test
@SuppressWarnings("unchecked")
public void testFeatureRepoResolution() throws Exception {
CommandSupport.executeCommand("fabric:create --force --clean -n --wait-for-provisioning");
// We are just want to use a feature repository that is not part of the distribution.
CommandSupport.executeCommand("fabric:profile-create --parent feature-camel test-profile");
CommandSupport.executeCommand("fabric:version-create --parent 1.0 1.1");
CommandSupport.executeCommand("fabric:profile-edit --repository mvn:io.fabric8.examples.fabric-camel-dosgi/features/" + System.getProperty("fabric.version") + "/xml/features test-profile 1.1");
CommandSupport.executeCommand("fabric:profile-edit --feature fabric-dosgi test-profile 1.1");
// We remove all repositories from agent config but the maven central to rely on the fabric-maven-proxy.
// Also remove local repository
CommandSupport.executeCommand("fabric:profile-edit --pid io.fabric8.agent/org.ops4j.pax.url.mvn.repositories=http://repo1.maven.org/maven2@id=m2central default 1.1");
CommandSupport.executeCommand("fabric:profile-edit --pid test-profile 1.1");
BundleContext moduleContext = ServiceLocator.getSystemContext();
ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(moduleContext, FabricService.class);
try {
FabricService fabricService = fabricProxy.getService();
Set<Container> containers = ContainerBuilder.create().withName("smoke_cnt_a").withProfiles("test-profile").assertProvisioningResult().build(fabricService);
try {
// We want to remove all repositories from fabric-agent.
for (Container container : containers) {
CommandSupport.executeCommand("fabric:container-upgrade 1.1 " + container.getId());
System.out.flush();
}
ProvisionSupport.provisioningSuccess(containers, ProvisionSupport.PROVISION_TIMEOUT);
CommandSupport.executeCommand("fabric:container-list");
for (Container container : containers) {
CommandSupport.executeCommand("fabric:container-connect -u admin -p admin " + container.getId() + " osgi:list");
CommandSupport.executeCommand("fabric:container-connect -u admin -p admin " + container.getId() + " config:proplist --pid org.ops4j.pax.url.mvn");
System.out.flush();
}
} finally {
ContainerBuilder.stop(fabricService, containers);
}
} finally {
fabricProxy.close();
}
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class EnsembleTest method testAddAndRemove.
// @Ignore("ENTESB-3580")
@Test
@SuppressWarnings("unchecked")
public void testAddAndRemove() throws Exception {
System.err.println(CommandSupport.executeCommand("fabric:create --force --clean -n --wait-for-provisioning"));
BundleContext moduleContext = ServiceLocator.getSystemContext();
ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(moduleContext, FabricService.class);
try {
FabricService fabricService = fabricProxy.getService();
Set<Container> containers = ContainerBuilder.create(2).withName("smoke_ens_a").assertProvisioningResult().build(fabricService);
try {
Deque<Container> containerQueue = new LinkedList<Container>(containers);
Deque<Container> addedContainers = new LinkedList<Container>();
for (int e = 0; e < 3 && containerQueue.size() >= 2 && containerQueue.size() % 2 == 0; e++) {
Container cnt1 = containerQueue.removeFirst();
Container cnt2 = containerQueue.removeFirst();
addedContainers.add(cnt1);
addedContainers.add(cnt2);
EnsembleSupport.addToEnsemble(fabricService, cnt1, cnt2);
System.err.println(CommandSupport.executeCommand("config:proplist --pid io.fabric8.zookeeper"));
System.err.println(CommandSupport.executeCommand("fabric:container-list"));
System.err.println(CommandSupport.executeCommand("fabric:ensemble-list"));
ZooKeeperClusterService zooKeeperClusterService = ServiceLocator.awaitService(ZooKeeperClusterService.class);
Assert.assertNotNull(zooKeeperClusterService);
List<String> ensembleContainersResult = zooKeeperClusterService.getEnsembleContainers();
Assert.assertTrue(ensembleContainersResult.contains(cnt1.getId()));
Assert.assertTrue(ensembleContainersResult.contains(cnt2.getId()));
ProvisionSupport.provisioningSuccess(Arrays.asList(fabricService.getContainers()), ProvisionSupport.PROVISION_TIMEOUT);
}
for (int e = 0; e < 3 && addedContainers.size() >= 2 && addedContainers.size() % 2 == 0; e++) {
Container cnt1 = addedContainers.removeFirst();
Container cnt2 = addedContainers.removeFirst();
containerQueue.add(cnt1);
containerQueue.add(cnt2);
EnsembleSupport.removeFromEnsemble(fabricService, cnt1, cnt2);
System.err.println(CommandSupport.executeCommand("config:proplist --pid io.fabric8.zookeeper"));
System.err.println(CommandSupport.executeCommand("fabric:container-list"));
System.err.println(CommandSupport.executeCommand("fabric:ensemble-list"));
ZooKeeperClusterService zooKeeperClusterService = ServiceLocator.awaitService(ZooKeeperClusterService.class);
Assert.assertNotNull(zooKeeperClusterService);
List<String> ensembleContainersResult = zooKeeperClusterService.getEnsembleContainers();
Assert.assertFalse(ensembleContainersResult.contains(cnt1.getId()));
Assert.assertFalse(ensembleContainersResult.contains(cnt2.getId()));
ProvisionSupport.provisioningSuccess(Arrays.asList(fabricService.getContainers()), ProvisionSupport.PROVISION_TIMEOUT);
}
} finally {
ContainerBuilder.stop(fabricService, containers);
}
} finally {
fabricProxy.close();
}
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class EnsembleTest method deployment.
@Deployment
@StartLevelAware(autostart = true)
public static Archive<?> deployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "ensemble-test.jar");
archive.addPackage(CommandSupport.class.getPackage());
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(archive.getName());
builder.addBundleVersion("1.0.0");
builder.addImportPackages(ServiceLocator.class, FabricService.class);
builder.addImportPackages("io.fabric8.git");
builder.addImportPackages(AbstractCommand.class, Action.class);
builder.addImportPackage("org.apache.felix.service.command;status=provisional");
builder.addImportPackages(ConfigurationAdmin.class, ServiceTracker.class, Logger.class);
return builder.openStream();
}
});
return archive;
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class JoinTest method deployment.
@Deployment
@StartLevelAware(autostart = true)
public static Archive<?> deployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "join-test.jar");
archive.addPackage(CommandSupport.class.getPackage());
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(archive.getName());
builder.addBundleVersion("1.0.0");
builder.addImportPackages(ServiceLocator.class, FabricService.class);
builder.addImportPackages("io.fabric8.git");
builder.addImportPackages(AbstractCommand.class, Action.class);
builder.addImportPackage("org.apache.felix.service.command;status=provisional");
builder.addImportPackages(ConfigurationAdmin.class, AdminService.class, ServiceTracker.class, Logger.class);
return builder.openStream();
}
});
return archive;
}
use of io.fabric8.kubernetes.api.model in project fabric8 by jboss-fuse.
the class PatchApplyTest method deployment.
@Deployment
@StartLevelAware(autostart = true)
public static Archive<?> deployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "patch-apply-test.jar");
archive.addPackage(CommandSupport.class.getPackage());
archive.addPackage(IOHelpers.class.getPackage());
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(archive.getName());
builder.addBundleVersion("1.0.0");
builder.addImportPackages(ServiceLocator.class, FabricService.class);
builder.addImportPackages("io.fabric8.git");
builder.addImportPackages(AbstractCommand.class, Action.class);
builder.addImportPackage("org.apache.felix.service.command;status=provisional");
builder.addImportPackages(ConfigurationAdmin.class, ServiceTracker.class, Logger.class);
return builder.openStream();
}
});
// add the original 'patchable' bundle version and the patch file to the test bundle as an extra resource
archive.add(createPatchableBundle(ORIGINAL_VERSION), "/bundles", ZipExporter.class);
archive.add(createPatchZip(), "/patches", ZipExporter.class);
return archive;
}
Aggregations