use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class LegacyLogEntryWriterTest method shouldWriteAllTheEntryInACommitToTheFile.
@Test
public void shouldWriteAllTheEntryInACommitToTheFile() throws IOException {
// given
final LogVersionedStoreChannel channel = mock(LogVersionedStoreChannel.class);
final LogEntryWriter logEntryWriter = mock(LogEntryWriter.class);
final LegacyLogEntryWriter writer = new LegacyLogEntryWriter(fs, liftToFactory(logEntryWriter));
final LogEntryStart start = new LogEntryStart(0, 1, 2L, 3L, EMPTY_ADDITIONAL_ARRAY, UNSPECIFIED);
final LogEntryCommand command = new LogEntryCommand(new Command.NodeCommand(nodeRecord, nodeRecord));
final LogEntryCommit commit = new OnePhaseCommit(42L, 43L);
// when
final IOCursor<LogEntry> cursor = mockCursor(start, command, commit);
writer.writeAllLogEntries(channel, cursor);
// then
verify(logEntryWriter, times(1)).writeStartEntry(0, 1, 2L, 3L, EMPTY_ADDITIONAL_ARRAY);
final TransactionRepresentation expected = new PhysicalTransactionRepresentation(Arrays.asList(command.getXaCommand()));
verify(logEntryWriter, times(1)).serialize(eq(expected));
verify(logEntryWriter, times(1)).writeCommitEntry(42L, 43L);
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class Commands method transactionRepresentation.
public static TransactionRepresentation transactionRepresentation(Collection<StorageCommand> commands) {
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(commands);
tx.setHeader(new byte[0], 0, 0, 0, 0, 0, 0);
return tx;
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class CommitProcessStateMachineCollaborationTest method physicalTx.
private PhysicalTransactionRepresentation physicalTx(int lockSessionId) {
PhysicalTransactionRepresentation physicalTx = mock(PhysicalTransactionRepresentation.class);
when(physicalTx.getLockSessionId()).thenReturn(lockSessionId);
return physicalTx;
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class ReplicatedTransactionStateMachineTest method physicalTx.
private PhysicalTransactionRepresentation physicalTx(int lockSessionId) {
PhysicalTransactionRepresentation physicalTx = mock(PhysicalTransactionRepresentation.class);
when(physicalTx.getLockSessionId()).thenReturn(lockSessionId);
return physicalTx;
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class CheckTxLogsTest method writeTxContent.
private void writeTxContent(File log, long txId, Command... commands) throws IOException {
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(Arrays.asList(commands));
tx.setHeader(new byte[0], 0, 0, 0, 0, 0, 0);
writeContent(log, (txWriter) -> txWriter.append(tx, txId));
}
Aggregations