diff options
author | Timoney, Dan (dt5972) <dt5972@att.com> | 2018-03-24 19:11:10 -0400 |
---|---|---|
committer | Timoney, Dan (dt5972) <dt5972@att.com> | 2018-03-27 14:58:43 -0400 |
commit | a0ab49e6c1ea41af18656d6e9efb3377051f2528 (patch) | |
tree | dc935417ffa4aac764aef2f1978c1ceecd68bd55 /dblib | |
parent | 5e0f12e215d579b2adff145a8527cc6a225d8db9 (diff) |
Add unit tests for sli
Added unit tests for ccsdk/sli/core/sli
Change-Id: I0d2408c43b9e56a78f3e01e87985aedb6cad5953
Issue-ID: CCSDK-213
Signed-off-by: Timoney, Dan (dt5972) <dt5972@att.com>
Diffstat (limited to 'dblib')
-rwxr-xr-x | dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java index 02cce3cf1..97380f58d 100755 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java @@ -342,11 +342,16 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito } protected boolean testConnection(boolean errorLevel) { + + String testQuery = "SELECT @@global.read_only, @@global.hostname"; + if (isDerby) { + testQuery = "SELECT 'false', 'localhost' FROM SYSIBM.SYSDUMMY1"; + } ResultSet rs = null; try (Connection conn = this.getConnection(); Statement stmt = conn.createStatement()) { Boolean readOnly; String hostname; - rs = stmt.executeQuery("SELECT @@global.read_only, @@global.hostname"); // ("SELECT 1 FROM DUAL"); //"select + rs = stmt.executeQuery(testQuery); // ("SELECT 1 FROM DUAL"); //"select // BANNER from SYS.V_$VERSION" while (rs.next()) { readOnly = rs.getBoolean(1); |