new SimpleLongRangePartitionerFactory<Writable, Writable>();
factory.setConf(new ImmutableClassesGiraphConfiguration(conf));
ArrayList<WorkerInfo> infos = new ArrayList<WorkerInfo>();
for (int i = 0; i < numWorkers; i++) {
WorkerInfo info = new WorkerInfo();
info.setInetSocketAddress(new InetSocketAddress(8080));
info.setTaskId(i);
infos.add(info);
}
Collection<PartitionOwner> owners =
factory.createMasterGraphPartitioner().createInitialPartitionOwners(infos, -1);
int[] tasks = new int[owners.size()];
for (PartitionOwner owner : owners) {
WorkerInfo worker = owner.getWorkerInfo();
assertEquals(0, tasks[owner.getPartitionId()]);
tasks[owner.getPartitionId()] = worker.getTaskId() + 1;
}
checkMapping(tasks, allowedWorkerDiff, emptyWorkers);
WorkerGraphPartitioner<LongWritable, Writable, Writable> workerPartitioner =
factory.createWorkerGraphPartitioner();