use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class InternalTransactionCommitProcessTest method shouldSuccessfullyCommitTransactionWithNoCommands.
@Test
void shouldSuccessfullyCommitTransactionWithNoCommands() throws Exception {
// GIVEN
long txId = 11;
TransactionIdStore transactionIdStore = mock(TransactionIdStore.class);
TransactionAppender appender = new TestableTransactionAppender(transactionIdStore);
when(transactionIdStore.nextCommittingTransactionId()).thenReturn(txId);
StorageEngine storageEngine = mock(StorageEngine.class);
TransactionCommitProcess commitProcess = new InternalTransactionCommitProcess(appender, storageEngine);
PhysicalTransactionRepresentation noCommandTx = new PhysicalTransactionRepresentation(Collections.emptyList());
noCommandTx.setHeader(new byte[0], -1, -1, -1, -1, ANONYMOUS);
// WHEN
commitProcess.commit(new TransactionToApply(noCommandTx, NULL), commitEvent, INTERNAL);
verify(transactionIdStore).transactionCommitted(txId, FakeCommitment.CHECKSUM, FakeCommitment.TIMESTAMP, NULL);
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class TransactionRepresentationFactory method nextTransaction.
TransactionToApply nextTransaction(long txId) {
PhysicalTransactionRepresentation representation = new PhysicalTransactionRepresentation(createRandomCommands());
representation.setHeader(new byte[0], currentTimeMillis(), txId, currentTimeMillis(), 42, ANONYMOUS);
return new TransactionToApply(representation, NULL);
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class TransactionWriter method representation.
public TransactionRepresentation representation(byte[] additionalHeader, long startTime, long lastCommittedTx, long committedTime) {
prepareForCommit();
PhysicalTransactionRepresentation representation = new PhysicalTransactionRepresentation(allCommands());
representation.setHeader(additionalHeader, startTime, lastCommittedTx, committedTime, -1, AuthSubject.ANONYMOUS);
return representation;
}
use of org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation in project neo4j by neo4j.
the class NeoStoresTest method commitTx.
private void commitTx() throws Exception {
try (CommandCreationContext commandCreationContext = storageEngine.newCommandCreationContext(INSTANCE)) {
CursorContext cursorContext = NULL;
commandCreationContext.initialize(cursorContext);
List<StorageCommand> commands = new ArrayList<>();
storageEngine.createCommands(commands, transactionState, storageReader, commandCreationContext, IGNORE, NONE, storageEngine.testAccessNeoStores().getMetaDataStore().getLastClosedTransactionId(), tx -> tx, cursorContext, INSTANCE);
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(commands);
tx.setHeader(EMPTY_BYTE_ARRAY, -1, -1, -1, -1, AUTH_DISABLED);
storageEngine.apply(new TransactionToApply(tx, cursorContext), INTERNAL);
}
}
Aggregations