//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void replaceLabelIndexWithCopy(java.io.File labelIndexFileCopy) throws java.io.IOException
        private void ReplaceLabelIndexWithCopy(File labelIndexFileCopy)
        {
            Db.restartDatabase((fs, directory) =>
            {
                DatabaseLayout databaseLayout = Db.databaseLayout();
                fs.deleteFile(databaseLayout.labelScanStore());
                fs.copyFile(labelIndexFileCopy, databaseLayout.labelScanStore());
            });
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createAndVerifyGraphStartingWithId(long startId, int requiredHeapMb) throws Exception
        private void CreateAndVerifyGraphStartingWithId(long startId, int requiredHeapMb)
        {
            assumeTrue(MachineIsOkToRunThisTest(requiredHeapMb));

            /*
             * Will create a layout like this:
             *
             * (refNode) --> (node) --> (highNode)
             *           ...
             *           ...
             *
             * Each node/relationship will have a bunch of different properties on them.
             */
            Node refNode = CreateReferenceNode(_db);

            HighIds = startId - 1000;

            sbyte[] bytes = new sbyte[45];
            bytes[2]  = 5;
            bytes[10] = 42;
            IDictionary <string, object> properties = map("number", 11, "short string", "test", "long string", "This is a long value, long enough", "array", bytes);
            Transaction tx    = _db.beginTx();
            int         count = 10000;

            for (int i = 0; i < count; i++)
            {
                Node node = _db.createNode();
                SetProperties(node, properties);
                Relationship rel1 = refNode.CreateRelationshipTo(node, this);
                SetProperties(rel1, properties);
                Node         highNode = _db.createNode();
                Relationship rel2     = node.CreateRelationshipTo(highNode, _otherType);
                SetProperties(rel2, properties);
                SetProperties(highNode, properties);
                if (i % 100 == 0 && i > 0)
                {
                    tx.Success();
                    tx.Close();
                    tx = _db.beginTx();
                }
            }
            tx.Success();
            tx.Close();

            _db = DbRule.restartDatabase();

            // Verify the data
            int verified = 0;

            using (Transaction transaction = _db.beginTx())
            {
                refNode = _db.getNodeById(refNode.Id);
                foreach (Relationship rel in refNode.GetRelationships(Direction.OUTGOING))
                {
                    Node node = rel.EndNode;
                    AssertProperties(properties, node);
                    AssertProperties(properties, rel);
                    Node highNode = node.GetSingleRelationship(_otherType, Direction.OUTGOING).EndNode;
                    AssertProperties(properties, highNode);
                    verified++;
                }
                transaction.Success();
            }
            assertEquals(count, verified);
        }