//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void lookupWithinTransaction()
        public virtual void LookupWithinTransaction()
        {
            using (Transaction tx = Db.beginTx())
            {
                // when
                Db.createNode(label("Node")).setProperty("prop", _store);

                // then
                assertEquals(1, count(Db.findNodes(label("Node"), "prop", _lookup)));

                // no need to actually commit this node
            }
        }
 private void VerifyFoundNodes(Label label, string sizeMismatchMessage, params long[] expectedNodeIds)
 {
     using (Transaction ignored = DbRule.beginTx())
     {
         ResourceIterator <Node> nodes    = DbRule.findNodes(label);
         IList <Node>            nodeList = Iterators.asList(nodes);
         assertThat(sizeMismatchMessage, nodeList, Matchers.hasSize(expectedNodeIds.Length));
         int index = 0;
         foreach (Node node in nodeList)
         {
             assertEquals(expectedNodeIds[index++], node.Id);
         }
     }
 }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void relationshipIdReusableOnlyAfterTransactionFinish()
        public virtual void RelationshipIdReusableOnlyAfterTransactionFinish()
        {
            Label testLabel      = Label.label("testLabel");
            long  relationshipId = CreateRelationship(testLabel);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.storageengine.impl.recordstorage.id.IdController idMaintenanceController = getIdMaintenanceController();
            IdController idMaintenanceController = IdMaintenanceController;

            using (Transaction transaction = DbRule.beginTx(), ResourceIterator <Node> nodes = DbRule.findNodes(testLabel))
            {
                IList <Node> nodeList = Iterators.asList(nodes);
                foreach (Node node in nodeList)
                {
                    IEnumerable <Relationship> relationships = node.GetRelationships(TestRelationshipType.Marker);
                    foreach (Relationship relationship in relationships)
                    {
                        relationship.Delete();
                    }
                }

                idMaintenanceController.Maintenance();

                Node node1 = DbRule.createNode(testLabel);
                Node node2 = DbRule.createNode(testLabel);

                Relationship relationshipTo = node1.CreateRelationshipTo(node2, TestRelationshipType.Marker);

                assertNotEquals("Relationships should have different ids.", relationshipId, relationshipTo.Id);
                transaction.Success();
            }
        }