application.waitForSwing();
LoggerFactory.setDebugLevel(-1);
final String username = TEST_USERNAME;
final boolean useSudo = false;
final Cluster cluster = clusterProvider.get();
cluster.setName("test");
for (int i = 1; i <= NUMBER_OF_HOSTS; i++) {
final String hostName = "test" + i;
final Host host = hostProvider.get();
host.init();
initHost(host, hostName, username, useSudo);
hosts.add(host);
host.setCluster(cluster);
cluster.addHost(host);
final String saveFile = application.getDefaultSaveFile();
application.saveConfig(saveFile, false);
}
for (final Host host : hosts) {
host.disconnect();
}
cluster.connect(null, true, 0);
for (final Host host : hosts) {
final boolean r = waitForCondition(
new Condition() {
@Override
public boolean passed() {
return host.isConnected();
}
}, 300, 20000);
if (!r) {
error("could not establish connection to " + host.getName());
}
}
application.addClusterToClusters(cluster);
application.invokeAndWait(new Runnable() {
@Override
public void run() {
clusterTabFactory.createClusterTab(cluster);
}
});
//guiData.getEmptyBrowser().addClusterBox(cluster);
final String saveFile = application.getDefaultSaveFile();
application.saveConfig(saveFile, false);
guiData.refreshClustersPanel();
guiData.expandTerminalSplitPane(GUIData.TerminalSize.COLLAPSE);
cluster.getClusterTab().addClusterView();
cluster.getClusterTab().requestFocus();
guiData.checkAddClusterButtons();
for (final Host host : hosts) {
host.waitForServerStatusLatch();
}
clusterLoaded = true;