Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowReadStatementAfterReadStatement()
        public virtual void ShouldAllowReadStatementAfterReadStatement()
        {
            // given
            KernelTransaction tx = kernelTransaction(AnonymousContext.read());

            tx.DataRead();

            // when / then
            tx.DataRead();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAllowSchemaWriteAccessInReadMode() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotAllowSchemaWriteAccessInReadMode()
        {
            // Given
            KernelTransactionImplementation tx = newTransaction(AnonymousContext.read());

            // Expect
            Exception.expect(typeof(AuthorizationViolationException));

            // When
            tx.SchemaWrite();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowReadsInReadMode()
        public virtual void ShouldAllowReadsInReadMode()
        {
            // Given
            KernelTransactionImplementation tx = newTransaction(AnonymousContext.read());

            // When
            Read reads = tx.DataRead();

            // Then
            assertNotNull(reads);
        }
//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)));
                }
            }
        }