private void CheckProperty(NodeRecord record, CheckerEngine <NodeRecord, Org.Neo4j.Consistency.report.ConsistencyReport_NodeConsistencyReport> engine, ICollection <PropertyRecord> props) { if (!Record.NO_NEXT_PROPERTY.@is(record.NextProp)) { PropertyRecord firstProp = props.GetEnumerator().next(); if (!Record.NO_PREVIOUS_PROPERTY.@is(firstProp.PrevProp)) { engine.Report().propertyNotFirstInChain(firstProp); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableIntSet keys = new org.eclipse.collections.impl.set.mutable.primitive.IntHashSet(); MutableIntSet keys = new IntHashSet(); foreach (PropertyRecord property in props) { if (!property.InUse()) { engine.Report().propertyNotInUse(property); } else { foreach (int key in ChainCheck.keys(property)) { if (!keys.add(key)) { engine.Report().propertyKeyNotUniqueInChain(); } } } } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReportDuplicatePropertyIndexesAcrossRecordsInPropertyChainForNode() internal virtual void ShouldReportDuplicatePropertyIndexesAcrossRecordsInPropertyChainForNode() { // given ChainCheck check = new ChainCheck(); RecordAccessStub records = new RecordAccessStub(); RelationshipRecord master = records.Add(inUse(new RelationshipRecord(1, 2, 3, 4))); master.NextProp = 1; PropertyRecord firstRecord = inUse(new PropertyRecord(1)); firstRecord.NextProp = 12; PropertyBlock firstBlock = new PropertyBlock(); firstBlock.SingleBlock = 1; firstBlock.KeyIndexId = 1; PropertyBlock secondBlock = new PropertyBlock(); secondBlock.SingleBlock = 1; secondBlock.KeyIndexId = 2; PropertyRecord secondRecord = inUse(new PropertyRecord(12)); secondRecord.PrevProp = 1; PropertyBlock thirdBlock = new PropertyBlock(); thirdBlock.SingleBlock = 1; thirdBlock.KeyIndexId = 4; PropertyBlock fourthBlock = new PropertyBlock(); fourthBlock.SingleBlock = 1; fourthBlock.KeyIndexId = 1; firstRecord.AddPropertyBlock(firstBlock); firstRecord.AddPropertyBlock(secondBlock); secondRecord.AddPropertyBlock(thirdBlock); secondRecord.AddPropertyBlock(fourthBlock); records.Add(firstRecord); records.Add(secondRecord); // when Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport report = mock(typeof(Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport)); CheckerEngine <RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> checkEngine = records.Engine(master, report); check.checkReference(master, firstRecord, checkEngine, records); records.CheckDeferred(); // then verify(report).propertyKeyNotUniqueInChain(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReportDuplicatePropertyIndexesInPropertyRecordForNode() internal virtual void ShouldReportDuplicatePropertyIndexesInPropertyRecordForNode() { // given ChainCheck check = new ChainCheck(); RecordAccessStub records = new RecordAccessStub(); NodeRecord master = records.Add(inUse(new NodeRecord(1, false, -1, 1))); PropertyRecord propertyRecord = inUse(new PropertyRecord(1)); PropertyBlock firstBlock = new PropertyBlock(); firstBlock.SingleBlock = 1; firstBlock.KeyIndexId = 1; PropertyBlock secondBlock = new PropertyBlock(); secondBlock.SingleBlock = 1; secondBlock.KeyIndexId = 2; PropertyBlock thirdBlock = new PropertyBlock(); thirdBlock.SingleBlock = 1; thirdBlock.KeyIndexId = 1; propertyRecord.AddPropertyBlock(firstBlock); propertyRecord.AddPropertyBlock(secondBlock); propertyRecord.AddPropertyBlock(thirdBlock); records.Add(propertyRecord); // when Org.Neo4j.Consistency.report.ConsistencyReport_NodeConsistencyReport report = mock(typeof(Org.Neo4j.Consistency.report.ConsistencyReport_NodeConsistencyReport)); CheckerEngine <NodeRecord, Org.Neo4j.Consistency.report.ConsistencyReport_NodeConsistencyReport> checkEngine = records.Engine(master, report); check.checkReference(master, propertyRecord, checkEngine, records); // then verify(report).propertyKeyNotUniqueInChain(); }
public override void Process(NodeRecord nodeRecord) { _reporter.forNode(nodeRecord, _nodeIndexCheck); Org.Neo4j.Consistency.checking.cache.CacheAccess_Client client = _cacheAccess.client(); using (MandatoryProperties.Check <NodeRecord, ConsistencyReport_NodeConsistencyReport> mandatoryCheck = _mandatoryProperties.apply(nodeRecord)) { IEnumerable <PropertyRecord> properties = client.PropertiesFromCache; // We do this null-check here because even if nodeIndexCheck should provide the properties for us, // or an empty list at least, it may fail in one way or another and exception be caught by // broad exception handler in reporter. The caught exception will produce an ERROR so it will not // go by unnoticed. if (properties != null) { foreach (PropertyRecord property in properties) { _reporter.forProperty(property, _propertyCheck); mandatoryCheck.Receive(ChainCheck.keys(property)); } } } }