コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetEmptyUsernameForAnonymousContext()
        public virtual void ShouldGetEmptyUsernameForAnonymousContext()
        {
            when(_transaction.securityContext()).thenReturn(AnonymousContext.read().authorize(s => - 1, GraphDatabaseSettings.DEFAULT_DATABASE_NAME));

            TxStateTransactionDataSnapshot transactionDataSnapshot = Snapshot();

            assertEquals("", transactionDataSnapshot.Username());
        }
コード例 #2
0
 internal NodePropertyEntryView(TxStateTransactionDataSnapshot outerInstance, long nodeId, string key, Value newValue, Value oldValue)
 {
     this._outerInstance = outerInstance;
     this.NodeId         = nodeId;
     this.KeyConflict    = key;
     this.NewValue       = newValue;
     this.OldValue       = oldValue;
 }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAccessUsernameFromAuthSubject()
        public virtual void ShouldAccessUsernameFromAuthSubject()
        {
            AuthSubject authSubject = mock(typeof(AuthSubject));

            when(authSubject.Username()).thenReturn("Christof");
            when(_transaction.securityContext()).thenReturn(new SecurityContext(authSubject, [email protected]_Static.Full));

            TxStateTransactionDataSnapshot transactionDataSnapshot = Snapshot();

            assertEquals("Christof", transactionDataSnapshot.Username());
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAccessExampleMetaData()
        public virtual void ShouldAccessExampleMetaData()
        {
            EmbeddedProxySPI spi = mock(typeof(EmbeddedProxySPI));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.api.KernelTransactionImplementation transaction = mock(org.neo4j.kernel.impl.api.KernelTransactionImplementation.class);
            KernelTransactionImplementation transaction = mock(typeof(KernelTransactionImplementation));

            when(transaction.MetaData).thenReturn(genericMap("username", "Igor"));
            TxStateTransactionDataSnapshot transactionDataSnapshot = new TxStateTransactionDataSnapshot(_state, spi, _ops, transaction);

            assertEquals(1, transactionDataSnapshot.MetaData().Count);
            assertThat("Expected metadata map to contain defined username", transactionDataSnapshot.MetaData(), equalTo(genericMap("username", "Igor")));
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void accessTransactionIdAndCommitTime()
        public virtual void AccessTransactionIdAndCommitTime()
        {
            long committedTransactionId = 7L;
            long commitTime             = 10L;

            when(_transaction.TransactionId).thenReturn(committedTransactionId);
            when(_transaction.CommitTime).thenReturn(commitTime);

            TxStateTransactionDataSnapshot transactionDataSnapshot = Snapshot();

            assertEquals(committedTransactionId, transactionDataSnapshot.TransactionId);
            assertEquals(commitTime, transactionDataSnapshot.CommitTime);
        }
コード例 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void showsRemovedRelationships() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShowsRemovedRelationships()
        {
            // Given
            _state.relationshipDoDelete(1L, 1, 1L, 2L);
            _state.relationshipDoDelete(2L, 1, 1L, 1L);

            _ops.withRelationship(1, 1, 1, 2);
            _ops.withRelationship(2, 1, 1, 1, genericMap("key", Values.of("p")));

            // When & Then
            TxStateTransactionDataSnapshot snapshot = snapshot();

            assertThat(IdList(snapshot.DeletedRelationships()), equalTo(asList(1L, 2L)));
            assertThat(single(snapshot.RemovedRelationshipProperties()).key(), equalTo("key"));
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void showsDeletedNodes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShowsDeletedNodes()
        {
            // Given
            _state.nodeDoDelete(1L);
            _state.nodeDoDelete(2L);

            int labelId = 15;

            when(_tokenRead.nodeLabelName(labelId)).thenReturn("label");

            _ops.withNode(1, new long[] { labelId }, genericMap("key", Values.of("p")));
            _ops.withNode(2, _noLabels);

            // When & Then
            TxStateTransactionDataSnapshot snapshot = snapshot();

            assertThat(IdList(snapshot.DeletedNodes()), equalTo(asList(1L, 2L)));
            assertThat(single(snapshot.RemovedLabels()).label().name(), equalTo("label"));
            assertThat(single(snapshot.RemovedNodeProperties()).key(), equalTo("key"));
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAccessEmptyMetaData()
        public virtual void ShouldAccessEmptyMetaData()
        {
            TxStateTransactionDataSnapshot transactionDataSnapshot = Snapshot();

            assertEquals(0, transactionDataSnapshot.MetaData().Count);
        }
コード例 #9
0
 internal LabelEntryView(TxStateTransactionDataSnapshot outerInstance, long nodeId, string labelName)
 {
     this._outerInstance = outerInstance;
     this.NodeId         = nodeId;
     this.LabelConflict  = Label.label(labelName);
 }