Beispiel #1
0
        private static string BuildMessage(string message, AbstractBaseRecord record, object[] args)
        {
            StringBuilder builder = JoinLines(message).Append(Environment.NewLine).Append(TAB).Append(record);

            AppendArgs(builder, args);
            return(builder.ToString());
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("ThrowableResultOfMethodCallIgnored") void log(org.neo4j.consistency.report.PendingReferenceCheck<?> check, org.mockito.invocation.InvocationOnMock invocation)
            internal virtual void Log <T1>(PendingReferenceCheck <T1> check, InvocationOnMock invocation)
            {
                System.Reflection.MethodInfo method = invocation.Method;
                if (typeof(object) == method.DeclaringClass && "finalize".Equals(method.Name))
                {
                    /* skip invocations to finalize - they are not of interest to us,
                     * and GC is not predictable enough to reliably trace this. */
                    return;
                }
                StringBuilder entry = (new StringBuilder(method.Name)).Append('(');

                entry.Append(check);
                foreach (object arg in invocation.Arguments)
                {
                    if (arg is AbstractBaseRecord)
                    {
                        AbstractBaseRecord record = ( AbstractBaseRecord )arg;
                        entry.Append(',').Append(record.GetType().Name).Append('[').Append(record.Id).Append(']');
                    }
                }
                string message = entry.Append(')').ToString();

                if (null != Data[message] = new Exception(message))
                {
                    int?cur = Duplicates[message];
                    if (cur == null)
                    {
                        cur = 1;
                    }
                    Duplicates[message] = cur + 1;
                }
            }
Beispiel #3
0
 private static string CommandActionToken(AbstractBaseRecord record)
 {
     if (!record.InUse())
     {
         return("deleted");
     }
     if (record.Created)
     {
         return("created");
     }
     return("updated");
 }
        private void Track <T1>(RecordStore <T1> store, AbstractBaseRecord record)
        {
            long   id     = max(record.Id, record.RequiresSecondaryUnit() ? record.SecondaryUnitId : -1);
            HighId highId = _highIds[store];

            if (highId == null)
            {
                _highIds[store] = new HighId(id);
            }
            else
            {
                highId.Track(id);
            }
        }
Beispiel #5
0
            public override Void Answer(InvocationOnMock invocation)
            {
                object[]           arguments    = invocation.Arguments;
                AbstractBaseRecord oldReference = null;
                AbstractBaseRecord newReference;

                if (arguments.Length == 3)
                {
                    oldReference = ( AbstractBaseRecord )arguments[0];
                    newReference = ( AbstractBaseRecord )arguments[1];
                }
                else
                {
                    newReference = ( AbstractBaseRecord )arguments[0];
                }
                Dispatch.checkReference(Checker, oldReference, newReference);
                return(null);
            }
Beispiel #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void readStore(org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.kernel.impl.store.RecordStore store, long fromId, long toId, java.util.regex.Pattern pattern) throws java.io.IOException
        private static void ReadStore(FileSystemAbstraction fileSystem, RecordStore store, long fromId, long toId, Pattern pattern)
        {
            toId = Math.Min(toId, store.HighId);
            using (StoreChannel channel = fileSystem.Open(store.StorageFile, OpenMode.READ))
            {
                int        recordSize = store.RecordSize;
                ByteBuffer buf        = ByteBuffer.allocate(recordSize);
                for (long i = fromId; i <= toId; i++)
                {
                    buf.clear();
                    long offset = recordSize * i;
                    int  count  = channel.Read(buf, offset);
                    if (count == -1)
                    {
                        break;
                    }
                    sbyte[] bytes = new sbyte[count];
                    buf.clear();
                    buf.get(bytes);
                    string hex           = HexString.encodeHexString(bytes);
                    int    paddingNeeded = (recordSize * 2 - Math.Max(count * 2, 0)) + 1;
                    string format        = "%s %6s 0x%08X %s%" + paddingNeeded + "s%s%n";
                    string str;
                    string use;

                    try
                    {
                        AbstractBaseRecord record = RecordStore.getRecord(store, i, CHECK);
                        use = record.InUse() ? "+" : "-";
                        str = record.ToString();
                    }
                    catch (InvalidRecordException)
                    {
                        str = StringHelper.NewString(bytes, 0, count, "ASCII");
                        use = "?";
                    }

                    if (pattern == null || pattern.matcher(str).find())
                    {
                        _console.printf(format, use, i, offset, hex, " ", str);
                    }
                }
            }
        }
Beispiel #7
0
 public override void Error(RecordType recordType, AbstractBaseRecord record, string message, params object[] args)
 {
     _log.error(BuildMessage(message, record, args));
 }
Beispiel #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @SuppressWarnings("unchecked") void checkDiffReference(org.neo4j.consistency.checking.CheckerEngine engine, org.neo4j.consistency.checking.ComparativeRecordChecker checker, org.neo4j.kernel.impl.store.record.AbstractBaseRecord oldReferenced, org.neo4j.kernel.impl.store.record.AbstractBaseRecord newReferenced, org.neo4j.consistency.store.RecordAccess records)
            internal override void CheckDiffReference(CheckerEngine engine, ComparativeRecordChecker checker, AbstractBaseRecord oldReferenced, AbstractBaseRecord newReferenced, RecordAccess records)
            {
                checker.checkReference(Record, newReferenced, this, records);
            }
Beispiel #9
0
 public ReportHandler(InconsistencyReport report, ProxyFactory <REPORT> factory, RecordType type, RecordAccess records, AbstractBaseRecord record, Monitor monitor) : base(report, factory, type, records, monitor)
 {
     this.Record = record;
 }
Beispiel #10
0
 internal abstract void CheckDiffReference(CheckerEngine engine, ComparativeRecordChecker checker, AbstractBaseRecord oldReferenced, AbstractBaseRecord newReferenced, RecordAccess records);
Beispiel #11
0
 public ReportHandlerAnonymousInnerClass(ConsistencyReporter outerInstance, Org.Neo4j.Consistency.report.InconsistencyReport report, Org.Neo4j.Consistency.report.ConsistencyReporter.ProxyFactory <REPORT> proxyFactory, RecordType recordType, RecordAccess records, AbstractBaseRecord record, Org.Neo4j.Consistency.report.ConsistencyReporter.Monitor monitor) : base(report, proxyFactory, recordType, records, record, monitor)
 {
     this.outerInstance = outerInstance;
 }
Beispiel #12
0
        internal static void DispatchChangeReference(CheckerEngine engine, ComparativeRecordChecker checker, AbstractBaseRecord oldReferenced, AbstractBaseRecord newReferenced, RecordAccess records)
        {
            ReportInvocationHandler handler = ( ReportInvocationHandler )engine;

            handler.checkDiffReference(engine, checker, oldReferenced, newReferenced, records);
            handler.updateSummary();
        }
Beispiel #13
0
 internal abstract void CheckReference(ComparativeRecordChecker checker, AbstractBaseRecord oldReference, AbstractBaseRecord newReference);
 public void error(RecordType recordType, AbstractBaseRecord oldRecord, AbstractBaseRecord newRecord, string message, object[] args)
 {
     assertTrue(_loggedError.compareAndSet(null, message));
 }
Beispiel #15
0
 protected internal virtual string BeforeAndAfterToString(AbstractBaseRecord before, AbstractBaseRecord after)
 {
     return(format(" -%s%n         +%s", before, after));
 }
Beispiel #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @SuppressWarnings("unchecked") void checkReference(org.neo4j.consistency.checking.ComparativeRecordChecker checker, org.neo4j.kernel.impl.store.record.AbstractBaseRecord oldReference, org.neo4j.kernel.impl.store.record.AbstractBaseRecord newReference)
            internal override void checkReference(ComparativeRecordChecker checker, AbstractBaseRecord oldReference, AbstractBaseRecord newReference)
            {
                checker.checkReference(_record, newReference, this, _outerInstance);
            }
Beispiel #17
0
 public EngineAnonymousInnerClass(RecordAccessStub outerInstance, ConsistencyReport report, AbstractBaseRecord record) : base(outerInstance, report)
 {
     this.outerInstance = outerInstance;
     this._record       = record;
 }
 public void warning(RecordType recordType, AbstractBaseRecord oldRecord, AbstractBaseRecord newRecord, string message, object[] args)
 {
 }
Beispiel #19
0
 public override void Warning(RecordType recordType, AbstractBaseRecord oldRecord, AbstractBaseRecord newRecord, string message, params object[] args)
 {
     _log.warn(BuildMessage(message, oldRecord, newRecord, args));
 }