-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from followynne/perf/testcontainers-impl
tests(data-providers): integration tests
- Loading branch information
Showing
72 changed files
with
2,487 additions
and
513 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
90 changes: 45 additions & 45 deletions
90
src/Serilog.Ui.ElasticSearchProvider/Extensions/SerilogUiOptionBuilderExtensions.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 |
---|---|---|
@@ -1,46 +1,46 @@ | ||
using Elasticsearch.Net; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Nest; | ||
using Serilog.Ui.Core; | ||
using System; | ||
|
||
namespace Serilog.Ui.ElasticSearchProvider | ||
{ | ||
/// <summary> | ||
/// ElasticSearch data provider specific extension methods for <see cref="SerilogUiOptionsBuilder"/>. | ||
/// </summary> | ||
public static class SerilogUiOptionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SerilogUi to connect to a MongoDB database. | ||
/// </summary> | ||
/// <param name="optionsBuilder"> The options builder. </param> | ||
/// <param name="endpoint"> The url of ElasticSearch server. </param> | ||
/// <param name="indexName"> Name of the log index. </param> | ||
/// <exception cref="ArgumentNullException"> throw if endpoint is null </exception> | ||
/// <exception cref="ArgumentNullException"> throw is indexName is null </exception> | ||
public static void UseElasticSearchDb(this SerilogUiOptionsBuilder optionsBuilder, Uri endpoint, string indexName) | ||
{ | ||
if (endpoint == null) | ||
throw new ArgumentNullException(nameof(endpoint)); | ||
|
||
if (string.IsNullOrEmpty(indexName)) | ||
throw new ArgumentNullException(nameof(indexName)); | ||
|
||
var options = new ElasticSearchDbOptions | ||
{ | ||
IndexName = indexName | ||
}; | ||
|
||
var builder = ((ISerilogUiOptionsBuilder)optionsBuilder); | ||
|
||
builder.Services.AddSingleton(options); | ||
|
||
var pool = new SingleNodeConnectionPool(endpoint); | ||
var connectionSettings = new ConnectionSettings(pool, sourceSerializer: (builtin, values) => new VanillaSerializer()); | ||
|
||
builder.Services.AddSingleton<IElasticClient>(o => new ElasticClient(connectionSettings)); | ||
builder.Services.AddScoped<IDataProvider, ElasticSearchDbDataProvider>(); | ||
} | ||
} | ||
using Elasticsearch.Net; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Nest; | ||
using Serilog.Ui.Core; | ||
using System; | ||
|
||
namespace Serilog.Ui.ElasticSearchProvider | ||
{ | ||
/// <summary> | ||
/// ElasticSearch data provider specific extension methods for <see cref="SerilogUiOptionsBuilder"/>. | ||
/// </summary> | ||
public static class SerilogUiOptionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SerilogUi to connect to a MongoDB database. | ||
/// </summary> | ||
/// <param name="optionsBuilder"> The options builder. </param> | ||
/// <param name="endpoint"> The url of ElasticSearch server. </param> | ||
/// <param name="indexName"> Name of the log index. </param> | ||
/// <exception cref="ArgumentNullException"> throw if endpoint is null </exception> | ||
/// <exception cref="ArgumentNullException"> throw is indexName is null </exception> | ||
public static void UseElasticSearchDb(this SerilogUiOptionsBuilder optionsBuilder, Uri endpoint, string indexName) | ||
{ | ||
if (endpoint == null) | ||
throw new ArgumentNullException(nameof(endpoint)); | ||
|
||
if (string.IsNullOrWhiteSpace(indexName)) | ||
throw new ArgumentNullException(nameof(indexName)); | ||
|
||
var options = new ElasticSearchDbOptions | ||
{ | ||
IndexName = indexName | ||
}; | ||
|
||
var builder = ((ISerilogUiOptionsBuilder)optionsBuilder); | ||
|
||
builder.Services.AddSingleton(options); | ||
|
||
var pool = new SingleNodeConnectionPool(endpoint); | ||
var connectionSettings = new ConnectionSettings(pool, sourceSerializer: (builtin, values) => new VanillaSerializer()); | ||
|
||
builder.Services.AddSingleton<IElasticClient>(o => new ElasticClient(connectionSettings)); | ||
builder.Services.AddScoped<IDataProvider, ElasticSearchDbDataProvider>(); | ||
} | ||
} | ||
} |
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
92 changes: 46 additions & 46 deletions
92
src/Serilog.Ui.MsSqlServerProvider/Extensions/SerilogUiOptionBuilderExtensions.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 |
---|---|---|
@@ -1,47 +1,47 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Serilog.Ui.Core; | ||
using System; | ||
|
||
namespace Serilog.Ui.MsSqlServerProvider | ||
{ | ||
/// <summary> | ||
/// SQL Server data provider specific extension methods for <see cref="SerilogUiOptionsBuilder"/>. | ||
/// </summary> | ||
public static class SerilogUiOptionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SerilogUi to connect to a SQL Server database. | ||
/// </summary> | ||
/// <param name="optionsBuilder"> The options builder. </param> | ||
/// <param name="connectionString"> The connection string. </param> | ||
/// <param name="tableName"> Name of the table. </param> | ||
/// <param name="schemaName"> | ||
/// Name of the table schema. default value is <c> dbo </c> | ||
/// </param> | ||
/// <exception cref="ArgumentNullException"> throw if connectionString is null </exception> | ||
/// <exception cref="ArgumentNullException"> throw is tableName is null </exception> | ||
public static void UseSqlServer( | ||
this SerilogUiOptionsBuilder optionsBuilder, | ||
string connectionString, | ||
string tableName, | ||
string schemaName = "dbo" | ||
) | ||
{ | ||
if (string.IsNullOrEmpty(connectionString)) | ||
throw new ArgumentNullException(nameof(connectionString)); | ||
|
||
if (string.IsNullOrEmpty(tableName)) | ||
throw new ArgumentNullException(nameof(tableName)); | ||
|
||
var relationProvider = new RelationalDbOptions | ||
{ | ||
ConnectionString = connectionString, | ||
TableName = tableName, | ||
Schema = schemaName | ||
}; | ||
|
||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddSingleton(relationProvider); | ||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddScoped<IDataProvider, SqlServerDataProvider>(); | ||
} | ||
} | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Serilog.Ui.Core; | ||
using System; | ||
|
||
namespace Serilog.Ui.MsSqlServerProvider | ||
{ | ||
/// <summary> | ||
/// SQL Server data provider specific extension methods for <see cref="SerilogUiOptionsBuilder"/>. | ||
/// </summary> | ||
public static class SerilogUiOptionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SerilogUi to connect to a SQL Server database. | ||
/// </summary> | ||
/// <param name="optionsBuilder"> The options builder. </param> | ||
/// <param name="connectionString"> The connection string. </param> | ||
/// <param name="tableName"> Name of the table. </param> | ||
/// <param name="schemaName"> | ||
/// Name of the table schema. default value is <c> dbo </c> | ||
/// </param> | ||
/// <exception cref="ArgumentNullException"> throw if connectionString is null </exception> | ||
/// <exception cref="ArgumentNullException"> throw is tableName is null </exception> | ||
public static void UseSqlServer( | ||
this SerilogUiOptionsBuilder optionsBuilder, | ||
string connectionString, | ||
string tableName, | ||
string schemaName = "dbo" | ||
) | ||
{ | ||
if (string.IsNullOrWhiteSpace(connectionString)) | ||
throw new ArgumentNullException(nameof(connectionString)); | ||
|
||
if (string.IsNullOrWhiteSpace(tableName)) | ||
throw new ArgumentNullException(nameof(tableName)); | ||
|
||
var relationProvider = new RelationalDbOptions | ||
{ | ||
ConnectionString = connectionString, | ||
TableName = tableName, | ||
Schema = !string.IsNullOrWhiteSpace(schemaName) ? schemaName : "dbo" | ||
}; | ||
|
||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddSingleton(relationProvider); | ||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddScoped<IDataProvider, SqlServerDataProvider>(); | ||
} | ||
} | ||
} |
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
82 changes: 41 additions & 41 deletions
82
src/Serilog.Ui.MySqlProvider/Extensions/SerilogUiOptionBuilderExtensions.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 |
---|---|---|
@@ -1,42 +1,42 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Serilog.Ui.Core; | ||
using System; | ||
|
||
namespace Serilog.Ui.MySqlProvider | ||
{ | ||
/// <summary> | ||
/// MySQL data provider specific extension methods for <see cref="SerilogUiOptionsBuilder"/>. | ||
/// </summary> | ||
public static class SerilogUiOptionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SerilogUi to connect to a MySQL database. | ||
/// </summary> | ||
/// <param name="optionsBuilder"> The options builder. </param> | ||
/// <param name="connectionString"> The connection string. </param> | ||
/// <param name="tableName"> Name of the table. </param> | ||
/// <exception cref="ArgumentNullException"> throw if connectionString is null </exception> | ||
/// <exception cref="ArgumentNullException"> throw is tableName is null </exception> | ||
public static void UseMySqlServer( | ||
this SerilogUiOptionsBuilder optionsBuilder, | ||
string connectionString, | ||
string tableName | ||
) | ||
{ | ||
if (string.IsNullOrEmpty(connectionString)) | ||
throw new ArgumentNullException(nameof(connectionString)); | ||
|
||
if (string.IsNullOrEmpty(tableName)) | ||
throw new ArgumentNullException(nameof(tableName)); | ||
|
||
var relationProvider = new RelationalDbOptions | ||
{ | ||
ConnectionString = connectionString, | ||
TableName = tableName | ||
}; | ||
|
||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddSingleton(relationProvider); | ||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddScoped<IDataProvider, MySqlDataProvider>(); | ||
} | ||
} | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Serilog.Ui.Core; | ||
using System; | ||
|
||
namespace Serilog.Ui.MySqlProvider | ||
{ | ||
/// <summary> | ||
/// MySQL data provider specific extension methods for <see cref="SerilogUiOptionsBuilder"/>. | ||
/// </summary> | ||
public static class SerilogUiOptionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SerilogUi to connect to a MySQL database. | ||
/// </summary> | ||
/// <param name="optionsBuilder"> The options builder. </param> | ||
/// <param name="connectionString"> The connection string. </param> | ||
/// <param name="tableName"> Name of the table. </param> | ||
/// <exception cref="ArgumentNullException"> throw if connectionString is null </exception> | ||
/// <exception cref="ArgumentNullException"> throw is tableName is null </exception> | ||
public static void UseMySqlServer( | ||
this SerilogUiOptionsBuilder optionsBuilder, | ||
string connectionString, | ||
string tableName | ||
) | ||
{ | ||
if (string.IsNullOrWhiteSpace(connectionString)) | ||
throw new ArgumentNullException(nameof(connectionString)); | ||
|
||
if (string.IsNullOrWhiteSpace(tableName)) | ||
throw new ArgumentNullException(nameof(tableName)); | ||
|
||
var relationProvider = new RelationalDbOptions | ||
{ | ||
ConnectionString = connectionString, | ||
TableName = tableName | ||
}; | ||
|
||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddSingleton(relationProvider); | ||
((ISerilogUiOptionsBuilder)optionsBuilder).Services.AddScoped<IDataProvider, MySqlDataProvider>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.