new File(TMP_FOLDER).mkdirs();
createSploutEnsemble(N_QNODES, N_DNODES);
Random random = new Random(SEED);
Tablespace testTablespace = createTestTablespace(N_DNODES);
File deployData = new File(TMP_FOLDER + "/" + "deploy-folder-" + random.nextInt());
deployData.mkdir();
for(int i = 0; i < N_DNODES; i++) {
File dbData = new File(deployData, i + ".db");
Files.write(new String("foo").getBytes(), dbData);
}
final SploutClient[] clients = new SploutClient[N_QNODES];
for(int i = 0; i < N_QNODES; i++) {
clients[i] = new SploutClient(getqNodes().get(i).getAddress());
}
final SploutClient client1 = clients[0];
// Check that all QNodes have the full list of DNodes
new TestUtils.NotWaitingForeverCondition() {
@Override
public boolean endCondition() {
try {
for(int i = 0; i < N_QNODES; i++) {
List<String> dNodeList = clients[i].dNodeList();
if(dNodeList.size() != 3) {
return false;
}
QNodeHandler handler = (QNodeHandler)getqNodes().get(i).getHandler();
for(String dnode: dNodeList) {
if(handler.getContext().getThriftClientCache().get(dnode) == null) {
return false;
}
}
}
return true;
} catch(IOException e) {
// test failed
e.printStackTrace();
return true;
}
}
}.waitAtMost(5000);
// Deploy
client1.deploy("p1", testTablespace.getPartitionMap(), testTablespace.getReplicationMap(),
deployData.getAbsoluteFile().toURI());
// Check that all QNodes have the deployment data
new TestUtils.NotWaitingForeverCondition() {