use of org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations in project neo4j by neo4j.
the class NeoStoreDataSource method buildStatementOperations.
private StatementOperationContainer buildStatementOperations(StoreReadLayer storeReadLayer, AutoIndexing autoIndexing, ConstraintIndexCreator constraintIndexCreator, UpdateableSchemaState updateableSchemaState, Guard guard, LegacyIndexStore legacyIndexStore) {
// The passed in StoreReadLayer is the bottom most layer: Read-access to committed data.
// To it we add:
// + Transaction state handling
StateHandlingStatementOperations stateHandlingContext = new StateHandlingStatementOperations(storeReadLayer, autoIndexing, constraintIndexCreator, legacyIndexStore);
QueryRegistrationOperations queryRegistrationOperations = new StackingQueryRegistrationOperations(clock);
StatementOperationParts parts = new StatementOperationParts(stateHandlingContext, stateHandlingContext, stateHandlingContext, stateHandlingContext, stateHandlingContext, stateHandlingContext, new SchemaStateConcern(updateableSchemaState), null, stateHandlingContext, stateHandlingContext, stateHandlingContext, queryRegistrationOperations);
// + Constraints
ConstraintEnforcingEntityOperations constraintEnforcingEntityOperations = new ConstraintEnforcingEntityOperations(constraintSemantics, parts.entityWriteOperations(), parts.entityReadOperations(), parts.schemaWriteOperations(), parts.schemaReadOperations());
// + Data integrity
DataIntegrityValidatingStatementOperations dataIntegrityContext = new DataIntegrityValidatingStatementOperations(parts.keyWriteOperations(), parts.schemaReadOperations(), constraintEnforcingEntityOperations);
parts = parts.override(null, dataIntegrityContext, constraintEnforcingEntityOperations, constraintEnforcingEntityOperations, null, dataIntegrityContext, null, null, null, null, null, null);
// + Locking
LockingStatementOperations lockingContext = new LockingStatementOperations(parts.entityReadOperations(), parts.entityWriteOperations(), parts.schemaReadOperations(), parts.schemaWriteOperations(), parts.schemaStateOperations());
parts = parts.override(null, null, null, lockingContext, lockingContext, lockingContext, lockingContext, lockingContext, null, null, null, null);
// + Guard
GuardingStatementOperations guardingOperations = new GuardingStatementOperations(parts.entityWriteOperations(), parts.entityReadOperations(), guard);
StatementOperationParts guardedParts = parts.override(null, null, guardingOperations, guardingOperations, null, null, null, null, null, null, null, null);
return new StatementOperationContainer(guardedParts, parts);
}
use of org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations in project neo4j by neo4j.
the class ConstraintEnforcingEntityOperationsTest method given_ConstraintEnforcingEntityOperations_with_OnlineIndex.
@Before
public void given_ConstraintEnforcingEntityOperations_with_OnlineIndex() throws Exception {
this.readOps = mock(EntityReadOperations.class);
SchemaReadOperations schemaReadOps = mock(SchemaReadOperations.class);
SchemaWriteOperations schemaWriteOps = mock(SchemaWriteOperations.class);
this.state = mock(KernelStatement.class);
when(schemaReadOps.indexGetState(state, index)).thenReturn(InternalIndexState.ONLINE);
this.locks = mock(Locks.Client.class);
when(state.locks()).thenReturn(new SimpleStatementLocks(locks));
when(state.lockTracer()).thenReturn(LockTracer.NONE);
this.ops = new ConstraintEnforcingEntityOperations(new StandardConstraintSemantics(), null, readOps, schemaWriteOps, schemaReadOps);
}
use of org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations in project neo4j by neo4j.
the class IndexQueryTransactionStateTest method before.
@Before
public void before() throws Exception {
TransactionState txState = new TxState();
state = StatementOperationsTestHelper.mockedState(txState);
store = mock(StoreReadLayer.class);
when(store.indexGetState(newIndexDescriptor)).thenReturn(InternalIndexState.ONLINE);
when(store.indexesGetForLabel(labelId)).then(answerAsIteratorFrom(indexes));
when(store.indexesGetAll()).then(answerAsIteratorFrom(indexes));
when(store.constraintsGetForLabel(labelId)).thenReturn(Collections.emptyIterator());
when(store.indexGetForLabelAndPropertyKey(newIndexDescriptor.schema())).thenReturn(newIndexDescriptor);
statement = mock(StoreStatement.class);
when(state.getStoreStatement()).thenReturn(statement);
indexReader = mock(IndexReader.class);
when(statement.getIndexReader(newIndexDescriptor)).thenReturn(indexReader);
when(statement.getFreshIndexReader(newIndexDescriptor)).thenReturn(indexReader);
StateHandlingStatementOperations stateHandlingOperations = new StateHandlingStatementOperations(store, new InternalAutoIndexing(Config.empty(), null), mock(ConstraintIndexCreator.class), mock(LegacyIndexStore.class));
txContext = new ConstraintEnforcingEntityOperations(new StandardConstraintSemantics(), stateHandlingOperations, stateHandlingOperations, stateHandlingOperations, stateHandlingOperations);
}
Aggregations