Program: 113014
Project: 113014
Buggy source:
@Test public void testPartition() throws IOException, ParseException {
  final SimpleFeatureType ftype=AnalyticFeature.createGeometryFeatureAdapter("String_Node_Str",new String[]{"String_Node_Str"},BasicFeatureTypes.DEFAULT_NAMESPACE,ClusteringUtils.CLUSTERING_CRS).getType();
  final GeometryFactory factory=new GeometryFactory();
  SimpleFeature feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(0,0)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  final PropertyManagement propertyManagement=new PropertyManagement();
  final AdapterBasedPartitioner partitioner=new AdapterBasedPartitioner();
  propertyManagement.store(ClusteringParameters.Clustering.DISTANCE_THRESHOLDS,"String_Node_Str");
  propertyManagement.store(CommonParameters.Common.INDEX_MODEL_BUILDER_CLASS,SpatialIndexModelBuilder.class);
  final Configuration configuration=new Configuration();
  final Class<?> scope=OrthodromicDistancePartitionerTest.class;
  propertyManagement.setJobConfiguration(configuration,scope);
  final DataStorePluginOptions pluginOptions=new DataStorePluginOptions();
  GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("String_Node_Str",new MemoryStoreFactoryFamily());
  pluginOptions.selectPlugin("String_Node_Str");
  final PersistableStore store=new PersistableStore(pluginOptions);
  store.getDataStoreOptions().createAdapterStore().addAdapter(new FeatureDataAdapter(ftype));
  ((ParameterEnum<PersistableStore>)StoreParam.STORE).getHelper().setValue(configuration,scope,store);
  partitioner.initialize(Job.getInstance(configuration),scope);
  List<PartitionData> partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(4,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  for (  final PartitionData partition : partitions) {
    final MultiDimensionalNumericData ranges=partitioner.getRangesForPartition(partition);
    assertTrue(ranges.getDataPerDimension()[0].getMin() < 0.0000000001);
    assertTrue(ranges.getDataPerDimension()[0].getMax() > -0.0000000001);
    assertTrue(ranges.getDataPerDimension()[1].getMin() < 0.00000000001);
    assertTrue(ranges.getDataPerDimension()[1].getMax() > -0.0000000001);
  }
  feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(-179.99999996,0)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(4,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(179.99999996,91)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(2,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(88,0)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(4,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  double maxX=0;
  double minX=0;
  double maxY=0;
  double minY=0;
  for (  final PartitionData partition : partitions) {
    final MultiDimensionalNumericData ranges=partitioner.getRangesForPartition(partition);
    maxX=Math.max(maxX,ranges.getMaxValuesPerDimension()[1]);
    maxY=Math.max(maxY,ranges.getMaxValuesPerDimension()[0]);
    minX=Math.min(minX,ranges.getMinValuesPerDimension()[1]);
    minY=Math.min(minY,ranges.getMinValuesPerDimension()[0]);
  }
  assertTrue(maxY > 88.0);
  assertTrue(minY < 88.0);
  assertTrue(maxX > 0);
  assertTrue(minX < 0);
}

Fixed version (ground truth):
@Test public void testPartition() throws IOException, ParseException {
  final SimpleFeatureType ftype=AnalyticFeature.createGeometryFeatureAdapter("String_Node_Str",new String[]{"String_Node_Str"},BasicFeatureTypes.DEFAULT_NAMESPACE,ClusteringUtils.CLUSTERING_CRS).getType();
  final GeometryFactory factory=new GeometryFactory();
  SimpleFeature feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(0,0)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  final PropertyManagement propertyManagement=new PropertyManagement();
  final AdapterBasedPartitioner partitioner=new AdapterBasedPartitioner();
  propertyManagement.store(ClusteringParameters.Clustering.DISTANCE_THRESHOLDS,"String_Node_Str");
  propertyManagement.store(CommonParameters.Common.INDEX_MODEL_BUILDER_CLASS,SpatialIndexModelBuilder.class);
  final Configuration configuration=new Configuration();
  final Class<?> scope=OrthodromicDistancePartitionerTest.class;
  propertyManagement.setJobConfiguration(configuration,scope);
  final DataStorePluginOptions pluginOptions=new DataStorePluginOptions();
  GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("String_Node_Str",new MemoryStoreFactoryFamily());
  pluginOptions.selectPlugin("String_Node_Str");
  final PersistableStore store=new PersistableStore(pluginOptions);
  store.getDataStoreOptions().createAdapterStore().addAdapter(new FeatureDataAdapter(ftype));
  ((ParameterEnum<PersistableStore>)StoreParam.INPUT_STORE).getHelper().setValue(configuration,scope,store);
  partitioner.initialize(Job.getInstance(configuration),scope);
  List<PartitionData> partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(4,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  for (  final PartitionData partition : partitions) {
    final MultiDimensionalNumericData ranges=partitioner.getRangesForPartition(partition);
    assertTrue(ranges.getDataPerDimension()[0].getMin() < 0.0000000001);
    assertTrue(ranges.getDataPerDimension()[0].getMax() > -0.0000000001);
    assertTrue(ranges.getDataPerDimension()[1].getMin() < 0.00000000001);
    assertTrue(ranges.getDataPerDimension()[1].getMax() > -0.0000000001);
  }
  feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(-179.99999996,0)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(4,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(179.99999996,91)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(2,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  feature=AnalyticFeature.createGeometryFeature(ftype,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",20.30203,factory.createPoint(new Coordinate(88,0)),new String[]{"String_Node_Str"},new double[]{0.022},1,1,0);
  partitions=partitioner.getCubeIdentifiers(new AdapterDataEntry(new ByteArrayId(ftype.getName().getLocalPart()),feature));
  assertEquals(4,partitions.size());
  assertTrue(hasOnePrimary(partitions));
  double maxX=0;
  double minX=0;
  double maxY=0;
  double minY=0;
  for (  final PartitionData partition : partitions) {
    final MultiDimensionalNumericData ranges=partitioner.getRangesForPartition(partition);
    maxX=Math.max(maxX,ranges.getMaxValuesPerDimension()[1]);
    maxY=Math.max(maxY,ranges.getMaxValuesPerDimension()[0]);
    minX=Math.min(minX,ranges.getMinValuesPerDimension()[1]);
    minY=Math.min(minY,ranges.getMinValuesPerDimension()[0]);
  }
  assertTrue(maxY > 88.0);
  assertTrue(minY < 88.0);
  assertTrue(maxX > 0);
  assertTrue(minX < 0);
}