summaryrefslogtreecommitdiffstats
path: root/sql-resource/provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sql-resource/provider/src/test')
-rw-r--r--sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java19
-rw-r--r--sql-resource/provider/src/test/resources/svclogic.properties31
2 files changed, 32 insertions, 18 deletions
diff --git a/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java
index f0ab60379..e66034ba8 100644
--- a/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java
+++ b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,8 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import ch.vorburger.mariadb4j.DB;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import junit.framework.TestCase;
public class ITCaseSqlResource extends TestCase {
@@ -40,7 +42,7 @@ public class ITCaseSqlResource extends TestCase {
.getLogger(ITCaseSqlResource.class);
- public void testExists() {
+ public void testExists() throws Exception {
Properties props = new Properties();
@@ -57,6 +59,17 @@ public class ITCaseSqlResource extends TestCase {
fail("Could not initialize properties");
}
+
+ // Start MariaDB4j database
+ DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder();
+ config.setPort(0); // 0 => autom. detect free port
+ DB db = DB.newEmbeddedDB(config.build());
+ db.start();
+
+ // Override jdbc URL and database name
+ props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test");
+ props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test"));
+
// Add properties to global properties
Enumeration propNames = props.keys();
diff --git a/sql-resource/provider/src/test/resources/svclogic.properties b/sql-resource/provider/src/test/resources/svclogic.properties
index 69c8e2487..6504e1aec 100644
--- a/sql-resource/provider/src/test/resources/svclogic.properties
+++ b/sql-resource/provider/src/test/resources/svclogic.properties
@@ -8,9 +8,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,17 +18,18 @@
# limitations under the License.
# ============LICENSE_END=========================================================
###
+org.onap.ccsdk.sli.dbtype=jdbc
-org.onap.ccsdk.sli.adaptors.dbtype=jdbc
-org.onap.ccsdk.sli.adaptors.jdbc.hosts=localhost
-org.onap.ccsdk.sli.adaptors.jdbc.url=jdbc:mysql://DBHOST:3306/sdnctl
-org.onap.ccsdk.sli.adaptors.jdbc.database=sdnctl
-org.onap.ccsdk.sli.adaptors.jdbc.user=sdnctl
-org.onap.ccsdk.sli.adaptors.jdbc.password=gamma
-org.onap.ccsdk.sli.adaptors.jdbc.connection.name=sdnctldb01
-
-org.onap.ccsdk.sli.adaptors.jdbc.connection.timeout=50
-org.onap.ccsdk.sli.adaptors.jdbc.request.timeout=100
-org.onap.ccsdk.sli.adaptors.jdbc.limit.init=10
-org.onap.ccsdk.sli.adaptors.jdbc.limit.min=10
-org.onap.ccsdk.sli.adaptors.jdbc.limit.max=20
+org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01
+org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl
+org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver
+org.onap.ccsdk.sli.jdbc.database=sdnctl
+org.onap.ccsdk.sli.jdbc.user=sdnctl
+org.onap.ccsdk.sli.jdbc.password=gamma
+org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01
+org.onap.ccsdk.sli.jdbc.connection.timeout=50
+org.onap.ccsdk.sli.jdbc.request.timeout=100
+org.onap.ccsdk.sli.jdbc.limit.init=10
+org.onap.ccsdk.sli.jdbc.limit.min=10
+org.onap.ccsdk.sli.jdbc.limit.max=20
+org.onap.dblib.connection.recovery=false