Exemple #1
0
        private CommittedTransactionRepresentation NewCommittedTransactionRepresentation()
        {
            const long arbitraryRecordId = 27L;

            Command.NodeCommand command = new Command.NodeCommand(new NodeRecord(arbitraryRecordId), new NodeRecord(arbitraryRecordId));

            PhysicalTransactionRepresentation physicalTransactionRepresentation = new PhysicalTransactionRepresentation(singletonList((new LogEntryCommand(command)).Command));

            physicalTransactionRepresentation.SetHeader(new sbyte[] {}, 0, 0, 0, 0, 0, 0);

            LogEntryStart  startEntry  = new LogEntryStart(0, 0, 0L, 0L, new sbyte[] {}, LogPosition.UNSPECIFIED);
            LogEntryCommit commitEntry = new LogEntryCommit(42, 0);

            return(new CommittedTransactionRepresentation(startEntry, physicalTransactionRepresentation, commitEntry));
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testVisitNodeCommand() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestVisitNodeCommand()
        {
            Command.NodeCommand cmd = mock(typeof(Command.NodeCommand));
            when(cmd.Handle(any(typeof(CommandVisitor)))).thenCallRealMethod();

            // WHEN
            bool result = _facade.visitNodeCommand(cmd);

            // THEN
            InOrder inOrder = inOrder(_txApplier1, _txApplier2, _txApplier3);

            inOrder.verify(_txApplier1).visitNodeCommand(cmd);
            inOrder.verify(_txApplier2).visitNodeCommand(cmd);
            inOrder.verify(_txApplier3).visitNodeCommand(cmd);

            inOrder.verifyNoMoreInteractions();

            assertFalse(result);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParserCommandsUsingAGivenFactory() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldParserCommandsUsingAGivenFactory()
        {
            // given
            // The record, it will be used as before and after
            NodeRecord theRecord = new NodeRecord(1);

            Command.NodeCommand nodeCommand = new Command.NodeCommand(theRecord, theRecord);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntryCommand command = new LogEntryCommand(version, nodeCommand);
            LogEntryCommand command = new LogEntryCommand(_version, nodeCommand);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel = new org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel();
            InMemoryClosableChannel channel = new InMemoryClosableChannel();

            channel.Put(Org.Neo4j.Kernel.impl.transaction.command.NeoCommandType_Fields.NodeCommand);
            channel.PutLong(theRecord.Id);

            // record image before
            channel.Put(( sbyte )0);           // not in use
            channel.PutInt(0);                 // number of dynamic records in use
            // record image after
            channel.Put(( sbyte )0);           // not in use
            channel.PutInt(0);                 // number of dynamic records in use

            channel.GetCurrentPosition(_marker);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntryParser parser = version.entryParser(LogEntryByteCodes.COMMAND);
            LogEntryParser parser = _version.entryParser(LogEntryByteCodes.Command);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntry logEntry = parser.parse(version, channel, marker, commandReader);
            LogEntry logEntry = parser.parse(_version, channel, _marker, _commandReader);

            // then
            assertEquals(command, logEntry);
            assertFalse(parser.skip());
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean visitNodeCommand(org.neo4j.kernel.impl.transaction.command.Command.NodeCommand command) throws java.io.IOException
        public override bool VisitNodeCommand(Command.NodeCommand command)
        {
            return(Visit(command));
        }