Search in sources :

Example 26 with NodeLabels

use of org.neo4j.kernel.impl.store.NodeLabels in project neo4j by neo4j.

the class BatchInsertTest method shouldNotCreateSameLabelTwiceOnSameNode.

@Test
public void shouldNotCreateSameLabelTwiceOnSameNode() throws Exception {
    // GIVEN
    BatchInserter inserter = globalInserter;
    // WHEN
    long nodeId = inserter.createNode(map("itemId", 1000L), label("Item"), label("Item"));
    // THEN
    NodeStore nodeStore = getFlushedNeoStores(inserter).getNodeStore();
    NodeRecord node = nodeStore.getRecord(nodeId, nodeStore.newRecord(), NORMAL);
    NodeLabels labels = NodeLabelsField.parseLabelsField(node);
    long[] labelIds = labels.get(nodeStore);
    assertEquals(1, labelIds.length);
}
Also used : BatchInserter(org.neo4j.unsafe.batchinsert.BatchInserter) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NodeStore(org.neo4j.kernel.impl.store.NodeStore) NodeLabels(org.neo4j.kernel.impl.store.NodeLabels) Test(org.junit.Test)

Aggregations

NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)26 Test (org.junit.Test)23 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)23 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)21 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)10 HashSet (java.util.HashSet)2 NodeStore (org.neo4j.kernel.impl.store.NodeStore)2 Command (org.neo4j.kernel.impl.transaction.command.Command)2 BatchInserter (org.neo4j.unsafe.batchinsert.BatchInserter)2 CheckerEngine (org.neo4j.consistency.checking.CheckerEngine)1 LabelChainWalker (org.neo4j.consistency.checking.LabelChainWalker)1 RecordAccess (org.neo4j.consistency.store.RecordAccess)1 InlineNodeLabels (org.neo4j.kernel.impl.store.InlineNodeLabels)1