//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();
            }
        }
//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();
            }
        }
Exemple #3
0
 public override Node FindNode(Label label, string key, object value)
 {
     return(_database.findNode(label, key, value));
 }