feat(datasync): add GIW connection type to DbQuerySource
Add support for "giw" connection type in DbQuerySource to enable the StatusCode pipeline to query from the GIW Oracle database.
This commit is contained in:
@@ -12,7 +12,7 @@ public class DbQuerySource : IImportSource
|
||||
{
|
||||
private static readonly HashSet<string> ValidConnectionTypes = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"jde", "cms", "lotfinder"
|
||||
"jde", "cms", "lotfinder", "giw"
|
||||
};
|
||||
|
||||
private readonly IDbConnectionFactory _connectionFactory;
|
||||
@@ -48,7 +48,7 @@ public class DbQuerySource : IImportSource
|
||||
|
||||
if (!ValidConnectionTypes.Contains(connectionType))
|
||||
{
|
||||
throw new ArgumentException($"Unknown connection type: {connectionType}. Valid types are: jde, cms, lotfinder.", nameof(connectionType));
|
||||
throw new ArgumentException($"Unknown connection type: {connectionType}. Valid types are: jde, cms, lotfinder, giw.", nameof(connectionType));
|
||||
}
|
||||
|
||||
_connectionFactory = connectionFactory;
|
||||
@@ -77,6 +77,7 @@ public class DbQuerySource : IImportSource
|
||||
{
|
||||
"jde" => await _connectionFactory.CreateJdeConnectionAsync(cancellationToken),
|
||||
"cms" => await _connectionFactory.CreateCmsConnectionAsync(cancellationToken),
|
||||
"giw" => await _connectionFactory.CreateGiwConnectionAsync(cancellationToken),
|
||||
"lotfinder" => await _connectionFactory.CreateLotFinderConnectionAsync(cancellationToken),
|
||||
_ => throw new InvalidOperationException($"Unknown connection type: {_connectionType}")
|
||||
};
|
||||
|
||||
@@ -81,4 +81,15 @@ public class DbQuerySourceTests
|
||||
var source = new DbQuerySource(factory, "jde", "SELECT 1", commandTimeout: 7200);
|
||||
source.SourceName.ShouldBe("DbQuery:jde");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WithGiwConnectionType_DoesNotThrow()
|
||||
{
|
||||
// Arrange
|
||||
var connectionFactory = Substitute.For<IDbConnectionFactory>();
|
||||
|
||||
// Act & Assert - should not throw
|
||||
var source = new DbQuerySource(connectionFactory, "giw", "SELECT 1", null);
|
||||
source.SourceName.ShouldBe("DbQuery:giw");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user