public DeduplicationModel( BacktraceData backtraceData, DeduplicationStrategy strategy) { _backtraceData = backtraceData; _strategy = strategy; }
/// <summary> /// Initialize new instance of Backtrace Database Context /// </summary> /// <param name="settings">Database settings</param> public BacktraceDatabaseContext(BacktraceDatabaseSettings settings) { _retryNumber = checked ((int)settings.RetryLimit); RetryOrder = settings.RetryOrder; DeduplicationStrategy = settings.DeduplicationStrategy; SetupBatch(); }
/// <summary> /// Initialize new instance of Backtrace Database Context /// </summary> /// <param name="settings">Database settings</param> public BacktraceDatabaseContext(BacktraceDatabaseSettings settings) { _path = settings.DatabasePath; _retryNumber = checked ((int)settings.RetryLimit); _attachmentManager = new BacktraceDatabaseAttachmentManager(settings); RetryOrder = settings.RetryOrder; DeduplicationStrategy = settings.DeduplicationStrategy; SetupBatch(); }
/// <summary> /// Initialize new instance of Backtrace Database Context /// </summary> /// <param name="path">Path to database directory</param> /// <param name="retryNumber">Total number of retries</param> /// <param name="retryOrder">Record order</param> /// <param name="deduplicationStrategy"> Deduplication strategy type </param> public BacktraceDatabaseContext( string path, uint retryNumber, RetryOrder retryOrder, DeduplicationStrategy deduplicationStrategy = DeduplicationStrategy.None) { _path = path; _retryNumber = checked ((int)retryNumber); RetryOrder = retryOrder; DeduplicationStrategy = deduplicationStrategy; SetupBatch(); }
public void TestShaComparisionWithMultipleOptions_MultipleOptions_ValidSha(DeduplicationStrategy strategy) { var exception = new Exception("testMessage"); var report = new BacktraceReport(exception); var data = report.ToBacktraceData(null); var deduplicationModel = new DeduplicationModel(data, strategy); var comparer = new DeduplicationModel(data, strategy); var deduplicationSha = deduplicationModel.GetSha(); var comparerSha = comparer.GetSha(); Assert.IsNotEmpty(deduplicationSha); Assert.IsNotEmpty(comparerSha); Assert.AreEqual(deduplicationSha, comparerSha); }
public void TestDeduplicaiton_DifferentExceptions_ShouldGenerateDifferentHashForDifferentRerports(DeduplicationStrategy strategy) { var report1 = new BacktraceReport(new Exception("test")); var report2 = new BacktraceReport(new ArgumentException("argument test")); var deduplicationStrategy1 = new DeduplicationModel(new BacktraceData(report1), strategy); var deduplicationStrategy2 = new DeduplicationModel(new BacktraceData(report2), strategy); var sha1 = deduplicationStrategy1.GetSha(); var sha2 = deduplicationStrategy2.GetSha(); Assert.AreNotEqual(sha1, sha2); }
public void TestDeduplicationStrategy_TestDifferentStrategies_ReportShouldMerge(DeduplicationStrategy deduplicationStrategy) { _database.DeduplicationStrategy = deduplicationStrategy; _database.Clear(); var report = new BacktraceReport(new Exception("Exception Message")); var data = report.ToBacktraceData(null, -1); // validate total number of reports // Count method should return all reports (include reports after deduplicaiton) int totalNumberOfReports = 2; for (int i = 0; i < totalNumberOfReports; i++) { _database.Add(data); } Assert.AreEqual(totalNumberOfReports, _database.Count()); var records = _database.Get(); int expectedNumberOfReports = 1; Assert.AreEqual(expectedNumberOfReports, records.Count()); }
public void TestShaComparisionWithMultipleOptionsAndReports_MultipleOptions_DeduplicationReturnsFingerprint(DeduplicationStrategy strategy) { var fingerprint = "12345"; var exception = new Exception("testMessage"); var report = new BacktraceReport(exception) { Fingerprint = fingerprint }; var data = new BacktraceData(report, null); var deduplicationModel = new DeduplicationModel(data, strategy); var sha = deduplicationModel.GetSha(); Assert.AreEqual(sha, fingerprint); }