use of org.neo4j.kernel.impl.api.TestCommand in project neo4j by neo4j.
the class ReversedSingleFileTransactionCursorTest method tx.
private static TransactionRepresentation tx(int size) {
List<StorageCommand> commands = new ArrayList<>();
for (int i = 0; i < size; i++) {
// The type of command doesn't matter here
commands.add(new TestCommand());
}
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(commands);
tx.setHeader(new byte[0], 0, 0, 0, 0, ANONYMOUS);
return tx;
}
use of org.neo4j.kernel.impl.api.TestCommand in project neo4j by neo4j.
the class LogEntryParserDispatcherV6Test method shouldParserCommandsUsingAGivenFactory.
@Test
void shouldParserCommandsUsingAGivenFactory() throws IOException {
// given
// The record, it will be used as before and after
TestCommand testCommand = new TestCommand(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
final LogEntryCommand command = new LogEntryCommand(version, testCommand);
final InMemoryClosableChannel channel = new InMemoryClosableChannel();
testCommand.serialize(channel);
channel.getCurrentPosition(marker);
// when
final LogEntryParser parser = parserSet(LATEST).select(LogEntryTypeCodes.COMMAND);
final LogEntry logEntry = parser.parse(version, channel, marker, commandReader);
// then
assertEquals(command, logEntry);
}
use of org.neo4j.kernel.impl.api.TestCommand in project neo4j by neo4j.
the class TransactionLogAppendAndRotateIT method sillyTransaction.
private static TransactionRepresentation sillyTransaction(int size) {
List<StorageCommand> commands = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
// The actual data isn't super important
commands.add(new TestCommand(30));
commands.add(new TestCommand(60));
}
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(commands);
tx.setHeader(new byte[0], 0, 0, 0, 0, ANONYMOUS);
return tx;
}
use of org.neo4j.kernel.impl.api.TestCommand in project neo4j by neo4j.
the class VersionAwareLogEntryReaderTest method shouldReadACommandLogEntry.
@Test
void shouldReadACommandLogEntry() throws IOException {
// given
KernelVersion version = LATEST;
TestCommand testCommand = new TestCommand(new byte[] { 100, 101, 102 });
final LogEntryCommand command = new LogEntryCommand(version, testCommand);
final InMemoryClosableChannel channel = new InMemoryClosableChannel(true);
channel.put(version.version());
channel.put(LogEntryTypeCodes.COMMAND);
testCommand.serialize(channel);
// when
final LogEntry logEntry = logEntryReader.readLogEntry(channel);
// then
assertEquals(command, logEntry);
}
Aggregations