use of org.neo4j.kernel.impl.transaction.command.Command.SchemaRuleCommand in project neo4j by neo4j.
the class Commands method createIndexRule.
public static SchemaRuleCommand createIndexRule(SchemaIndexProvider.Descriptor provider, long id, NodePropertyDescriptor descriptor) {
SchemaRule rule = IndexRule.indexRule(id, NewIndexDescriptorFactory.forSchema(SchemaBoundary.map(descriptor)), provider);
DynamicRecord record = new DynamicRecord(id);
record.setInUse(true);
record.setCreated();
record.setData(rule.serialize());
return new SchemaRuleCommand(Collections.<DynamicRecord>emptyList(), singletonList(record), rule);
}
use of org.neo4j.kernel.impl.transaction.command.Command.SchemaRuleCommand in project neo4j by neo4j.
the class SchemaRuleCommandTest method shouldDropSchemaRuleFromStore.
@Test
public void shouldDropSchemaRuleFromStore() throws Exception {
// GIVEN
SchemaRecord beforeRecords = serialize(rule, id, true, true);
SchemaRecord afterRecords = serialize(rule, id, false, false);
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.transaction.command.Command.SchemaRuleCommand in project neo4j by neo4j.
the class SchemaRuleCommandTest method shouldDropSchemaRuleFromIndex.
@Test
public void shouldDropSchemaRuleFromIndex() throws Exception {
// GIVEN
SchemaRecord beforeRecords = serialize(rule, id, true, true);
SchemaRecord afterRecords = serialize(rule, id, false, false);
when(neoStores.getSchemaStore()).thenReturn(schemaStore);
// WHEN
visitSchemaRuleCommand(indexApplier, new SchemaRuleCommand(beforeRecords, afterRecords, rule));
// THEN
verify(indexes).dropIndex(rule);
}
use of org.neo4j.kernel.impl.transaction.command.Command.SchemaRuleCommand 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.transaction.command.Command.SchemaRuleCommand 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);
}
Aggregations