예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void recoveryForRelationshipCommandsOnly() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RecoveryForRelationshipCommandsOnly()
        {
            // shutdown db here
            DatabaseLayout databaseLayout = Db.databaseLayout();

            ShutdownDB();

            using (Transaction tx = Db.beginTx())
            {
                Index <Relationship> index = Db.index().forRelationships("myIndex");
                Node         node          = Db.createNode();
                Relationship relationship  = Db.createNode().createRelationshipTo(node, RelationshipType.withName("KNOWS"));

                index.Add(relationship, "key", "value");
                tx.Success();
            }

            Db.shutdown();

            Config           config     = Config.defaults();
            IndexConfigStore indexStore = new IndexConfigStore(databaseLayout, FileSystemRule.get());
            LuceneDataSource ds         = new LuceneDataSource(databaseLayout, config, indexStore, FileSystemRule.get(), OperationalMode.single);

            ds.Start();
            ds.Stop();
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleMultipleIdSpaces() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldHandleMultipleIdSpaces()
        {
            // GIVEN
            string           indexName      = "name";
            string           key            = "key";
            DatabaseLayout   databaseLayout = _testDirectory.databaseLayout();
            IndexConfigStore configStore    = new IndexConfigStore(databaseLayout, _fs);

            configStore.Set(typeof(Node), indexName, EXACT_CONFIG);
            using (Lifespan lifespan = new Lifespan())
            {
                Config           dataSourceConfig   = Config.defaults(LuceneDataSource.Configuration.Ephemeral, Settings.TRUE);
                LuceneDataSource originalDataSource = new LuceneDataSource(databaseLayout, dataSourceConfig, configStore, _fs, OperationalMode.single);
                LuceneDataSource dataSource         = lifespan.Add(spy(originalDataSource));

                using (LuceneCommandApplier applier = new LuceneCommandApplier(dataSource, false))
                {
                    // WHEN issuing a command where the index name is mapped to a certain id
                    IndexDefineCommand definitions = definitions(ObjectIntHashMap.newWithKeysValues(indexName, 0), ObjectIntHashMap.newWithKeysValues(key, 0));
                    applier.VisitIndexDefineCommand(definitions);
                    applier.VisitIndexAddNodeCommand(AddNodeToIndex(definitions, indexName, 0L));
                    // and then later issuing a command for that same index, but in another transaction where
                    // the local index name id is a different one
                    definitions = definitions(ObjectIntHashMap.newWithKeysValues(indexName, 1), ObjectIntHashMap.newWithKeysValues(key, 0));
                    applier.VisitIndexDefineCommand(definitions);
                    applier.VisitIndexAddNodeCommand(AddNodeToIndex(definitions, indexName, 1L));
                }

                // THEN both those updates should have been directed to the same index
                verify(dataSource, times(1)).getIndexSearcher(any(typeof(IndexIdentifier)));
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void setupIndexInfrastructure() throws Exception
        private void SetupIndexInfrastructure()
        {
            DatabaseLayout databaseLayout = _testDirectory.databaseLayout();

            _indexStore = new IndexConfigStore(databaseLayout, _fileSystemRule.get());
            _indexStore.set(typeof(Node), INDEX_NAME, MapUtil.stringMap(Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER, "lucene", "type", "fulltext"));
            LuceneDataSource luceneDataSource = new LuceneDataSource(databaseLayout, Config.defaults(), _indexStore, _fileSystemRule.get(), OperationalMode.single);

            try
            {
                luceneDataSource.Init();
                luceneDataSource.GetIndexSearcher(_indexIdentifier);
            }
            finally
            {
                luceneDataSource.Shutdown();
            }
        }
예제 #4
0
        private RecordStorageEngine Get(FileSystemAbstraction fs, PageCache pageCache, IndexProvider indexProvider, DatabaseHealth databaseHealth, DatabaseLayout databaseLayout, System.Func <BatchTransactionApplierFacade, BatchTransactionApplierFacade> transactionApplierTransformer, Monitors monitors, LockService lockService)
        {
            IdGeneratorFactory    idGeneratorFactory          = new EphemeralIdGenerator.Factory();
            ExplicitIndexProvider explicitIndexProviderLookup = mock(typeof(ExplicitIndexProvider));

            when(explicitIndexProviderLookup.AllIndexProviders()).thenReturn(Iterables.empty());
            IndexConfigStore indexConfigStore = new IndexConfigStore(databaseLayout, fs);
            JobScheduler     scheduler        = _life.add(createScheduler());
            Config           config           = Config.defaults(GraphDatabaseSettings.default_schema_provider, indexProvider.ProviderDescriptor.name());

            Dependencies dependencies = new Dependencies();

            dependencies.SatisfyDependency(indexProvider);

            BufferingIdGeneratorFactory bufferingIdGeneratorFactory = new BufferingIdGeneratorFactory(idGeneratorFactory, Org.Neo4j.Kernel.impl.store.id.IdReuseEligibility_Fields.Always, new CommunityIdTypeConfigurationProvider());
            DefaultIndexProviderMap     indexProviderMap            = new DefaultIndexProviderMap(dependencies, config);
            NullLogProvider             nullLogProvider             = NullLogProvider.Instance;

            _life.add(indexProviderMap);
            return(_life.add(new ExtendedRecordStorageEngine(databaseLayout, config, pageCache, fs, nullLogProvider, nullLogProvider, mockedTokenHolders(), mock(typeof(SchemaState)), new StandardConstraintSemantics(), scheduler, mock(typeof(TokenNameLookup)), lockService, indexProviderMap, IndexingService.NO_MONITOR, databaseHealth, explicitIndexProviderLookup, indexConfigStore, new SynchronizedArrayIdOrderingQueue(), idGeneratorFactory, new BufferedIdController(bufferingIdGeneratorFactory, scheduler), transactionApplierTransformer, monitors, RecoveryCleanupWorkCollector.immediate(), OperationalMode.single)));
        }
예제 #5
0
 internal ExtendedRecordStorageEngine(DatabaseLayout databaseLayout, Config config, PageCache pageCache, FileSystemAbstraction fs, LogProvider logProvider, LogProvider userLogProvider, TokenHolders tokenHolders, SchemaState schemaState, ConstraintSemantics constraintSemantics, JobScheduler scheduler, TokenNameLookup tokenNameLookup, LockService lockService, IndexProviderMap indexProviderMap, IndexingService.Monitor indexingServiceMonitor, DatabaseHealth databaseHealth, ExplicitIndexProvider explicitIndexProviderLookup, IndexConfigStore indexConfigStore, IdOrderingQueue explicitIndexTransactionOrdering, IdGeneratorFactory idGeneratorFactory, IdController idController, System.Func <BatchTransactionApplierFacade, BatchTransactionApplierFacade> transactionApplierTransformer, Monitors monitors, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, OperationalMode operationalMode) : base(databaseLayout, config, pageCache, fs, logProvider, userLogProvider, tokenHolders, schemaState, constraintSemantics, scheduler, tokenNameLookup, lockService, indexProviderMap, indexingServiceMonitor, databaseHealth, explicitIndexProviderLookup, indexConfigStore, explicitIndexTransactionOrdering, idGeneratorFactory, idController, monitors, recoveryCleanupWorkCollector, operationalMode, EmptyVersionContextSupplier.EMPTY)
 {
     this.TransactionApplierTransformer = transactionApplierTransformer;
 }
 public ExplicitIndexTransactionStateProvider(IndexConfigStore indexConfigStore, ExplicitIndexProvider explicitIndexProviderLookup)
 {
     this._indexConfigStore            = indexConfigStore;
     this._explicitIndexProviderLookup = explicitIndexProviderLookup;
 }
예제 #7
0
 private void SetupIndexInfrastructure()
 {
     _indexStore = new IndexConfigStore(_testDirectory.databaseLayout(), _fileSystemRule.get());
     _indexStore.set(typeof(Node), INDEX_NAME, MapUtil.stringMap(Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER, "lucene", "type", "fulltext"));
 }