Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertHandlesLogTruncation(org.neo4j.kernel.impl.transaction.command.Command cmd) throws java.io.IOException
        private void AssertHandlesLogTruncation(Command cmd)
        {
            _inMemoryChannel.reset();
            _writer.serialize(new PhysicalTransactionRepresentation(singletonList(cmd)));
            int bytesSuccessfullyWritten = _inMemoryChannel.writerPosition();

            try
            {
                LogEntry       logEntry = _logEntryReader.readLogEntry(_inMemoryChannel);
                StorageCommand command  = (( LogEntryCommand )logEntry).Command;
                assertEquals(cmd, command);
            }
            catch (Exception e)
            {
                throw new AssertionError("Failed to deserialize " + cmd.ToString() + ", because: ", e);
            }
            bytesSuccessfullyWritten--;
            while (bytesSuccessfullyWritten-- > 0)
            {
                _inMemoryChannel.reset();
                _writer.serialize(new PhysicalTransactionRepresentation(singletonList(cmd)));
                _inMemoryChannel.truncateTo(bytesSuccessfullyWritten);
                LogEntry deserialized = _logEntryReader.readLogEntry(_inMemoryChannel);
                assertNull("Deserialization did not detect log truncation!" + "Record: " + cmd + ", deserialized: " + deserialized, deserialized);
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean visit(org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation tx) throws java.io.IOException
        public override bool Visit(CommittedTransactionRepresentation tx)
        {
            _writer.serialize(tx);
            return(false);
        }