use of org.neo4j.kernel.api.impl.index.storage.layout.IndexFolderLayout in project neo4j by neo4j.
the class ConstraintCreationIT method shouldNotLeaveLuceneIndexFilesHangingAroundIfConstraintCreationFails.
@Test
public void shouldNotLeaveLuceneIndexFilesHangingAroundIfConstraintCreationFails() {
// given
GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI();
try (Transaction tx = db.beginTx()) {
for (int i = 0; i < 2; i++) {
Node node1 = db.createNode(LABEL);
node1.setProperty("prop", true);
}
tx.success();
}
// when
try (Transaction tx = db.beginTx()) {
db.schema().constraintFor(LABEL).assertPropertyIsUnique("prop").create();
fail("Should have failed with ConstraintViolationException");
tx.success();
} catch (ConstraintViolationException ignored) {
}
// then
try (Transaction ignore = db.beginTx()) {
assertEquals(0, Iterables.count(db.schema().getIndexes()));
}
SchemaIndexProvider schemaIndexProvider = db.getDependencyResolver().resolveDependency(SchemaIndexProvider.class);
File schemaStoreDir = schemaIndexProvider.getSchemaIndexStoreDirectory(new File(db.getStoreDir()));
assertFalse(new IndexFolderLayout(schemaStoreDir, INDEX_IDENTIFIER).getIndexFolder().exists());
}
use of org.neo4j.kernel.api.impl.index.storage.layout.IndexFolderLayout in project neo4j by neo4j.
the class FailureStorageTest method before.
@Before
public void before() {
File rootDirectory = new File("dir");
fs.get().mkdirs(rootDirectory);
indexFolderLayout = new IndexFolderLayout(rootDirectory, indexIdentifier);
}
Aggregations