@Test
  public void testScale() throws IOException {

    final ByteArrayId adapterId = new ByteArrayId(ftype.getTypeName());
    final Random r = new Random(3434);
    for (int i = 0; i < 10000; i++) {
      final SimpleFeature feature =
          createTestFeature(
              "f" + i,
              new Coordinate(
                  round(30.0 + (r.nextGaussian() * 0.0001)),
                  round(30.0 + (r.nextGaussian() * 0.0001))));
      mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature.getID())), feature);
    }

    final List<Pair<PartitionDataWritable, AdapterWithObjectWritable>> mapperResults =
        mapDriver.run();

    final List<Pair<PartitionDataWritable, List<AdapterWithObjectWritable>>> partitions =
        getReducerDataFromMapperInput(mapperResults);

    reduceDriver.addAll(partitions);

    reduceDriver
        .getConfiguration()
        .setInt(
            GeoWaveConfiguratorBase.enumToConfKey(
                NNMapReduce.class, ClusteringParameters.Clustering.MINIMUM_SIZE),
            10);

    final List<Pair<GeoWaveInputKey, ObjectWritable>> reduceResults = reduceDriver.run();
    assertTrue(reduceResults.size() > 0);
  }
 protected void generateData(
     MapDriver<LongWritable, TripleWritable, LongWritable, QuadWritable> driver, int num) {
   for (int i = 0; i < num; i++) {
     Triple t =
         new Triple(
             NodeFactory.createURI("http://subjects/" + i),
             NodeFactory.createURI("http://predicate"),
             NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger));
     Quad q = new Quad(t.getSubject(), t);
     driver.addInput(new LongWritable(i), new TripleWritable(t));
     driver.addOutput(new LongWritable(i), new QuadWritable(q));
   }
 }
  @Test
  public void testReducer() throws IOException {

    final ByteArrayId adapterId = new ByteArrayId(ftype.getTypeName());

    final SimpleFeature feature1 = createTestFeature("f1", new Coordinate(30.0, 30.00000001));
    final SimpleFeature feature2 = createTestFeature("f2", new Coordinate(50.001, 50.001));
    final SimpleFeature feature3 =
        createTestFeature("f3", new Coordinate(30.00000001, 30.00000001));
    final SimpleFeature feature4 = createTestFeature("f4", new Coordinate(50.0011, 50.00105));
    final SimpleFeature feature5 = createTestFeature("f5", new Coordinate(50.00112, 50.00111));
    final SimpleFeature feature6 =
        createTestFeature("f6", new Coordinate(30.00000001, 30.00000002));
    final SimpleFeature feature7 = createTestFeature("f7", new Coordinate(50.00113, 50.00114));
    final SimpleFeature feature8 =
        createTestFeature("f8", new Coordinate(40.00000001, 40.000000002));

    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature1.getID())), feature1);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature2.getID())), feature2);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature3.getID())), feature3);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature4.getID())), feature4);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature5.getID())), feature5);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature6.getID())), feature6);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature7.getID())), feature7);
    mapDriver.addInput(new GeoWaveInputKey(adapterId, new ByteArrayId(feature8.getID())), feature8);

    final List<Pair<PartitionDataWritable, AdapterWithObjectWritable>> mapperResults =
        mapDriver.run();
    assertNotNull(getPartitionDataFor(mapperResults, feature1.getID(), true));
    assertNotNull(getPartitionDataFor(mapperResults, feature2.getID(), true));
    assertNotNull(getPartitionDataFor(mapperResults, feature2.getID(), true));
    assertNotNull(getPartitionDataFor(mapperResults, feature3.getID(), true));

    assertEquals(
        getPartitionDataFor(mapperResults, feature1.getID(), true).getId(),
        getPartitionDataFor(mapperResults, feature3.getID(), true).getId());

    assertEquals(
        getPartitionDataFor(mapperResults, feature6.getID(), true).getId(),
        getPartitionDataFor(mapperResults, feature3.getID(), true).getId());

    assertEquals(
        getPartitionDataFor(mapperResults, feature5.getID(), true).getId(),
        getPartitionDataFor(mapperResults, feature7.getID(), true).getId());

    assertEquals(
        getPartitionDataFor(mapperResults, feature5.getID(), true).getId(),
        getPartitionDataFor(mapperResults, feature4.getID(), true).getId());

    final List<Pair<PartitionDataWritable, List<AdapterWithObjectWritable>>> partitions =
        getReducerDataFromMapperInput(mapperResults);

    reduceDriver.addAll(partitions);

    reduceDriver
        .getConfiguration()
        .setInt(
            GeoWaveConfiguratorBase.enumToConfKey(
                NNMapReduce.class, ClusteringParameters.Clustering.MINIMUM_SIZE),
            2);

    final List<Pair<GeoWaveInputKey, ObjectWritable>> reduceResults = reduceDriver.run();

    assertEquals(2, reduceResults.size());

    /*
     * assertEquals( feature3.getID(), find( reduceResults,
     * feature1.getID()).toString());
     *
     * assertEquals( feature1.getID(), find( reduceResults,
     * feature3.getID()).toString());
     *
     * assertEquals( feature4.getID(), find( reduceResults,
     * feature2.getID()).toString());
     *
     * assertEquals( feature2.getID(), find( reduceResults,
     * feature4.getID()).toString());
     */
  }