//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldIncludeStackTraceInUnexpectedCheckException() public virtual void ShouldIncludeStackTraceInUnexpectedCheckException() { // GIVEN ConsistencySummaryStatistics summary = mock(typeof(ConsistencySummaryStatistics)); RecordAccess records = mock(typeof(RecordAccess)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<String> loggedError = new java.util.concurrent.atomic.AtomicReference<>(); AtomicReference <string> loggedError = new AtomicReference <string>(); InconsistencyLogger logger = new InconsistencyLoggerAnonymousInnerClass(this, loggedError); InconsistencyReport inconsistencyReport = new InconsistencyReport(logger, summary); ConsistencyReporter reporter = new ConsistencyReporter(records, inconsistencyReport); NodeRecord node = new NodeRecord(10); RecordCheck <NodeRecord, ConsistencyReport_NodeConsistencyReport> checker = mock(typeof(RecordCheck)); Exception exception = new Exception("My specific exception"); doThrow(exception).when(checker).check(any(typeof(NodeRecord)), any(typeof(CheckerEngine)), any(typeof(RecordAccess))); // WHEN reporter.ForNode(node, checker); // THEN assertNotNull(loggedError.get()); string error = loggedError.get(); assertThat(error, containsString("at ")); assertThat(error, containsString(TestName.MethodName)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private org.neo4j.consistency.checking.RecordCheck mockChecker() internal virtual RecordCheck MockChecker() { RecordCheck checker = mock(typeof(RecordCheck)); doAnswer(this).when(checker).check(any(typeof(AbstractBaseRecord)), any(typeof(CheckerEngine)), any(typeof(RecordAccess))); return(checker); }
public PropertyAndNode2LabelIndexProcessor(ConsistencyReporter reporter, IndexAccessors indexes, PropertyReader propertyReader, CacheAccess cacheAccess, System.Func <NodeRecord, MandatoryProperties.Check <NodeRecord, ConsistencyReport_NodeConsistencyReport> > mandatoryProperties) { this._reporter = reporter; this._cacheAccess = cacheAccess; this._mandatoryProperties = mandatoryProperties; this._nodeIndexCheck = new PropertyAndNodeIndexedCheck(indexes, propertyReader, cacheAccess); this._propertyCheck = new PropertyRecordCheck(); }
public virtual void ReDecorateNode(CheckDecorator decorator, NodeRecordCheck newChecker, bool sparseNode) { if (sparseNode) { this._sparseNodeChecker = decorator.DecorateNodeChecker(newChecker); } else { this._denseNodeChecker = decorator.DecorateNodeChecker(newChecker); } }
public AbstractStoreProcessor(CheckDecorator decorator) { this._sparseNodeChecker = decorator.DecorateNodeChecker(NodeRecordCheck.ForSparseNodes()); this._denseNodeChecker = decorator.DecorateNodeChecker(NodeRecordCheck.ForDenseNodes()); this._relationshipChecker = decorator.DecorateRelationshipChecker(new RelationshipRecordCheck()); this._propertyChecker = decorator.DecoratePropertyChecker(new PropertyRecordCheck()); this._propertyKeyTokenChecker = decorator.DecoratePropertyKeyTokenChecker(new PropertyKeyTokenRecordCheck()); this._relationshipTypeTokenChecker = decorator.DecorateRelationshipTypeTokenChecker(new RelationshipTypeTokenRecordCheck()); this._labelTokenChecker = decorator.DecorateLabelTokenChecker(new LabelTokenRecordCheck()); this._relationshipGroupChecker = decorator.DecorateRelationshipGroupChecker(new RelationshipGroupRecordCheck()); }
protected internal abstract void CheckLabelToken(RecordStore <LabelTokenRecord> store, LabelTokenRecord record, RecordCheck <LabelTokenRecord, ConsistencyReport_LabelTokenConsistencyReport> checker);
protected internal abstract void CheckRelationshipTypeToken(RecordStore <RelationshipTypeTokenRecord> store, RelationshipTypeTokenRecord record, RecordCheck <RelationshipTypeTokenRecord, ConsistencyReport_RelationshipTypeConsistencyReport> checker);
protected internal abstract void CheckProperty(RecordStore <PropertyRecord> store, PropertyRecord property, RecordCheck <PropertyRecord, ConsistencyReport_PropertyConsistencyReport> checker);
public override void ForPropertyKey(PropertyKeyTokenRecord key, RecordCheck <PropertyKeyTokenRecord, ConsistencyReport_PropertyKeyTokenConsistencyReport> checker) { Dispatch(RecordType.PROPERTY_KEY, _propertyKeyReport, key, checker); }
public override RecordCheck <RelationshipGroupRecord, ConsistencyReport_RelationshipGroupConsistencyReport> DecorateRelationshipGroupChecker(RecordCheck <RelationshipGroupRecord, ConsistencyReport_RelationshipGroupConsistencyReport> checker) { return(Logging(checker)); }
public override RecordCheck <RelationshipTypeTokenRecord, ConsistencyReport_RelationshipTypeConsistencyReport> DecorateRelationshipTypeTokenChecker(RecordCheck <RelationshipTypeTokenRecord, ConsistencyReport_RelationshipTypeConsistencyReport> checker) { return(Logging(checker)); }
internal virtual OwningRecordCheck <REC, REP> Logging <REC, REP>(RecordCheck <REC, REP> checker) where REC : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord where REP : Org.Neo4j.Consistency.report.ConsistencyReport { return(new LoggingChecker <REC, REP>(checker, Log)); }
protected internal abstract void CheckDynamicLabel(RecordType type, RecordStore <DynamicRecord> store, DynamicRecord @string, RecordCheck <DynamicRecord, Org.Neo4j.Consistency.report.ConsistencyReport_DynamicLabelConsistencyReport> checker);
private void Dispatch <RECORD, REPORT>(RecordType type, ProxyFactory <REPORT> factory, RECORD record, RecordCheck <RECORD, REPORT> checker) where RECORD : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord where REPORT : ConsistencyReport { ReportInvocationHandler <RECORD, REPORT> handler = new ReportHandler <RECORD, REPORT>(_report, factory, type, _records, record, _monitor); try { checker.Check(record, handler, _records); } catch (Exception e) { // This is a rare event and exposing the stack trace is a good idea, otherwise we // can only see that something went wrong, not at all what. handler.ReportConflict.error(type, record, "Failed to check record: " + stringify(e), new object[0]); } handler.UpdateSummary(); }
public override void ForNodeLabelScan(LabelScanDocument document, RecordCheck <LabelScanDocument, ConsistencyReport_LabelScanConsistencyReport> checker) { Dispatch(RecordType.LABEL_SCAN_DOCUMENT, _labelScanReport, document, checker); }
public override void ForCounts(CountsEntry countsEntry, RecordCheck <CountsEntry, ConsistencyReport_CountsConsistencyReport> checker) { Dispatch(RecordType.COUNTS, _countsReport, countsEntry, checker); }
public override void ForRelationshipGroup(RelationshipGroupRecord record, RecordCheck <RelationshipGroupRecord, ConsistencyReport_RelationshipGroupConsistencyReport> checker) { Dispatch(RecordType.RELATIONSHIP_GROUP, _relationshipGroupReport, record, checker); }
public override void ForDynamicLabelBlock(RecordType type, DynamicRecord record, RecordCheck <DynamicRecord, ConsistencyReport_DynamicLabelConsistencyReport> checker) { Dispatch(type, _dynamicLabelReport, record, checker); }
protected internal abstract void CheckPropertyKeyToken(RecordStore <PropertyKeyTokenRecord> store, PropertyKeyTokenRecord record, RecordCheck <PropertyKeyTokenRecord, ConsistencyReport_PropertyKeyTokenConsistencyReport> checker);
public virtual void ReDecorateRelationship(CheckDecorator decorator, RelationshipRecordCheck newChecker) { this._relationshipChecker = decorator.DecorateRelationshipChecker(newChecker); }
public static DataSet populate(DataSet ds, IDataReader rs, int beginRow, int endRow, string dbCharset, ArrayList fieldText, bool type_forward_only, bool isEncoding, RecordCheck oRecordCheck) { bool flag; if (rs == null) { return(null); } if (beginRow > 0) { for (int j = 0; j < beginRow; j++) { rs.Read(); } } DataTable schemaTable = rs.GetSchemaTable(); if (ds == null) { ds = new DataSet(); } for (int i = 0; i < schemaTable.Rows.Count; i++) { if ((fieldText != null) && (fieldText.Count > i)) { ds.addColumn((string)fieldText[i]); } else { ds.addColumn(Convert.ToString(schemaTable.Rows[(i + 1) - 1]["ColumnName"])); } } int num2 = beginRow; if (!(flag = dbCharset == null)) { flag = "GBK".ToUpper().Equals(dbCharset.ToUpper()); } if (!flag) { flag = !isEncoding; } oRecordCheck.init(rs); while (rs.Read()) { if ((endRow > 0) && (num2 > endRow)) { return(ds); } if (oRecordCheck.isRecordCanShow(SQLTool.getStr(rs, rs.FieldCount - 1))) { Row row = ds.addRow(); for (int k = 1; k <= ds.ColumnCount; k++) { object data = rs.GetValue(k - 1); if (data == DBNull.Value) { data = null; } if (((data != null) && (data is string)) && !flag) { try { data = Encoding.GetEncoding("GBK").GetString(Encoding.GetEncoding(dbCharset).GetBytes((string)data)); } catch (Exception exception) { throw new ReportError(new StringBuilder("数据编码:").Append(dbCharset).Append(" 不正确,请检查数据源的数据编码配置").ToString().ToString(), exception); } } row.setData(k, data); } } num2++; } return(ds); }
public override void ForLabelName(LabelTokenRecord label, RecordCheck <LabelTokenRecord, ConsistencyReport_LabelTokenConsistencyReport> checker) { Dispatch(RecordType.LABEL, _labelKeyReport, label, checker); }
public override RecordCheck <PropertyKeyTokenRecord, ConsistencyReport_PropertyKeyTokenConsistencyReport> DecoratePropertyKeyTokenChecker(RecordCheck <PropertyKeyTokenRecord, ConsistencyReport_PropertyKeyTokenConsistencyReport> checker) { return(Logging(checker)); }
public override void ForRelationshipTypeName(RelationshipTypeTokenRecord relationshipTypeTokenRecord, RecordCheck <RelationshipTypeTokenRecord, ConsistencyReport_RelationshipTypeConsistencyReport> checker) { Dispatch(RecordType.RELATIONSHIP_TYPE, _relationshipTypeReport, relationshipTypeTokenRecord, checker); }
public override RecordCheck <LabelTokenRecord, ConsistencyReport_LabelTokenConsistencyReport> DecorateLabelTokenChecker(RecordCheck <LabelTokenRecord, ConsistencyReport_LabelTokenConsistencyReport> checker) { return(Logging(checker)); }
protected internal abstract void CheckRelationship(RecordStore <RelationshipRecord> store, RelationshipRecord rel, RecordCheck <RelationshipRecord, ConsistencyReport_RelationshipConsistencyReport> checker);
internal LoggingChecker(RecordCheck <REC, REP> checker, InvocationLog log) { this.Checker = checker; this.Log = log; }
public override void ForIndexEntry(IndexEntry entry, RecordCheck <IndexEntry, ConsistencyReport_IndexConsistencyReport> checker) { Dispatch(RecordType.INDEX, _index, entry, checker); }
protected internal abstract void CheckNode(RecordStore <NodeRecord> store, NodeRecord node, RecordCheck <NodeRecord, ConsistencyReport_NodeConsistencyReport> checker);
public override void ForProperty(PropertyRecord property, RecordCheck <PropertyRecord, ConsistencyReport_PropertyConsistencyReport> checker) { Dispatch(RecordType.PROPERTY, _propertyReport, property, checker); }