コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRecoverTransactionWhereManyLabelsAreRemovedInTheFuture() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRecoverTransactionWhereManyLabelsAreRemovedInTheFuture()
        {
            // GIVEN
            CreateIndex(_label, "key");
            Label[] labels = new Label[16];
            for (int i = 0; i < labels.Length; i++)
            {
                labels[i] = label("Label" + i.ToString("x"));
            }
            Node node;

            using (Transaction tx = _db.beginTx())
            {
                node = _db.createNode(labels);
                node.AddLabel(_label);
                tx.Success();
            }
            CheckPoint();
            SetProperty(node, "key", "value");
            RemoveLabels(node, labels);
            _flush.flush(_db);

            // WHEN
            CrashAndRestart();

            // THEN
            // -- really the problem was that recovery threw exception, so mostly assert that.
            using (Transaction tx = _db.beginTx())
            {
                assertEquals(node, _db.findNode(_label, "key", "value"));
                tx.Success();
            }
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRecoverWhenCommandsTemporarilyViolateConstraints() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRecoverWhenCommandsTemporarilyViolateConstraints()
        {
            // GIVEN
            Node unLabeledNode = CreateUnLabeledNodeWithProperty();
            Node labeledNode   = CreateLabeledNode();

            CreateUniqueConstraint();
            RotateLogAndCheckPoint();               // snapshot
            PropertyOnLabeledNode = labeledNode;
            DeletePropertyOnLabeledNode(labeledNode);
            AddLabelToUnLabeledNode(unLabeledNode);
            FlushAll();               // persist - recovery will do everything since last log rotate

            // WHEN recovery is triggered
            Restart(Snapshot(StoreDir.absolutePath()));

            // THEN
            // it should just not blow up!
            using (Transaction tx = _db.beginTx())
            {
                assertThat(_db.findNode(_label, PROPERTY_KEY, PROPERTY_VALUE), equalTo(unLabeledNode));
                tx.Success();
            }
        }
コード例 #3
0
ファイル: DatabaseRule.cs プロジェクト: Neo4Net/Neo4Net
 public override Node FindNode(Label label, string key, object value)
 {
     return(_database.findNode(label, key, value));
 }