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));
}
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());
}
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);
}
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);
}
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]);
}
Aggregations