public void testAlternateIndexOption() {
final Index index = IndexType.SPATIAL_VECTOR.createDefaultIndex();
final WritableDataAdapter<TestGeometry> adapter = new TestGeometryAdapter();
final ByteArrayId adapterId = adapter.getAdapterId();
accumuloOptions.setUseAltIndex(false);
final ByteArrayId rowId0 = mockDataStore.ingest(
adapter,
index,
new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt_0")).get(
0);
TestGeometry geom0 = mockDataStore.getEntry(
index,
new ByteArrayId(
"test_pt_0"),
adapterId);
// this should return our data correctly
assertEquals(
"test_pt_0",
geom0.id);
// delete entry by data id & adapter id
mockDataStore.deleteEntry(
index,
new ByteArrayId(
"test_pt_0"),
adapterId);
geom0 = mockDataStore.getEntry(
index,
new ByteArrayId(
"test_pt_0"),
adapterId);
// this should return null as the entry was deleted
assertEquals(
null,
geom0);
accumuloOptions.setUseAltIndex(true);
accumuloOperations.deleteAll();
mockDataStore.ingest(
adapter,
index,
new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt_1")).get(
0);
final TestGeometry geom1 = mockDataStore.getEntry(
index,
new ByteArrayId(
"test_pt_1"),
adapterId);
// this should return our data correctly
assertEquals(
"test_pt_1",
geom1.id);
final ArrayList<TestGeometry> geomList = new ArrayList<TestGeometry>();
geomList.add(new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt_2"));
mockDataStore.ingest(
adapter,
index,
geomList.iterator());
final TestGeometry geom2 = mockDataStore.getEntry(
index,
new ByteArrayId(
"test_pt_2"),
adapterId);
// this should return our data correctly
assertEquals(
"test_pt_2",
geom2.id);
final AccumuloIndexWriter indexWriter = new AccumuloIndexWriter(
index,
accumuloOperations,
accumuloOptions,
mockDataStore);
indexWriter.write(
adapter,
new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt_3"));
indexWriter.close();
final TestGeometry geom3 = mockDataStore.getEntry(
index,
new ByteArrayId(
"test_pt_3"),
adapterId);
// this should return our data correctly
assertEquals(