use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyRelationshipTypeTokenCommandToTheStore.
// RELATIONSHIP TYPE TOKEN COMMAND
@Test
public void shouldApplyRelationshipTypeTokenCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord(42);
final RelationshipTypeTokenRecord after = new RelationshipTypeTokenRecord(42);
after.setInUse(true);
after.setNameId(323);
final Command command = new RelationshipTypeTokenCommand(before, after);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(relationshipTypeTokenStore, times(1)).updateRecord(after);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyNodePropertyCommandToTheStore.
// PROPERTY COMMAND
@Test
public void shouldApplyNodePropertyCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final PropertyRecord before = new PropertyRecord(11);
final PropertyRecord after = new PropertyRecord(12);
after.setNodeId(42);
final Command command = new Command.PropertyCommand(before, after);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(lockService, times(1)).acquireNodeLock(42, LockService.LockType.WRITE_LOCK);
verify(propertyStore, times(1)).updateRecord(after);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyRelationshipCommandToTheStoreAndInvalidateTheCache.
@Test
public void shouldApplyRelationshipCommandToTheStoreAndInvalidateTheCache() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final RelationshipRecord before = new RelationshipRecord(12);
final RelationshipRecord record = new RelationshipRecord(12, 3, 4, 5);
record.setInUse(false);
final Command command = new Command.RelationshipCommand(before, record);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(relationshipStore, times(1)).updateRecord(record);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyUpdateIndexRuleSchemaRuleCommandToTheStoreInRecovery.
@Test
public void shouldApplyUpdateIndexRuleSchemaRuleCommandToTheStoreInRecovery() throws Exception {
// given
final BatchTransactionApplier applier = newApplierFacade(newIndexApplier(), newApplier(true));
final DynamicRecord record = DynamicRecord.dynamicRecord(21, true);
final Collection<DynamicRecord> recordsAfter = Arrays.asList(record);
final IndexRule rule = constraintIndexRule(0, 1, 2, new SchemaIndexProvider.Descriptor("K", "X.Y"), 42L);
final Command.SchemaRuleCommand command = new Command.SchemaRuleCommand(Collections.<DynamicRecord>emptyList(), recordsAfter, rule);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(schemaStore, times(1)).setHighestPossibleIdInUse(record.getId());
verify(schemaStore, times(1)).updateRecord(record);
verify(indexingService, times(1)).activateIndex(rule.getId());
verify(cacheAccess, times(1)).addSchemaRule(rule);
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplier in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyUpdateUniquenessConstraintRuleSchemaRuleCommandToTheStore.
@Test
public void shouldApplyUpdateUniquenessConstraintRuleSchemaRuleCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final DynamicRecord record = DynamicRecord.dynamicRecord(21, true);
final Collection<DynamicRecord> recordsAfter = Arrays.asList(record);
final ConstraintRule rule = uniquenessConstraintRule(0L, 1, 2, 3L);
final Command.SchemaRuleCommand command = new Command.SchemaRuleCommand(Collections.<DynamicRecord>emptyList(), recordsAfter, rule);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(schemaStore, times(1)).updateRecord(record);
verify(metaDataStore, times(1)).setLatestConstraintIntroducingTx(transactionId);
verify(cacheAccess, times(1)).addSchemaRule(rule);
}
Aggregations