Search in sources :

Example 96 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeLabelsFieldTest method maximumOfSevenInlinedLabels.

@Test
public void maximumOfSevenInlinedLabels() throws Exception {
    // GIVEN
    long[] labels = new long[] { 0, 1, 2, 3, 4, 5, 6 };
    NodeRecord node = nodeRecordWithInlinedLabels(labels);
    NodeLabels nodeLabels = NodeLabelsField.parseLabelsField(node);
    // WHEN
    Iterable<DynamicRecord> changedDynamicRecords = nodeLabels.add(23, nodeStore, nodeStore.getDynamicLabelStore());
    // THEN
    assertEquals(dynamicLabelsLongRepresentation(changedDynamicRecords), node.getLabelField());
    assertEquals(1, Iterables.count(changedDynamicRecords));
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NodeLabels(org.neo4j.kernel.impl.store.NodeLabels) DynamicNodeLabels(org.neo4j.kernel.impl.store.DynamicNodeLabels) Test(org.junit.Test)

Example 97 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeLabelsFieldTest method shouldInlineOneLabelWithHighId.

@Test
public void shouldInlineOneLabelWithHighId() throws Exception {
    // GIVEN
    long labelId = 10000;
    NodeRecord node = nodeRecordWithInlinedLabels();
    NodeLabels nodeLabels = NodeLabelsField.parseLabelsField(node);
    // WHEN
    nodeLabels.add(labelId, null, null);
    // THEN
    assertEquals(inlinedLabelsLongRepresentation(labelId), node.getLabelField());
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NodeLabels(org.neo4j.kernel.impl.store.NodeLabels) DynamicNodeLabels(org.neo4j.kernel.impl.store.DynamicNodeLabels) Test(org.junit.Test)

Example 98 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeLabelsFieldTest method shouldReadNullDynamicRecordFromInlineLabelsField.

@Test
public void shouldReadNullDynamicRecordFromInlineLabelsField() throws Exception {
    // GIVEN
    NodeRecord node = nodeRecordWithInlinedLabels(23L);
    // WHEN
    boolean isDynamicReference = NodeLabelsField.fieldPointsToDynamicRecordOfLabels(node.getLabelField());
    // THEN
    assertFalse(isDynamicReference);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) Test(org.junit.Test)

Example 99 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeEncoderStepTest method shouldAssignLabelsForNodesWithLabels.

@Test
public void shouldAssignLabelsForNodesWithLabels() throws Exception {
    // GIVEN
    NodeEncoderStep step = new NodeEncoderStep(control, DEFAULT, actual(), fromInput(), tokenRepository, nodeStore, mock(StatsProvider.class));
    // WHEN
    InputNode node = new InputNode("source", 0, 0, 0L, NO_PROPERTIES, null, new String[] { "one", "two" }, null);
    Batch<InputNode, NodeRecord> batchBefore = new Batch<>(new InputNode[] { node });
    step.process(batchBefore, sender);
    // THEN
    @SuppressWarnings("unchecked") Batch<InputNode, NodeRecord> batchAfter = (Batch<InputNode, NodeRecord>) single(sender);
    assertNotNull(batchAfter.labels[0]);
    assertEquals(2, batchAfter.labels[0].length);
}
Also used : InputNode(org.neo4j.unsafe.impl.batchimport.input.InputNode) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) StatsProvider(org.neo4j.unsafe.impl.batchimport.stats.StatsProvider) Test(org.junit.Test)

Example 100 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeEncoderStepTest method shouldNotAssignLabelsForNodesWithNoLabels.

@Test
public void shouldNotAssignLabelsForNodesWithNoLabels() throws Exception {
    // GIVEN
    NodeEncoderStep step = new NodeEncoderStep(control, DEFAULT, actual(), fromInput(), tokenRepository, nodeStore, mock(StatsProvider.class));
    // WHEN
    InputNode node = new InputNode("source", 0, 0, 0L, NO_PROPERTIES, null, NO_LABELS, null);
    Batch<InputNode, NodeRecord> batchBefore = new Batch<>(new InputNode[] { node });
    step.process(batchBefore, sender);
    // THEN
    @SuppressWarnings("unchecked") Batch<InputNode, NodeRecord> batchAfter = (Batch<InputNode, NodeRecord>) single(sender);
    assertNull(batchAfter.labels[0]);
}
Also used : InputNode(org.neo4j.unsafe.impl.batchimport.input.InputNode) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) StatsProvider(org.neo4j.unsafe.impl.batchimport.stats.StatsProvider) Test(org.junit.Test)

Aggregations

NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)391 Test (org.junit.Test)154 Test (org.junit.jupiter.api.Test)108 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)73 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)63 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)58 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)46 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)42 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)40 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)40 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)38 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)32 ArrayList (java.util.ArrayList)30 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)30 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)30 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)30 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)30 NodeStore (org.neo4j.kernel.impl.store.NodeStore)28 Command (org.neo4j.kernel.impl.transaction.command.Command)27 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)17