use of org.neo4j.kernel.api.SchemaWriteOperations in project neo4j by neo4j.
the class IndexIT method shouldNotListIndexesAmongConstraintIndexes.
@Test
public void shouldNotListIndexesAmongConstraintIndexes() throws Exception {
// given
SchemaWriteOperations schemaWriteOperations = schemaWriteOperationsInNewTransaction();
schemaWriteOperations.indexCreate(SchemaBoundary.map(descriptor));
commit();
// then/when
ReadOperations readOperations = readOperationsInNewTransaction();
assertFalse(readOperations.uniqueIndexesGetAll().hasNext());
assertFalse(readOperations.uniqueIndexesGetForLabel(labelId).hasNext());
}
use of org.neo4j.kernel.api.SchemaWriteOperations in project neo4j by neo4j.
the class IndexIT method shouldDisallowDroppingIndexThatDoesNotExist.
@Test
public void shouldDisallowDroppingIndexThatDoesNotExist() throws Exception {
// given
NewIndexDescriptor index;
{
SchemaWriteOperations statement = schemaWriteOperationsInNewTransaction();
index = statement.indexCreate(SchemaBoundary.map(descriptor));
commit();
}
{
SchemaWriteOperations statement = schemaWriteOperationsInNewTransaction();
statement.indexDrop(index);
commit();
}
// when
try {
SchemaWriteOperations statement = schemaWriteOperationsInNewTransaction();
statement.indexDrop(index);
commit();
}// then
catch (SchemaKernelException e) {
assertEquals("Unable to drop index on :label[" + labelId + "](property[" + propertyKeyId + "]): " + "No such INDEX ON :label[" + labelId + "](property[" + propertyKeyId + "]).", e.getMessage());
}
}
use of org.neo4j.kernel.api.SchemaWriteOperations in project neo4j by neo4j.
the class IndexIT method rollBackIndexRuleShouldNotBeCommitted.
@Test
public void rollBackIndexRuleShouldNotBeCommitted() throws Exception {
// GIVEN
SchemaWriteOperations schemaWriteOperations = schemaWriteOperationsInNewTransaction();
// WHEN
schemaWriteOperations.indexCreate(SchemaBoundary.map(descriptor));
// don't mark as success
rollback();
// THEN
ReadOperations readOperations = readOperationsInNewTransaction();
assertEquals(emptySetOf(NewIndexDescriptor.class), asSet(readOperations.indexesGetForLabel(labelId)));
commit();
}
use of org.neo4j.kernel.api.SchemaWriteOperations in project neo4j by neo4j.
the class IndexIT method committedAndTransactionalIndexRulesShouldBeMerged.
@Test
public void committedAndTransactionalIndexRulesShouldBeMerged() throws Exception {
// GIVEN
SchemaWriteOperations schemaWriteOperations = schemaWriteOperationsInNewTransaction();
NewIndexDescriptor existingRule = schemaWriteOperations.indexCreate(SchemaBoundary.map(descriptor));
commit();
// WHEN
Statement statement = statementInNewTransaction(AnonymousContext.AUTH_DISABLED);
NewIndexDescriptor addedRule = statement.schemaWriteOperations().indexCreate(SchemaDescriptorFactory.forLabel(labelId, 10));
Set<NewIndexDescriptor> indexRulesInTx = asSet(statement.readOperations().indexesGetForLabel(labelId));
commit();
// THEN
assertEquals(asSet(existingRule, addedRule), indexRulesInTx);
}
use of org.neo4j.kernel.api.SchemaWriteOperations in project neo4j by neo4j.
the class AbstractConstraintCreationIT method shouldClearSchemaStateWhenConstraintIsCreated.
@Test
public void shouldClearSchemaStateWhenConstraintIsCreated() throws Exception {
// given
SchemaStateCheck schemaState = new SchemaStateCheck().setUp();
SchemaWriteOperations statement = schemaWriteOperationsInNewTransaction();
// when
createConstraint(statement, descriptor);
commit();
// then
schemaState.assertCleared(readOperationsInNewTransaction());
rollback();
}
Aggregations