Added uguid to exceptioninstance

pull/6/head
kay.one 13 years ago
parent 245e122c61
commit 969c36912d

@ -33,6 +33,7 @@ namespace NzbDrone.Services.Service.Controllers
ExceptionHash = existingExceptionReport.Hash, ExceptionHash = existingExceptionReport.Hash,
IsProduction = existingExceptionReport.IsProduction, IsProduction = existingExceptionReport.IsProduction,
LogMessage = existingExceptionReport.LogMessage, LogMessage = existingExceptionReport.LogMessage,
UGuid = existingExceptionReport.UGuid,
Timestamp = DateTime.Now Timestamp = DateTime.Now
}; };
@ -64,7 +65,8 @@ namespace NzbDrone.Services.Service.Controllers
ExceptionHash = exceptionHash, ExceptionHash = exceptionHash,
IsProduction = exceptionReport.IsProduction, IsProduction = exceptionReport.IsProduction,
LogMessage = exceptionReport.LogMessage, LogMessage = exceptionReport.LogMessage,
Timestamp = DateTime.Now Timestamp = DateTime.Now,
UGuid = exceptionReport.UGuid
}; };
_database.Insert(exceptionInstance); _database.Insert(exceptionInstance);

@ -14,6 +14,7 @@ namespace NzbDrone.Services.Service.Migrations
new Column("ExceptionHash", DbType.String, ColumnProperty.NotNull), new Column("ExceptionHash", DbType.String, ColumnProperty.NotNull),
new Column("LogMessage", DbType.String, 3000, ColumnProperty.NotNull), new Column("LogMessage", DbType.String, 3000, ColumnProperty.NotNull),
MigrationsHelper.TimestampColumn, MigrationsHelper.TimestampColumn,
MigrationsHelper.UGuidColumn,
MigrationsHelper.ProductionColumn); MigrationsHelper.ProductionColumn);
Database.AddTable("Exceptions", new Column("Hash", DbType.String, ColumnProperty.Unique), Database.AddTable("Exceptions", new Column("Hash", DbType.String, ColumnProperty.Unique),

@ -12,5 +12,6 @@ namespace NzbDrone.Services.Service.Repository.Reporting
public string LogMessage { get; set; } public string LogMessage { get; set; }
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
public bool IsProduction { get; set; } public bool IsProduction { get; set; }
public Guid UGuid { get; set; }
} }
} }

@ -53,13 +53,21 @@ namespace NzbDrone.Services.Tests.ExceptionControllerTests
WithRealDb(); WithRealDb();
var existing = CreateExceptionReport(); var existing = CreateExceptionReport();
Db.Insert(Builder<ExceptionDetail>.CreateNew().With(c => c.Hash = existing.Hash).Build()); Db.Insert(Builder<ExceptionDetail>.CreateNew().With(c => c.Hash = existing.Hash).Build());
Controller.ReportExisting(CreateExceptionReport()); Controller.ReportExisting(existing);
Db.Fetch<ExceptionDetail>().Should().HaveCount(1); Db.Fetch<ExceptionDetail>().Should().HaveCount(1);
Db.Fetch<ExceptionInstance>().Should().HaveCount(1); var exceptionInstance = Db.Fetch<ExceptionInstance>();
exceptionInstance.Should().HaveCount(1);
exceptionInstance.Single().Id.Should().BeGreaterThan(0);
exceptionInstance.Single().ExceptionHash.Should().NotBeBlank();
exceptionInstance.Single().IsProduction.Should().Be(existing.IsProduction);
exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now);
exceptionInstance.Single().LogMessage.Should().Be(existing.LogMessage);
exceptionInstance.Single().UGuid.Should().Be(existing.UGuid);
} }
} }

@ -92,6 +92,7 @@ namespace NzbDrone.Services.Tests.ExceptionControllerTests
exceptionInstance.Single().IsProduction.Should().Be(exceptionReport.IsProduction); exceptionInstance.Single().IsProduction.Should().Be(exceptionReport.IsProduction);
exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now); exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now);
exceptionInstance.Single().LogMessage.Should().Be(exceptionReport.LogMessage); exceptionInstance.Single().LogMessage.Should().Be(exceptionReport.LogMessage);
exceptionInstance.Single().UGuid.Should().Be(exceptionReport.UGuid);
} }
[Test] [Test]

Loading…
Cancel
Save