Search in sources :

Example 6 with StandardConstraintSemantics

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);
}
Also used : TransactionState(org.neo4j.kernel.api.txstate.TransactionState) StoreReadLayer(org.neo4j.storageengine.api.StoreReadLayer) LegacyIndexStore(org.neo4j.kernel.impl.index.LegacyIndexStore) StoreStatement(org.neo4j.kernel.impl.api.store.StoreStatement) InternalAutoIndexing(org.neo4j.kernel.impl.api.legacyindex.InternalAutoIndexing) IndexReader(org.neo4j.storageengine.api.schema.IndexReader) StateHandlingStatementOperations(org.neo4j.kernel.impl.api.StateHandlingStatementOperations) ConstraintEnforcingEntityOperations(org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics) Before(org.junit.Before)

Example 7 with StandardConstraintSemantics

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);
}
Also used : StorageReader(org.neo4j.storageengine.api.StorageReader) DatabaseTracers(org.neo4j.kernel.database.DatabaseTracers) DbmsRuntimeRepository(org.neo4j.dbms.database.DbmsRuntimeRepository) StorageEngine(org.neo4j.storageengine.api.StorageEngine) TestDatabaseIdRepository(org.neo4j.kernel.database.TestDatabaseIdRepository) GlobalProcedures(org.neo4j.kernel.api.procedure.GlobalProcedures) CommandCreationContext(org.neo4j.storageengine.api.CommandCreationContext) ConstraintIndexCreator(org.neo4j.kernel.impl.api.state.ConstraintIndexCreator) SchemaState(org.neo4j.internal.schema.SchemaState) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) NoOpClient(org.neo4j.kernel.impl.locking.NoOpClient) KernelTransactionImplementation(org.neo4j.kernel.impl.api.KernelTransactionImplementation) IndexStatisticsStore(org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore) DatabaseTransactionEventListeners(org.neo4j.kernel.internal.event.DatabaseTransactionEventListeners) Pool(org.neo4j.collection.pool.Pool) Dependencies(org.neo4j.collection.Dependencies) InternalTransactionCommitProcess(org.neo4j.kernel.impl.api.InternalTransactionCommitProcess) GraphDatabaseFacade(org.neo4j.kernel.impl.factory.GraphDatabaseFacade) TransactionMonitor(org.neo4j.kernel.impl.transaction.TransactionMonitor) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)

Example 8 with StandardConstraintSemantics

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));
}
Also used : DatabaseTracers(org.neo4j.kernel.database.DatabaseTracers) DbmsRuntimeRepository(org.neo4j.dbms.database.DbmsRuntimeRepository) MemoryPools(org.neo4j.memory.MemoryPools) SchemaState(org.neo4j.internal.schema.SchemaState) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) DatabaseReadOnlyChecker(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker) IndexStatisticsStore(org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore) DatabaseTransactionEventListeners(org.neo4j.kernel.internal.event.DatabaseTransactionEventListeners) Dependencies(org.neo4j.collection.Dependencies) GraphDatabaseFacade(org.neo4j.kernel.impl.factory.GraphDatabaseFacade) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)

Aggregations

StandardConstraintSemantics (org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)8 Before (org.junit.Before)2 Dependencies (org.neo4j.collection.Dependencies)2 Config (org.neo4j.configuration.Config)2 DbmsRuntimeRepository (org.neo4j.dbms.database.DbmsRuntimeRepository)2 RecordStorageEngine (org.neo4j.internal.recordstorage.RecordStorageEngine)2 SchemaState (org.neo4j.internal.schema.SchemaState)2 DatabaseTracers (org.neo4j.kernel.database.DatabaseTracers)2 ConstraintEnforcingEntityOperations (org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations)2 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)2 IndexStatisticsStore (org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore)2 GraphDatabaseFacade (org.neo4j.kernel.impl.factory.GraphDatabaseFacade)2 DatabaseTransactionEventListeners (org.neo4j.kernel.internal.event.DatabaseTransactionEventListeners)2 NullLogProvider (org.neo4j.logging.NullLogProvider)2 JobScheduler (org.neo4j.scheduler.JobScheduler)2 IOException (java.io.IOException)1 DirectoryNotEmptyException (java.nio.file.DirectoryNotEmptyException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Stream (java.util.stream.Stream)1