Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Diagnostic improvements and bulk insert time config setting (#4049) * Add exception logging to DomainEvents * Add NServiceBus reference * Add debug logging to EndpointInstanceMonitor * Add configurable bulk insert timeout --------- Co-authored-by: WilliamBZA <WilliamBZA@users.noreply.github.com> * Remove audit queue validation checks (#4048) * Fix small validation bugs (#4046) * Allow propogation of propertychange events * Prevent event bubbling * Switch back to invalid file chars * Add notify propogation tests * Add file path sanitization tests --------- Co-authored-by: Mike Minutillo <mike.minutillo@particular.net> * Fix test for primary instance convention default Original commit is here 84f61ec * RavenDb License refresh --------- Co-authored-by: Szymon Pobiega <szymon.pobiega@gmail.com> Co-authored-by: WilliamBZA <WilliamBZA@users.noreply.github.com> Co-authored-by: John Simons <john.simons@particular.net>
- Loading branch information
1 parent
bb8de64
commit 8ea38bb
Showing
20 changed files
with
311 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
src/ServiceControl.Config.Tests/AddInstance/AddErrorInstance/PathNotifyPropertyChanges.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
namespace ServiceControl.Config.Tests.AddInstance.AddErrorInstance | ||
{ | ||
using NUnit.Framework; | ||
using ServiceControl.Config.UI.InstanceAdd; | ||
|
||
public class PathNotifyPropertyChangesTests | ||
{ | ||
public ServiceControlAddViewModel Given_adding_error_instance() | ||
{ | ||
var viewModel = new ServiceControlAddViewModel(); | ||
|
||
return viewModel; | ||
} | ||
|
||
[Test] | ||
public void ChangesTo_ErrorSharedServiceControlEditorViewModel_DbPath_Notifies_ServiceControlAddViewModel_DbPath() | ||
{ | ||
var viewModel = Given_adding_error_instance(); | ||
|
||
var propertyNotified = false; | ||
viewModel.PropertyChanged += (s, e) => | ||
{ | ||
if (e.PropertyName == nameof(viewModel.ErrorDatabasePath)) | ||
{ | ||
propertyNotified = true; | ||
} | ||
}; | ||
|
||
viewModel.ServiceControl.DatabasePath = "NewValue"; | ||
|
||
Assert.IsTrue(propertyNotified, "Changes to DatabasePath did not notify ServiceControlAddViewModel"); | ||
} | ||
|
||
[Test] | ||
public void ChangesTo_ErrorSharedServiceControlEditorViewModel_LogPath_Notifies_ServiceControlAddViewModel_LogPath() | ||
{ | ||
var viewModel = Given_adding_error_instance(); | ||
|
||
var propertyNotified = false; | ||
viewModel.PropertyChanged += (s, e) => | ||
{ | ||
if (e.PropertyName == nameof(viewModel.ErrorLogPath)) | ||
{ | ||
propertyNotified = true; | ||
} | ||
}; | ||
|
||
viewModel.ServiceControl.LogPath = "NewValue"; | ||
|
||
Assert.IsTrue(propertyNotified, "Changes to LogPath did not notify ServiceControlAddViewModel"); | ||
} | ||
|
||
[Test] | ||
public void ChangesTo_ErrorSharedServiceControlEditorViewModel_DestinationPath_Notifies_ServiceControlAddViewModel_DestinationPath() | ||
{ | ||
var viewModel = Given_adding_error_instance(); | ||
|
||
var propertyNotified = false; | ||
viewModel.PropertyChanged += (s, e) => | ||
{ | ||
if (e.PropertyName == nameof(viewModel.ErrorDestinationPath)) | ||
{ | ||
propertyNotified = true; | ||
} | ||
}; | ||
|
||
viewModel.ServiceControl.DestinationPath = "NewValue"; | ||
|
||
Assert.IsTrue(propertyNotified, "Changes to DestinationPath did not notify ServiceControlAddViewModel"); | ||
} | ||
|
||
[Test] | ||
public void ChangesTo_AuditSharedServiceControlEditorViewModel_DbPath_Notifies_ServiceControlAddViewModel_DbPath() | ||
{ | ||
var viewModel = Given_adding_error_instance(); | ||
|
||
var propertyNotified = false; | ||
viewModel.PropertyChanged += (s, e) => | ||
{ | ||
if (e.PropertyName == nameof(viewModel.AuditDatabasePath)) | ||
{ | ||
propertyNotified = true; | ||
} | ||
}; | ||
|
||
viewModel.ServiceControlAudit.DatabasePath = "NewValue"; | ||
|
||
Assert.IsTrue(propertyNotified, "Changes to DatabasePath did not notify ServiceControlAddViewModel"); | ||
} | ||
|
||
[Test] | ||
public void ChangesTo_AuditSharedServiceControlEditorViewModel_LogPath_Notifies_ServiceControlAddViewModel_LogPath() | ||
{ | ||
var viewModel = Given_adding_error_instance(); | ||
|
||
var propertyNotified = false; | ||
viewModel.PropertyChanged += (s, e) => | ||
{ | ||
if (e.PropertyName == nameof(viewModel.AuditLogPath)) | ||
{ | ||
propertyNotified = true; | ||
} | ||
}; | ||
|
||
viewModel.ServiceControlAudit.LogPath = "NewValue"; | ||
|
||
Assert.IsTrue(propertyNotified, "Changes to LogPath did not notify ServiceControlAddViewModel"); | ||
} | ||
|
||
[Test] | ||
public void ChangesTo_AuditSharedServiceControlEditorViewModel_DestinationPath_Notifies_ServiceControlAddViewModel_DestinationPath() | ||
{ | ||
var viewModel = Given_adding_error_instance(); | ||
|
||
var propertyNotified = false; | ||
viewModel.PropertyChanged += (s, e) => | ||
{ | ||
if (e.PropertyName == nameof(viewModel.AuditDestinationPath)) | ||
{ | ||
propertyNotified = true; | ||
} | ||
}; | ||
|
||
viewModel.ServiceControlAudit.DestinationPath = "NewValue"; | ||
|
||
Assert.IsTrue(propertyNotified, "Changes to DestinationPath did not notify ServiceControlAddViewModel"); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/ServiceControl.Config.Tests/FilePathExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace ServiceControl.Config.Tests | ||
{ | ||
using NUnit.Framework; | ||
using ServiceControl.Config.Extensions; | ||
|
||
class FilePathExtensionsTests | ||
{ | ||
[TestCase(null)] | ||
[TestCase(@"C:\")] | ||
[TestCase(@"C:")] | ||
[TestCase(@"C:\foo\bar")] | ||
//[TestCase(@"/foo/bar", @"\foo\bar")] // NOTE: Returns \foobar | ||
[TestCase(@"C:\foo\bar", @"C:\foo\bar")] | ||
[TestCase(@"\\foo\bar", @"\foo\bar")] | ||
[TestCase(@"C:\foo\bar\", @"C:\foo\bar\")] | ||
[TestCase(@"C:\foo:bar", @"C:\foobar")] | ||
[TestCase(@"C:\foo|bar", @"C:\foobar")] | ||
public void TestSanitization(string original, string sanitized = null) | ||
{ | ||
var converted = FilePathExtensions.SanitizeFilePath(original); | ||
|
||
Assert.That(converted, Is.EqualTo(sanitized ?? original)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.