示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReuseNodeIdsFromRolledBackTransaction() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReuseNodeIdsFromRolledBackTransaction()
        {
            // Given
            GraphDatabaseService db = DbRule.GraphDatabaseAPI;

            using (Transaction tx = Db.beginTx())
            {
                Db.createNode();

                tx.Failure();
            }

            db = DbRule.restartDatabase();

            // When
            Node node;

            using (Transaction tx = Db.beginTx())
            {
                node = Db.createNode();

                tx.Success();
            }

            // Then
            assertThat(node.Id, equalTo(0L));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void createAndRetainFulltextIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateAndRetainFulltextIndex()
        {
            IndexReference fulltextIndex = CreateIndex(new int[] { 7, 8, 9 }, new int[] { 2, 3, 4 });

            Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY);

            VerifyThatFulltextIndexIsPresent(fulltextIndex);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRebuildDeletedLabelScanStoreOnStartup() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRebuildDeletedLabelScanStoreOnStartup()
        {
            // GIVEN
            Node node1 = CreateLabeledNode(Labels.First);
            Node node2 = CreateLabeledNode(Labels.First);
            Node node3 = CreateLabeledNode(Labels.First);

            DeleteNode(node2);                 // just to create a hole in the store

            // WHEN
            _dbRule.restartDatabase(DeleteTheLabelScanStoreIndex());

            // THEN
            assertEquals(asSet(node1, node3), GetAllNodesWithLabel(Labels.First));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failedIndexShouldRepairAutomatically() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FailedIndexShouldRepairAutomatically()
        {
            // given
            using (Transaction tx = Db.beginTx())
            {
                Db.schema().indexFor(_person).on("name").create();
                tx.Success();
            }
            AwaitIndexesOnline(5, SECONDS);
            CreateNamed(_person, "Johan");
            // when - we restart the database in a state where the index is not operational
            Db.restartDatabase(new SabotageNativeIndex(Random.random()));
            // then - the database should still be operational
            CreateNamed(_person, "Lars");
            AwaitIndexesOnline(5, SECONDS);
            IndexStateShouldBe(equalTo(ONLINE));
            AssertFindsNamed(_person, "Lars");
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void applySetting(org.neo4j.graphdb.config.Setting<String> setting, String value) throws java.io.IOException
        internal virtual void ApplySetting(Setting <string> setting, string value)
        {
            Db.restartDatabase(setting.Name(), value);
            Db.ensureStarted();
            FulltextAdapter = Accessor;
        }