use of org.neo4j.kernel.impl.store.record.SchemaRecord in project neo4j by neo4j.
the class SchemaRuleCommandTest method shouldWriteCreatedSchemaRuleToStore.
@Test
public void shouldWriteCreatedSchemaRuleToStore() throws Exception {
// GIVEN
SchemaRecord beforeRecords = serialize(rule, id, false, false);
SchemaRecord afterRecords = serialize(rule, id, true, true);
when(neoStores.getSchemaStore()).thenReturn(schemaStore);
// WHEN
visitSchemaRuleCommand(storeApplier, new SchemaRuleCommand(beforeRecords, afterRecords, rule));
// THEN
verify(schemaStore).updateRecord(Iterables.first(afterRecords));
}
use of org.neo4j.kernel.impl.store.record.SchemaRecord in project neo4j by neo4j.
the class SchemaRuleCommandTest method shouldCreateIndexForCreatedSchemaRule.
@Test
public void shouldCreateIndexForCreatedSchemaRule() throws Exception {
// GIVEN
SchemaRecord beforeRecords = serialize(rule, id, false, false);
SchemaRecord afterRecords = serialize(rule, id, true, true);
when(neoStores.getSchemaStore()).thenReturn(schemaStore);
// WHEN
visitSchemaRuleCommand(indexApplier, new SchemaRuleCommand(beforeRecords, afterRecords, rule));
// THEN
verify(indexes).createIndexes(rule);
}
use of org.neo4j.kernel.impl.store.record.SchemaRecord in project neo4j by neo4j.
the class TransactionRecordState method dropSchemaRule.
public void dropSchemaRule(SchemaRule rule) {
RecordProxy<Long, SchemaRecord, SchemaRule> change = recordChangeSet.getSchemaRuleChanges().getOrLoad(rule.getId(), rule);
SchemaRecord records = change.forChangingData();
for (DynamicRecord record : records) {
record.setInUse(false);
}
}
use of org.neo4j.kernel.impl.store.record.SchemaRecord in project neo4j by neo4j.
the class SchemaRuleCommandTest method serialize.
private SchemaRecord serialize(SchemaRule rule, long id, boolean inUse, boolean created) {
DynamicRecord record = new DynamicRecord(id);
record.setData(rule.serialize());
if (created) {
record.setCreated();
}
if (inUse) {
record.setInUse(true);
}
return new SchemaRecord(singletonList(record));
}
use of org.neo4j.kernel.impl.store.record.SchemaRecord in project neo4j by neo4j.
the class SchemaRuleCommandTest method shouldWriteSchemaRuleToLog.
@Test
public void shouldWriteSchemaRuleToLog() throws Exception {
// GIVEN
SchemaRecord beforeRecords = serialize(rule, id, false, false);
SchemaRecord afterRecords = serialize(rule, id, true, true);
SchemaRuleCommand command = new SchemaRuleCommand(beforeRecords, afterRecords, rule);
InMemoryClosableChannel buffer = new InMemoryClosableChannel();
when(neoStores.getSchemaStore()).thenReturn(schemaStore);
// WHEN
command.serialize(buffer);
Command readCommand = reader.read(buffer);
// THEN
assertThat(readCommand, instanceOf(SchemaRuleCommand.class));
assertSchemaRule((SchemaRuleCommand) readCommand);
}
Aggregations