RandomSeedGenerator { private RandomSeedGenerator() {} private  RandomSeedGenerator(); static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure); static Path buildRandom(Configuration conf,
                                 Path input,
                                 Path output,
                                 int k,
                                 DistanceMeasure measure,
                                 Long seed); static final String K; }
@Test public void testRandomSeedGenerator() throws Exception { List<VectorWritable> points = getPoints(); Job job = new Job(); Configuration conf = job.getConfiguration(); job.setMapOutputValueClass(VectorWritable.class); Path input = getTestTempFilePath("random-input"); Path output = getTestTempDirPath("random-output"); ClusteringTestUtils.writePointsToFile(points, input, fs, conf); RandomSeedGenerator.buildRandom(conf, input, output, 4, new ManhattanDistanceMeasure()); int clusterCount = 0; Collection<Integer> set = Sets.newHashSet(); for (ClusterWritable clusterWritable : new SequenceFileValueIterable<ClusterWritable>(new Path(output, "part-randomSeed"), true, conf)) { clusterCount++; Cluster cluster = clusterWritable.getValue(); int id = cluster.getId(); assertTrue(set.add(id)); Vector v = cluster.getCenter(); assertVectorEquals(RAW[id], v); } assertEquals(4, clusterCount); }