EnsembleSupport.addToEnsemble(fabricService, cnt1, cnt2);
System.out.println(CommandSupport.executeCommand("config:proplist --pid io.fabric8.zookeeper"));
System.out.println(CommandSupport.executeCommand("fabric:container-list"));
System.out.println(CommandSupport.executeCommand("fabric:ensemble-list"));
ZooKeeperClusterService zooKeeperClusterService = ServiceLocator.awaitService(ZooKeeperClusterService.class);
org.junit.Assert.assertNotNull(zooKeeperClusterService);
List<String> ensembleContainersResult = zooKeeperClusterService.getEnsembleContainers();
org.junit.Assert.assertTrue(ensembleContainersResult.contains(cnt1.getId()));
org.junit.Assert.assertTrue(ensembleContainersResult.contains(cnt2.getId()));
ProvisionSupport.provisioningSuccess(Arrays.asList(fabricService.getContainers()), ProvisionSupport.PROVISION_TIMEOUT);
}
int index = rand.nextInt(addedContainers.size());
String randomContainer = addedContainers.get(index).getId();
System.out.println(CommandSupport.executeCommand("fabric:version-create 1." + version));
System.out.println(CommandSupport.executeCommand("fabric:container-upgrade 1." + version + " " + randomContainer));
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.out.println(CommandSupport.executeCommand("config:proplist --pid io.fabric8.zookeeper"));
System.out.println(CommandSupport.executeCommand("fabric:container-list"));
System.out.println(CommandSupport.executeCommand("fabric:ensemble-list"));
ZooKeeperClusterService zooKeeperClusterService = ServiceLocator.awaitService(ZooKeeperClusterService.class);
org.junit.Assert.assertNotNull(zooKeeperClusterService);
List<String> ensembleContainersResult = zooKeeperClusterService.getEnsembleContainers();
org.junit.Assert.assertFalse(ensembleContainersResult.contains(cnt1.getId()));
org.junit.Assert.assertFalse(ensembleContainersResult.contains(cnt2.getId()));
ProvisionSupport.provisioningSuccess(Arrays.asList(fabricService.getContainers()), ProvisionSupport.PROVISION_TIMEOUT);
}
System.out.println(CommandSupport.executeCommand("fabric:container-rollback 1." + (version - 1) + " " + randomContainer));