use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyPropertyKeyTokenCommandToTheStore.
// PROPERTY KEY TOKEN COMMAND
@Test
public void shouldApplyPropertyKeyTokenCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final PropertyKeyTokenRecord before = new PropertyKeyTokenRecord(42);
final PropertyKeyTokenRecord after = new PropertyKeyTokenRecord(42);
after.setInUse(true);
after.setNameId(323);
final Command command = new PropertyKeyTokenCommand(before, after);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(propertyKeyTokenStore, times(1)).updateRecord(after);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyRelPropertyCommandToTheStoreInRecovery.
@Test
public void shouldApplyRelPropertyCommandToTheStoreInRecovery() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(true);
final PropertyRecord before = new PropertyRecord(11);
final PropertyRecord after = new PropertyRecord(12);
after.setRelId(42);
final Command command = new Command.PropertyCommand(before, after);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(propertyStore, times(1)).setHighestPossibleIdInUse(12);
verify(propertyStore, times(1)).updateRecord(after);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class TransactionRecordStateTest method shouldDeleteDynamicLabelsForDeletedNodeForRecoveredTransaction.
@Test
public void shouldDeleteDynamicLabelsForDeletedNodeForRecoveredTransaction() throws Throwable {
// GIVEN a store that has got a node with a dynamic label record
NeoStores store = neoStoresRule.open();
BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier(store, mock(CacheAccessBackDoor.class), LockService.NO_LOCK_SERVICE);
AtomicLong nodeId = new AtomicLong();
AtomicLong dynamicLabelRecordId = new AtomicLong();
apply(applier, transaction(nodeWithDynamicLabelRecord(store, nodeId, dynamicLabelRecordId)));
assertDynamicLabelRecordInUse(store, dynamicLabelRecordId.get(), true);
// WHEN applying a transaction, which has first round-tripped through a log (written then read)
TransactionRepresentation transaction = transaction(deleteNode(store, nodeId.get()));
InMemoryVersionableReadableClosablePositionAwareChannel channel = new InMemoryVersionableReadableClosablePositionAwareChannel();
writeToChannel(transaction, channel);
CommittedTransactionRepresentation recoveredTransaction = readFromChannel(channel);
// and applying that recovered transaction
apply(applier, recoveredTransaction.getTransactionRepresentation());
// THEN should have the dynamic label record should be deleted as well
assertDynamicLabelRecordInUse(store, dynamicLabelRecordId.get(), false);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class TransactionRecordStateTest method apply.
private void apply(NeoStores neoStores, TransactionRecordState state) throws Exception {
BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier(neoStores, mock(CacheAccessBackDoor.class), LockService.NO_LOCK_SERVICE);
apply(applier, transactionRepresentationOf(state));
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class TransactionRecordStateTest method apply.
private void apply(NeoStores neoStores, TransactionRepresentation transaction) throws Exception {
BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier(neoStores, mock(CacheAccessBackDoor.class), LockService.NO_LOCK_SERVICE);
apply(applier, transaction);
}
Aggregations