try {
// Create an ensemble of 5 DNodes
List<PartitionEntry> partitions = new ArrayList<PartitionEntry>();
List<ReplicationEntry> replicationEntries = new ArrayList<ReplicationEntry>();
for(int i = 0; i < 5; i++) {
SploutConfiguration dNodeConfig = SploutConfiguration.getTestConfig();
// We instantiate a DNode with a handler that returns "DNode" + i for any query
DNode dnode = TestUtils.getTestDNode(dNodeConfig, new TellIDHandler("DNode" + i), "dnode-"
+ this.getClass().getName() + "-" + i);
dNodes.add(dnode);
// Define the partition for this DNode
// DNode 0 will have [10, 20), DNode 1 [20, 30], ...
PartitionEntry partitionEntry = new PartitionEntry();
partitionEntry.setMin((i * 10 + 10) + "");
partitionEntry.setMax((i * 10 + 20) + "");
partitionEntry.setShard(i);
partitions.add(partitionEntry);
// And the replication
ReplicationEntry repEntry = new ReplicationEntry();
repEntry.setShard(i);
repEntry.setNodes(Arrays.asList(new String[] { "localhost:" + dNodeConfig.getInt(DNodeProperties.PORT) }));
replicationEntries.add(repEntry);
}
Tablespace tablespace1 = new Tablespace(new PartitionMap(partitions), new ReplicationMap(replicationEntries), 1l,
0l);