use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class SchemaStorageIT method makeIndexRule.
private IndexDescriptor makeIndexRule(long ruleId, String label, String propertyKey) {
LabelSchemaDescriptor schema = forLabel(labelId(label), propId(propertyKey));
IndexPrototype prototype = forSchema(schema, GenericNativeIndexProvider.DESCRIPTOR);
prototype = prototype.withName(SchemaRule.generateName(prototype, new String[] { label }, new String[] { propertyKey }));
return prototype.materialise(ruleId);
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class KernelSchemaStateFlushingTest method createIndex.
private IndexDescriptor createIndex() throws KernelException {
try (KernelTransaction transaction = beginTransaction()) {
LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, propId);
IndexDescriptor reference = transaction.schemaWrite().indexCreate(schema, null);
transaction.commit();
return reference;
}
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class IndexPopulationFailedKernelExceptionTest method shouldHandleMultiplePropertiesInConstructor1.
@Test
void shouldHandleMultiplePropertiesInConstructor1() {
// Given
LabelSchemaDescriptor descriptor = SchemaDescriptor.forLabel(0, 42, 43, 44);
// When
IndexPopulationFailedKernelException index = new IndexPopulationFailedKernelException(descriptor.userDescription(TOKEN_NAME_LOOKUP), new RuntimeException());
// Then
assertThat(index.getUserMessage(TOKEN_NAME_LOOKUP)).isEqualTo("Failed to populate index (:label0 {p42, p43, p44})");
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class IndexPopulationFailedKernelExceptionTest method shouldHandleMultiplePropertiesInConstructor2.
@Test
void shouldHandleMultiplePropertiesInConstructor2() {
// Given
LabelSchemaDescriptor descriptor = SchemaDescriptor.forLabel(0, 42, 43, 44);
// When
IndexPopulationFailedKernelException index = new IndexPopulationFailedKernelException(descriptor.userDescription(TOKEN_NAME_LOOKUP), "an act of pure evil occurred");
// Then
assertThat(index.getUserMessage(TOKEN_NAME_LOOKUP)).isEqualTo("Failed to populate index (:label0 {p42, p43, p44}), due to an act of pure evil occurred");
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class IndexEntryConflictExceptionTest method shouldMakeCompositeEntryConflicts.
@Test
void shouldMakeCompositeEntryConflicts() {
LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, 2, 3, 4);
ValueTuple values = ValueTuple.of(true, "hi", new long[] { 6L, 4L });
IndexEntryConflictException e = new IndexEntryConflictException(0L, 1L, values);
assertThat(e.evidenceMessage(tokens, schema)).isEqualTo("Both Node(0) and Node(1) have the label `label1` and properties `p2` = true, `p3` = 'hi', `p4` = [6, 4]");
}
Aggregations