}
@Test
public void testIndexOptions() {
final Index index = IndexType.SPATIAL_VECTOR.createDefaultIndex();
final WritableDataAdapter<TestGeometry> adapter = new TestGeometryAdapter();
accumuloOptions.setCreateTable(false);
accumuloOptions.setPersistIndex(false);
final List<ByteArrayId> rowIds = mockDataStore.ingest(
adapter,
index,
new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt"));
// as the table didn't already exist, the flag indicates not to create
// it, so no rows will be returned
assertEquals(
0,
rowIds.size());
accumuloOptions.setCreateTable(true);
final ByteArrayId rowId1 = mockDataStore.ingest(
adapter,
index,
new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt_1")).get(
0);
// as we have chosen not to persist the index, we will not see an index
// entry in the index store
assertEquals(
false,
indexStore.indexExists(index.getId()));
final TestGeometry geom1 = mockDataStore.getEntry(
index,
rowId1);
// even though we didn't persist the index, the test point was still
// stored
assertEquals(
"test_pt_1",
geom1.id);
accumuloOptions.setPersistIndex(true);
final ByteArrayId rowId2 = mockDataStore.ingest(
adapter,
index,
new TestGeometry(
factory.createPoint(new Coordinate(
25,
32)),
"test_pt_2")).get(
0);
// as we have chosen to persist the index, we will see the index entry
// in the index store
assertEquals(
true,
indexStore.indexExists(index.getId()));
final TestGeometry geom2 = mockDataStore.getEntry(
index,
rowId2);