コード例 #1
0
        private static Instances KernelTransactionWithInternals(LoginContext loginContext)
        {
            TransactionHeaderInformation        headerInformation        = new TransactionHeaderInformation(-1, -1, new sbyte[0]);
            TransactionHeaderInformationFactory headerInformationFactory = mock(typeof(TransactionHeaderInformationFactory));

            when(headerInformationFactory.Create()).thenReturn(headerInformation);

            StorageEngine storageEngine = mock(typeof(StorageEngine));
            StorageReader storageReader = mock(typeof(StorageReader));

            when(storageEngine.NewReader()).thenReturn(storageReader);

            KernelTransactionImplementation transaction = new KernelTransactionImplementation(Config.defaults(), mock(typeof(StatementOperationParts)), mock(typeof(SchemaWriteGuard)), new TransactionHooks(), mock(typeof(ConstraintIndexCreator)), new Procedures(), headerInformationFactory, mock(typeof(TransactionRepresentationCommitProcess)), mock(typeof(TransactionMonitor)), mock(typeof(AuxiliaryTransactionStateManager)), mock(typeof(Pool)), Clocks.nanoClock(), new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE), NULL, LockTracer.NONE, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, storageEngine, new CanWrite(), AutoIndexing.UNSUPPORTED, mock(typeof(ExplicitIndexStore)), EmptyVersionContextSupplier.EMPTY, ON_HEAP, new StandardConstraintSemantics(), mock(typeof(SchemaState)), mock(typeof(IndexingService)), mockedTokenHolders(), new Dependencies());

            StatementLocks statementLocks = new SimpleStatementLocks(new NoOpClient());

            transaction.Initialize(0, 0, statementLocks, KernelTransaction.Type.@implicit, loginContext.Authorize(s => - 1, GraphDatabaseSettings.DEFAULT_DATABASE_NAME), 0L, 1L);

            return(new Instances(transaction));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _dataSource = mock(typeof(NeoStoreDataSource));
            StorageEngine storageEngine = mock(typeof(StorageEngine));
            StorageReader storageReader = mock(typeof(StorageReader));

            when(storageEngine.NewReader()).thenReturn(storageReader);
            _indexingService = mock(typeof(IndexingService));
            TokenHolders tokenHolders = MockedTokenHolders();

            when(tokenHolders.LabelTokens().getIdByName(EXISTING_LABEL)).thenReturn(LABEL_ID);
            when(tokenHolders.PropertyKeyTokens().getIdByName(EXISTING_PROPERTY)).thenReturn(PROPERTY_ID);
            when(tokenHolders.PropertyKeyTokens().getIdByName(NON_EXISTING_PROPERTY)).thenReturn(-1);
            when(tokenHolders.LabelTokens().getIdByName(NON_EXISTING_LABEL)).thenReturn(NO_TOKEN);
            DependencyResolver resolver = mock(typeof(DependencyResolver));

            when(resolver.ResolveDependency(typeof(IndexingService))).thenReturn(_indexingService);
            when(resolver.ResolveDependency(typeof(StorageEngine))).thenReturn(storageEngine);
            when(resolver.ResolveDependency(typeof(TokenHolders))).thenReturn(tokenHolders);
            when(_dataSource.DependencyResolver).thenReturn(resolver);
        }