use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaRuleSerialization35Test method assertParseIndexRule.
private static void assertParseIndexRule(String serialized, String name) throws Exception {
// GIVEN
long ruleId = 24;
IndexPrototype prototype = forLabel(512, 4).withIndexProvider(PROVIDER_25);
byte[] bytes = decodeBase64(serialized);
// WHEN
IndexDescriptor deserialized = assertIndexRule(SchemaRuleSerialization35.deserialize(ruleId, ByteBuffer.wrap(bytes)));
// THEN
assertThat(deserialized.getId()).isEqualTo(ruleId);
assertThat(deserialized).isEqualTo(prototype.withName(name).materialise(ruleId));
assertThat(deserialized.schema()).isEqualTo(prototype.schema());
assertThat(deserialized.getIndexProvider().getKey()).isEqualTo(PROVIDER_KEY);
assertThat(deserialized.getIndexProvider().getVersion()).isEqualTo(PROVIDER_VERSION_25);
assertThat(deserialized.getName()).isEqualTo(name);
assertTrue(deserialized.getOwningConstraintId().isEmpty());
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaStore35Test method storeAndLoad_Big_CompositeSchemaRule.
@Test
void storeAndLoad_Big_CompositeSchemaRule() throws Exception {
// GIVEN
long id = store.nextId(NULL);
IndexDescriptor indexRule = IndexPrototype.forSchema(forLabel(2, range(1, 200).toArray()), PROVIDER).withName("index_" + id).materialise(id);
// WHEN
IndexDescriptor readIndexRule = (IndexDescriptor) SchemaRuleSerialization35.deserialize(indexRule.getId(), wrap(SchemaRuleSerialization35.serialize(indexRule, INSTANCE)));
// THEN
assertEquals(indexRule.getId(), readIndexRule.getId());
assertEquals(indexRule.schema(), readIndexRule.schema());
assertEquals(indexRule, readIndexRule);
assertEquals(indexRule.getIndexProvider(), readIndexRule.getIndexProvider());
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaStore35Test method storeAndLoad_Big_CompositeMultiTokenSchemaRule.
@Test
void storeAndLoad_Big_CompositeMultiTokenSchemaRule() throws Exception {
// GIVEN
FulltextSchemaDescriptor schema = fulltext(EntityType.RELATIONSHIP, range(1, 200).toArray(), range(1, 200).toArray());
long id = store.nextId(NULL);
IndexDescriptor indexRule = IndexPrototype.forSchema(schema, PROVIDER).withName("index_" + id).withIndexType(IndexType.FULLTEXT).materialise(id);
// WHEN
IndexDescriptor readIndexRule = (IndexDescriptor) SchemaRuleSerialization35.deserialize(indexRule.getId(), wrap(SchemaRuleSerialization35.serialize(indexRule, INSTANCE)));
// THEN
assertEquals(indexRule.getId(), readIndexRule.getId());
assertEquals(indexRule.schema(), readIndexRule.schema());
assertEquals(indexRule, readIndexRule);
assertEquals(indexRule.getIndexProvider(), readIndexRule.getIndexProvider());
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaStore35Test method storeAndLoadMultiTokenSchemaRule.
@Test
void storeAndLoadMultiTokenSchemaRule() throws Exception {
// GIVEN
int[] propertyIds = { 4, 5, 6, 7 };
int[] entityTokens = { 2, 3, 4 };
long id = store.nextId(NULL);
IndexDescriptor indexRule = IndexPrototype.forSchema(fulltext(EntityType.RELATIONSHIP, entityTokens, propertyIds), PROVIDER).withName("index_" + id).withIndexType(IndexType.FULLTEXT).materialise(id);
// WHEN
IndexDescriptor readIndexRule = (IndexDescriptor) SchemaRuleSerialization35.deserialize(indexRule.getId(), wrap(SchemaRuleSerialization35.serialize(indexRule, INSTANCE)));
// THEN
assertEquals(indexRule.getId(), readIndexRule.getId());
assertEquals(indexRule.schema(), readIndexRule.schema());
assertEquals(indexRule, readIndexRule);
assertEquals(indexRule.getIndexProvider(), readIndexRule.getIndexProvider());
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaStore35Test method storeAndLoadCompositeSchemaRule.
@Test
void storeAndLoadCompositeSchemaRule() throws Exception {
// GIVEN
int[] propertyIds = { 4, 5, 6, 7 };
long id = store.nextId(NULL);
IndexDescriptor indexRule = IndexPrototype.forSchema(forLabel(2, propertyIds), PROVIDER).withName("index_" + id).materialise(id);
// WHEN
IndexDescriptor readIndexRule = (IndexDescriptor) SchemaRuleSerialization35.deserialize(indexRule.getId(), wrap(SchemaRuleSerialization35.serialize(indexRule, INSTANCE)));
// THEN
assertEquals(indexRule.getId(), readIndexRule.getId());
assertEquals(indexRule.schema(), readIndexRule.schema());
assertEquals(indexRule, readIndexRule);
assertEquals(indexRule.getIndexProvider(), readIndexRule.getIndexProvider());
}
Aggregations