use of org.neo4j.kernel.impl.constraints.StandardConstraintSemantics 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);
}
use of org.neo4j.kernel.impl.constraints.StandardConstraintSemantics in project neo4j by neo4j.
the class KernelTransactionFactory method kernelTransactionWithInternals.
private static Instances kernelTransactionWithInternals(LoginContext loginContext) {
StorageEngine storageEngine = mock(StorageEngine.class);
StorageReader storageReader = mock(StorageReader.class);
when(storageEngine.newReader()).thenReturn(storageReader);
when(storageEngine.newCommandCreationContext(any())).thenReturn(mock(CommandCreationContext.class));
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(mock(GraphDatabaseFacade.class));
KernelTransactionImplementation transaction = new KernelTransactionImplementation(Config.defaults(), mock(DatabaseTransactionEventListeners.class), mock(ConstraintIndexCreator.class), mock(GlobalProcedures.class), mock(InternalTransactionCommitProcess.class), mock(TransactionMonitor.class), mock(Pool.class), Clocks.nanoClock(), new AtomicReference<>(CpuClock.NOT_AVAILABLE), mock(DatabaseTracers.class, RETURNS_MOCKS), storageEngine, any -> CanWrite.INSTANCE, EmptyVersionContextSupplier.EMPTY, ON_HEAP, new StandardConstraintSemantics(), mock(SchemaState.class), mockedTokenHolders(), mock(IndexingService.class), mock(IndexStatisticsStore.class), dependencies, new TestDatabaseIdRepository().defaultDatabase(), LeaseService.NO_LEASES, MemoryPools.NO_TRACKING, DatabaseReadOnlyChecker.writable(), TransactionExecutionMonitor.NO_OP, CommunitySecurityLog.NULL_LOG, () -> KernelVersion.LATEST, mock(DbmsRuntimeRepository.class));
transaction.initialize(0, 0, new NoOpClient(), KernelTransaction.Type.IMPLICIT, loginContext.authorize(LoginContext.IdLookup.EMPTY, DEFAULT_DATABASE_NAME, CommunitySecurityLog.NULL_LOG), 0L, 1L, EMBEDDED_CONNECTION);
return new Instances(transaction);
}
use of org.neo4j.kernel.impl.constraints.StandardConstraintSemantics in project neo4j by neo4j.
the class KernelTransactionTestBase method newNotInitializedTransaction.
KernelTransactionImplementation newNotInitializedTransaction(LeaseService leaseService, Config config, NamedDatabaseId databaseId) {
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(mock(GraphDatabaseFacade.class));
var memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, ByteUnit.mebiBytes(4), null);
return new KernelTransactionImplementation(config, mock(DatabaseTransactionEventListeners.class), null, null, commitProcess, transactionMonitor, txPool, clock, new AtomicReference<>(CpuClock.NOT_AVAILABLE), mock(DatabaseTracers.class, RETURNS_MOCKS), storageEngine, any -> CanWrite.INSTANCE, EmptyVersionContextSupplier.EMPTY, () -> collectionsFactory, new StandardConstraintSemantics(), mock(SchemaState.class), mockedTokenHolders(), mock(IndexingService.class), mock(IndexStatisticsStore.class), dependencies, databaseId, leaseService, memoryPool, new DatabaseReadOnlyChecker.Default(new DbmsReadOnlyChecker.Default(config), databaseId.name()), TransactionExecutionMonitor.NO_OP, CommunitySecurityLog.NULL_LOG, () -> KernelVersion.LATEST, mock(DbmsRuntimeRepository.class));
}
Aggregations