Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeDegreeWithoutType() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeDegreeWithoutType()
        {
            // GIVEN
            long node;

            using (Transaction tx = Transaction())
            {
                Write write = tx.DataWrite();
                node = write.NodeCreate();
                write.RelationshipCreate(node, tx.TokenWrite().relationshipTypeGetOrCreateForName("R1"), write.NodeCreate());
                write.RelationshipCreate(node, tx.TokenWrite().relationshipTypeGetOrCreateForName("R2"), write.NodeCreate());
                write.RelationshipCreate(write.NodeCreate(), tx.TokenWrite().relationshipTypeGetOrCreateForName("R3"), node);
                write.RelationshipCreate(node, tx.TokenWrite().relationshipTypeGetOrCreateForName("R4"), node);

                tx.Success();
            }

            using (Transaction tx = Transaction())
            {
                Read          read    = tx.DataRead();
                CursorFactory cursors = tx.Cursors();
                using (NodeCursor nodes = cursors.AllocateNodeCursor())
                {
                    assertThat(CompiledExpandUtils.NodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING), equalTo(3));
                    assertThat(CompiledExpandUtils.NodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING), equalTo(2));
                    assertThat(CompiledExpandUtils.NodeGetDegreeIfDense(read, node, nodes, cursors, BOTH), equalTo(4));
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowWritesInFullMode() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowWritesInFullMode()
        {
            // Given
            KernelTransactionImplementation tx = newTransaction(AUTH_DISABLED);

            // When
            Write writes = tx.DataWrite();

            // Then
            assertNotNull(writes);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowWritesInWriteMode() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowWritesInWriteMode()
        {
            // Given
            KernelTransactionImplementation tx = newTransaction(AnonymousContext.write());

            // When
            Write writes = tx.DataWrite();

            // Then
            assertNotNull(writes);
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeDegreeWithType() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeDegreeWithType()
        {
            // GIVEN
            long node;
            int  @in, @out, loop;

            using (Transaction tx = Transaction())
            {
                Write write = tx.DataWrite();
                node = write.NodeCreate();
                TokenWrite tokenWrite = tx.TokenWrite();
                @out = tokenWrite.RelationshipTypeGetOrCreateForName("OUT");
                @in  = tokenWrite.RelationshipTypeGetOrCreateForName("IN");
                loop = tokenWrite.RelationshipTypeGetOrCreateForName("LOOP");
                write.RelationshipCreate(node, @out, write.NodeCreate());
                write.RelationshipCreate(node, @out, write.NodeCreate());
                write.RelationshipCreate(write.NodeCreate(), @in, node);
                write.RelationshipCreate(node, loop, node);

                tx.Success();
            }

            using (Transaction tx = Transaction())
            {
                Read          read    = tx.DataRead();
                CursorFactory cursors = tx.Cursors();
                using (NodeCursor nodes = cursors.AllocateNodeCursor())
                {
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, @out), equalTo(2));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, @in), equalTo(0));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, loop), equalTo(1));

                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, @out), equalTo(0));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, @in), equalTo(1));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, loop), equalTo(1));

                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, @out), equalTo(2));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, @in), equalTo(1));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, loop), equalTo(1));
                }
            }
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: abstract void removeProperty(org.neo4j.internal.kernel.api.Write writeOps, long entityId, int propertyKey) throws Exception;
            internal abstract void RemoveProperty(Write writeOps, long entityId, int propertyKey);
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: abstract void setProperty(org.neo4j.internal.kernel.api.Write writeOps, long entityId, int propertyKeyId, org.neo4j.values.storable.Value value) throws Exception;
            internal abstract void SetProperty(Write writeOps, long entityId, int propertyKeyId, Value value);
Esempio n. 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void removeProperty(org.neo4j.internal.kernel.api.Write writeOps, long entityId, int propertyKey) throws Exception
            internal override void RemoveProperty(Write writeOps, long entityId, int propertyKey)
            {
                writeOps.RelationshipRemoveProperty(entityId, propertyKey);
            }
Esempio n. 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void setProperty(org.neo4j.internal.kernel.api.Write writeOps, long entityId, int propertyKeyId, org.neo4j.values.storable.Value value) throws Exception
            internal override void SetProperty(Write writeOps, long entityId, int propertyKeyId, Value value)
            {
                writeOps.RelationshipSetProperty(entityId, propertyKeyId, value);
            }
Esempio n. 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void removeProperty(org.neo4j.internal.kernel.api.Write writeOps, long entityId, int propertyKey) throws Exception
            internal override void RemoveProperty(Write writeOps, long entityId, int propertyKey)
            {
                writeOps.NodeRemoveProperty(entityId, propertyKey);
            }