//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());
        }
示例#2
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);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testInMemoryLogChannel() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestInMemoryLogChannel()
        {
            InMemoryClosableChannel channel = new InMemoryClosableChannel();

            for (int i = 0; i < 25; i++)
            {
                channel.PutInt(i);
            }
            for (int i = 0; i < 25; i++)
            {
                assertEquals(i, channel.Int);
            }
            channel.Reset();
            for (long i = 0; i < 12; i++)
            {
                channel.PutLong(i);
            }
            for (long i = 0; i < 12; i++)
            {
                assertEquals(i, channel.Long);
            }
            channel.Reset();
            for (long i = 0; i < 8; i++)
            {
                channel.PutLong(i);
                channel.PutInt(( int )i);
            }
            for (long i = 0; i < 8; i++)
            {
                assertEquals(i, channel.Long);
                assertEquals(i, channel.Int);
            }
            channel.Dispose();
        }
//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());
        }
示例#5
0
 public override void WriteInt(int value)
 {
     @delegate.PutInt(value);
 }