示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadAStartLogEntry() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadAStartLogEntry()
        {
            // given
            LogEntryVersion version = LogEntryVersion.CURRENT;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntryStart start = new LogEntryStart(version, 1, 2, 3, 4, new byte[]{5}, new org.neo4j.kernel.impl.transaction.log.LogPosition(0, 31));
            LogEntryStart start = new LogEntryStart(version, 1, 2, 3, 4, new sbyte[] { 5 }, new LogPosition(0, 31));
//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(version.byteCode());                 // version
            channel.Put(LogEntryByteCodes.TxStart);          // type
            channel.PutInt(start.MasterId);
            channel.PutInt(start.LocalId);
            channel.PutLong(start.TimeWritten);
            channel.PutLong(start.LastCommittedTxWhenTransactionStarted);
            channel.PutInt(start.AdditionalHeader.Length);
            channel.Put(start.AdditionalHeader, start.AdditionalHeader.Length);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel);
            LogEntry logEntry = _logEntryReader.readLogEntry(channel);

            // then
            assertEquals(start, logEntry);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadACheckPointLogEntry() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadACheckPointLogEntry()
        {
            // given
            LogEntryVersion version = LogEntryVersion.CURRENT;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.LogPosition logPosition = new org.neo4j.kernel.impl.transaction.log.LogPosition(42, 43);
            LogPosition logPosition = new LogPosition(42, 43);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final CheckPoint checkPoint = new CheckPoint(version, logPosition);
            CheckPoint checkPoint = new CheckPoint(version, logPosition);
//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(version.byteCode());
            channel.Put(LogEntryByteCodes.CheckPoint);
            channel.PutLong(logPosition.LogVersion);
            channel.PutLong(logPosition.ByteOffset);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel);
            LogEntry logEntry = _logEntryReader.readLogEntry(channel);

            // then
            assertEquals(checkPoint, logEntry);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadACommandLogEntry() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadACommandLogEntry()
        {
            // given
            LogEntryVersion version = LogEntryVersion.CURRENT;

            Command.NodeCommand nodeCommand = new Command.NodeCommand(new NodeRecord(11), new NodeRecord(11));
//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(version.byteCode());
            channel.Put(LogEntryByteCodes.Command);
            nodeCommand.Serialize(channel);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel);
            LogEntry logEntry = _logEntryReader.readLogEntry(channel);

            // then
            assertEquals(command, logEntry);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParserStartEntry() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldParserStartEntry()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntryStart start = new LogEntryStart(version, 1, 2, 3, 4, new byte[]{5}, position);
            LogEntryStart start = new LogEntryStart(_version, 1, 2, 3, 4, new sbyte[] { 5 }, _position);
//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.PutInt(start.MasterId);
            channel.PutInt(start.LocalId);
            channel.PutLong(start.TimeWritten);
            channel.PutLong(start.LastCommittedTxWhenTransactionStarted);
            channel.PutInt(start.AdditionalHeader.Length);
            channel.Put(start.AdditionalHeader, start.AdditionalHeader.Length);

            channel.GetCurrentPosition(_marker);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntryParser parser = version.entryParser(LogEntryByteCodes.TX_START);
            LogEntryParser parser = _version.entryParser(LogEntryByteCodes.TxStart);
//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(start, logEntry);
            assertFalse(parser.skip());
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnNullWhenThereIsNoCommand() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnNullWhenThereIsNoCommand()
        {
            // given
            LogEntryVersion version = LogEntryVersion.CURRENT;
//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(version.byteCode());
            channel.Put(LogEntryByteCodes.Command);
            channel.Put(Org.Neo4j.Kernel.impl.transaction.command.NeoCommandType_Fields.None);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel);
            LogEntry logEntry = _logEntryReader.readLogEntry(channel);

            // then
            assertNull(logEntry);
        }
//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());
        }
示例#7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadACommitLogEntry() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadACommitLogEntry()
        {
            // given
            LogEntryVersion version = LogEntryVersion.CURRENT;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntryCommit commit = new LogEntryCommit(version, 42, 21);
            LogEntryCommit commit = new LogEntryCommit(version, 42, 21);
//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(version.byteCode());
            channel.Put(LogEntryByteCodes.TxCommit);
            channel.PutLong(commit.TxId);
            channel.PutLong(commit.TimeWritten);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel);
            LogEntry logEntry = _logEntryReader.readLogEntry(channel);

            // then
            assertEquals(commit, logEntry);
        }
示例#8
0
 public override void WriteByte(int value)
 {
     @delegate.Put(( sbyte )value);
 }