//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void reportNodeWithoutLabelsWhenLabelsAreDynamic()
        internal virtual void ReportNodeWithoutLabelsWhenLabelsAreDynamic()
        {
            int nodeId = 42;

            long[] indexLabelIds   = new long[] { 3, 7, 9, 10 };
            long[] storeLabelIds   = new long[] {};
            long[] missingLabelIds = new long[] { 3, 7, 9, 10 };

            RecordAccessStub recordAccess = new RecordAccessStub();
            NodeRecord       node         = inUse(WithDynamicLabels(recordAccess, new NodeRecord(nodeId, false, 0, 0), storeLabelIds));

            Org.Neo4j.Consistency.report.ConsistencyReport_LabelScanConsistencyReport report = mock(typeof(Org.Neo4j.Consistency.report.ConsistencyReport_LabelScanConsistencyReport));

            // when
            CheckerEngine <LabelScanDocument, Org.Neo4j.Consistency.report.ConsistencyReport_LabelScanConsistencyReport> engine = recordAccess.Engine(null, report);

            Checker(indexLabelIds, true).checkReference(null, node, engine, recordAccess);
            recordAccess.CheckDeferred();

            // then
            foreach (long missingLabelId in missingLabelIds)
            {
                verify(report).nodeDoesNotHaveExpectedLabel(node, missingLabelId);
            }
        }
Esempio n. 2
0
 protected internal virtual void Initialize(params MultiPassStore[] storesToCheck)
 {
     this.Records = new RecordAccessStub(_stage, storesToCheck);
     if (_stage.CacheSlotSizes.Length > 0)
     {
         Records.cacheAccess().CacheSlotSizes = _stage.CacheSlotSizes;
     }
 }
        private static NodeRecord WithDynamicLabels(RecordAccessStub recordAccess, NodeRecord nodeRecord, params long[] labelIds)
        {
            IList <DynamicRecord> preAllocatedRecords = new List <DynamicRecord>();

            for (int i = 0; i < 10; i++)
            {
                preAllocatedRecords.Add(inUse(new DynamicRecord(i)));
            }
            ICollection <DynamicRecord> dynamicRecords = new List <DynamicRecord>();

            DynamicArrayStore.allocateFromNumbers(dynamicRecords, prependNodeId(nodeRecord.Id, labelIds), new ReusableRecordsAllocator(4, preAllocatedRecords));
            foreach (DynamicRecord dynamicRecord in dynamicRecords)
            {
                recordAccess.AddNodeDynamicLabels(dynamicRecord);
            }

            nodeRecord.SetLabelField(dynamicPointer(dynamicRecords), dynamicRecords);
            return(nodeRecord);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportNodeWithoutExpectedLabelWhenLabelsAreDynamicBothDirections()
        internal virtual void ShouldReportNodeWithoutExpectedLabelWhenLabelsAreDynamicBothDirections()
        {
            // given
            int nodeId = 42;

            long[] indexLabelIds = new long[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            long[] storeLabelIds = new long[] { 1, 2, 3, 4, 5, 6, 8, 9, 10, 11 };

            RecordAccessStub recordAccess = new RecordAccessStub();
            NodeRecord       node         = inUse(WithDynamicLabels(recordAccess, new NodeRecord(nodeId, false, 0, 0), storeLabelIds));

            Org.Neo4j.Consistency.report.ConsistencyReport_LabelScanConsistencyReport report = mock(typeof(Org.Neo4j.Consistency.report.ConsistencyReport_LabelScanConsistencyReport));

            // when
            CheckerEngine <LabelScanDocument, Org.Neo4j.Consistency.report.ConsistencyReport_LabelScanConsistencyReport> engine = recordAccess.Engine(null, report);

            Checker(indexLabelIds, true).checkReference(null, node, engine, recordAccess);
            recordAccess.CheckDeferred();

            // then
            verify(report).nodeDoesNotHaveExpectedLabel(node, 7);
            verify(report).nodeLabelNotInIndex(node, 11);
        }