Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void assertOnIndexCounts(int expectedIndexUpdates, int expectedIndexSize, int expectedUniqueValues, int expectedSampleSize, org.neo4j.storageengine.api.schema.IndexDescriptor indexDescriptor, HighlyAvailableGraphDatabase db) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
        private static void AssertOnIndexCounts(int expectedIndexUpdates, int expectedIndexSize, int expectedUniqueValues, int expectedSampleSize, IndexDescriptor indexDescriptor, HighlyAvailableGraphDatabase db)
        {
            using ([email protected] tx = Db.DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED))
            {
                IndexReference indexReference = tx.SchemaRead().index(indexDescriptor.Schema());
                AssertDoubleLongEquals(expectedIndexUpdates, expectedIndexSize, tx.SchemaRead().indexUpdatesAndSize(indexReference, newDoubleLongRegister()));
                AssertDoubleLongEquals(expectedUniqueValues, expectedSampleSize, tx.SchemaRead().indexSample(indexReference, newDoubleLongRegister()));
            }
        }
Exemplo n.º 2
0
        private IndexReference IndexId([email protected] tx)
        {
            int labelId       = tx.TokenRead().nodeLabel(_label.name());
            int propertyKeyId = tx.TokenRead().propertyKey(_property);

            return(tx.SchemaRead().index(labelId, propertyKeyId));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyThatThereAreExactlyOneIndexEntryPerNodeInTheIndexes(int i, org.neo4j.helpers.collection.Pair<long[],long[]> data) throws Exception
        private void VerifyThatThereAreExactlyOneIndexEntryPerNodeInTheIndexes(int i, Pair <long[], long[]> data)
        {
            Kernel kernel = Db.DependencyResolver.resolveDependency(typeof(Kernel));

            using ([email protected] tx = kernel.BeginTransaction(@implicit, AnonymousContext.read()))
            {
                int            labelAId = tx.TokenRead().nodeLabel(LabelA(i).name());
                int            keyAId   = tx.TokenRead().propertyKey(KeyA(i));
                int            labelBId = tx.TokenRead().nodeLabel(LabelB(i).name());
                int            keyBId   = tx.TokenRead().propertyKey(KeyB(i));
                IndexReference indexA   = TestIndexDescriptorFactory.forLabel(labelAId, keyAId);
                IndexReference indexB   = TestIndexDescriptorFactory.forLabel(labelBId, keyBId);

                for (int j = 0; j < NODES_PER_INDEX; j++)
                {
                    long nodeAId = data.First()[j];
                    assertEquals(1, tx.SchemaRead().nodesCountIndexed(indexA, nodeAId, keyAId, Values.of(nodeAId)));
                    long nodeBId = data.Other()[j];
                    assertEquals(1, tx.SchemaRead().nodesCountIndexed(indexB, nodeBId, keyBId, Values.of(nodeBId)));
                }
            }
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.register.Register_DoubleLongRegister fetchIndexSizeValues(org.neo4j.graphdb.GraphDatabaseService db) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException, org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        private Register_DoubleLongRegister FetchIndexSizeValues(GraphDatabaseService db)
        {
            try
            {
                // Then
                db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(TestDirectory.storeDir());
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("deprecation") org.neo4j.kernel.internal.GraphDatabaseAPI api = (org.neo4j.kernel.internal.GraphDatabaseAPI) db;
                GraphDatabaseAPI api = ( GraphDatabaseAPI )db;
                using ([email protected] tx = api.DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED))
                {
                    return(tx.SchemaRead().indexUpdatesAndSize(IndexId(tx), Registers.newDoubleLongRegister()));
                }
            }
            finally
            {
                if (db != null)
                {
                    Db.shutdown();
                }
            }
        }