*/
@Test
public void testLoadIndex() {
Map<String, String> config = SpatialIndexProvider.SIMPLE_POINT_CONFIG;
try (Transaction tx = db.beginTx()) {
IndexManager indexMan = db.index();
Index<Node> index;
index = indexMan.forNodes("layer1", config);
assertNotNull(index);
//Load the an existing index again
index = indexMan.forNodes("layer1", config);
assertNotNull(index);
//Try a different config
Map<String, String> config2 = SpatialIndexProvider.SIMPLE_WKT_CONFIG;
index = indexMan.forNodes("layer2", config2);
assertNotNull(index);
//Load the index again
index = indexMan.forNodes("layer2", config2);
assertNotNull(index);
//Try loading the same index with a different config
boolean exceptionThrown = false;
try {
index = indexMan.forNodes("layer2", config);
} catch (IllegalArgumentException iae) {
exceptionThrown = true;
}
assertTrue(exceptionThrown);
config = SpatialIndexProvider.SIMPLE_WKT_CONFIG;
index = indexMan.forNodes("layer2", config);
assertNotNull(index);
config = SpatialIndexProvider.SIMPLE_WKB_CONFIG;
index = indexMan.forNodes("layer3", config);
assertNotNull(index);
tx.success();
}
}