Search in sources :

Example 6 with EntityTokenRangeImpl

use of org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl in project neo4j by neo4j.

the class TokenScanDocumentTest method shouldAdaptToStringToTypeOfRangeNode.

@Test
void shouldAdaptToStringToTypeOfRangeNode() {
    TokenScanDocument labelScanDocument = new TokenScanDocument(new EntityTokenRangeImpl(0, new long[0][], NODE));
    assertThat(labelScanDocument.toString()).contains("NodeLabelRange");
}
Also used : EntityTokenRangeImpl(org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl) Test(org.junit.jupiter.api.Test)

Example 7 with EntityTokenRangeImpl

use of org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl in project neo4j by neo4j.

the class MessageConsistencyLoggerTest method shouldAdaptLogMessageToEntityTokenRangeTypeRelationship.

@Test
void shouldAdaptLogMessageToEntityTokenRangeTypeRelationship() {
    // when
    logger.error(RecordType.RELATIONSHIP_TYPE_SCAN_DOCUMENT, new TokenScanDocument(new EntityTokenRangeImpl(0, new long[0][], RELATIONSHIP)), "Some relationship type error", new RelationshipRecord(1));
    // then
    logMatcher.containsMessages("RelationshipTypeRange");
}
Also used : RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) TokenScanDocument(org.neo4j.consistency.store.synthetic.TokenScanDocument) EntityTokenRangeImpl(org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl) Test(org.junit.jupiter.api.Test)

Example 8 with EntityTokenRangeImpl

use of org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl in project neo4j by neo4j.

the class TokenScanDocumentTest method shouldAdaptToStringToTypeOfRangeRelationship.

@Test
void shouldAdaptToStringToTypeOfRangeRelationship() {
    TokenScanDocument relationshipTypeScanDocument = new TokenScanDocument(new EntityTokenRangeImpl(0, new long[0][], RELATIONSHIP));
    assertThat(relationshipTypeScanDocument.toString()).contains("RelationshipTypeRange");
}
Also used : EntityTokenRangeImpl(org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl) Test(org.junit.jupiter.api.Test)

Example 9 with EntityTokenRangeImpl

use of org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl in project neo4j by neo4j.

the class EntityTokenRangeTest method shouldRebaseOnRangeId.

@Test
void shouldRebaseOnRangeId() {
    // given
    long[][] labelsPerNode = new long[][] { { 1 }, { 1, 3 }, { 3, 5, 7 }, {}, { 1, 5, 7 }, {}, {}, { 1, 2, 3, 4 } };
    // when
    EntityTokenRange range = new EntityTokenRangeImpl(10, labelsPerNode, NODE);
    // then
    long baseNodeId = range.id() * labelsPerNode.length;
    long[] expectedNodeIds = new long[labelsPerNode.length];
    for (int i = 0; i < expectedNodeIds.length; i++) {
        expectedNodeIds[i] = baseNodeId + i;
    }
    assertArrayEquals(expectedNodeIds, range.entities());
}
Also used : EntityTokenRange(org.neo4j.kernel.impl.index.schema.EntityTokenRange) EntityTokenRangeImpl(org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl) Test(org.junit.jupiter.api.Test)

Example 10 with EntityTokenRangeImpl

use of org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl in project neo4j by neo4j.

the class EntityTokenRangeTest method shouldTransposeNodeIdsAndLabelIds.

@Test
void shouldTransposeNodeIdsAndLabelIds() {
    // given
    long[][] labelsPerNode = new long[][] { { 1 }, { 1, 3 }, { 3, 5, 7 }, {}, { 1, 5, 7 }, {}, {}, { 1, 2, 3, 4 } };
    // when
    EntityTokenRange range = new EntityTokenRangeImpl(0, labelsPerNode, NODE);
    // then
    assertArrayEquals(new long[] { 0, 1, 2, 3, 4, 5, 6, 7 }, range.entities());
    for (int i = 0; i < labelsPerNode.length; i++) {
        assertArrayEquals(labelsPerNode[i], range.tokens(i));
    }
}
Also used : EntityTokenRange(org.neo4j.kernel.impl.index.schema.EntityTokenRange) EntityTokenRangeImpl(org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl) Test(org.junit.jupiter.api.Test)

Aggregations

EntityTokenRangeImpl (org.neo4j.kernel.impl.index.schema.EntityTokenRangeImpl)10 Test (org.junit.jupiter.api.Test)8 TokenScanDocument (org.neo4j.consistency.store.synthetic.TokenScanDocument)4 EntityTokenRange (org.neo4j.kernel.impl.index.schema.EntityTokenRange)4 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)1 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)1