CalculatePartitioner { public CalculatePartitioner(final Path path, final Schema schema, final FileSystem fs) { this.path = path; this.schema = schema; this.fs = fs; } CalculatePartitioner(final Path path, final Schema schema, final FileSystem fs); GraphPartitioner call();  }
@Test public void calculatePartitionerTest(@TempDir java.nio.file.Path tempDir) throws IOException { final FileSystem fs = FileSystem.get(new Configuration()); final Schema schema = getSchema(); final SchemaUtils schemaUtils = new SchemaUtils(schema); final String topLevelFolder = tempDir.toString(); writeData(topLevelFolder, schemaUtils); final GraphPartitioner actual = new CalculatePartitioner(new Path(topLevelFolder), schema, fs).call(); final GraphPartitioner expected = new GraphPartitioner(); final List<PartitionKey> splitPointsEntity = new ArrayList<>(); for (int i = 1; i < 10; i++) { splitPointsEntity.add(new PartitionKey(new Object[]{10L * i})); } final GroupPartitioner groupPartitionerEntity = new GroupPartitioner(TestGroups.ENTITY, splitPointsEntity); expected.addGroupPartitioner(TestGroups.ENTITY, groupPartitionerEntity); final GroupPartitioner groupPartitionerEntity2 = new GroupPartitioner(TestGroups.ENTITY_2, splitPointsEntity); expected.addGroupPartitioner(TestGroups.ENTITY_2, groupPartitionerEntity2); final List<PartitionKey> splitPointsEdge = new ArrayList<>(); for (int i = 1; i < 10; i++) { splitPointsEdge.add(new PartitionKey(new Object[]{10L * i, 10L * i + 1, true})); } final GroupPartitioner groupPartitionerEdge = new GroupPartitioner(TestGroups.EDGE, splitPointsEdge); expected.addGroupPartitioner(TestGroups.EDGE, groupPartitionerEdge); final GroupPartitioner groupPartitionerEdge2 = new GroupPartitioner(TestGroups.EDGE_2, splitPointsEdge); expected.addGroupPartitioner(TestGroups.EDGE_2, groupPartitionerEdge2); final List<PartitionKey> splitPointsReversedEdge = new ArrayList<>(); for (int i = 1; i < 10; i++) { splitPointsReversedEdge.add(new PartitionKey(new Object[]{10L * i + 1, 10L * i, true})); } final GroupPartitioner reversedGroupPartitionerEdge = new GroupPartitioner(TestGroups.EDGE, splitPointsReversedEdge); expected.addGroupPartitionerForReversedEdges(TestGroups.EDGE, reversedGroupPartitionerEdge); final GroupPartitioner reversedGroupPartitionerEdge2 = new GroupPartitioner(TestGroups.EDGE_2, splitPointsReversedEdge); expected.addGroupPartitionerForReversedEdges(TestGroups.EDGE_2, reversedGroupPartitionerEdge2); assertEquals(expected, actual); }