use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyCreateUniquenessConstraintRuleSchemaRuleCommandToTheStore.
@Test
public void shouldApplyCreateUniquenessConstraintRuleSchemaRuleCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final DynamicRecord record = DynamicRecord.dynamicRecord(21, true);
record.setCreated();
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);
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyDeleteUniquenessConstraintRuleSchemaRuleCommandToTheStore.
@Test
public void shouldApplyDeleteUniquenessConstraintRuleSchemaRuleCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final DynamicRecord record = DynamicRecord.dynamicRecord(21, true);
record.setInUse(false);
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, never()).setLatestConstraintIntroducingTx(transactionId);
verify(cacheAccess, times(1)).removeSchemaRuleFromCache(command.getKey());
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class NeoTransactionIndexApplierTest method createdDynamicRecord.
private static DynamicRecord createdDynamicRecord(long id) {
DynamicRecord record = dynamicRecord(id, true);
record.setCreated();
return record;
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_1Test method dynamicRecord.
private DynamicRecord dynamicRecord(boolean inUse, byte[] data, int type) {
DynamicRecord record = new DynamicRecord(dynamicRecordId++);
record.setInUse(inUse, type);
if (data != null) {
record.setData(data);
record.setLength(data.length);
}
return record;
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord 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);
}
Aggregations