summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/setup/src
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2022-03-10 10:39:16 +0100
committerDan Timoney <dtimoney@att.com>2022-03-23 15:08:48 -0400
commiteb2a7c97c0007b013bd1784ac17d57be02b63d03 (patch)
treeb0861438532727219216cfd426e21ae053abb31a /sdnr/wt/data-provider/setup/src
parent3c74361514bb920ed441d105f66ca978bd074ced (diff)
migrate sdnr features to phosphorus
fix mapper and switch to dom api Updated to use phosphorus version of parent poms Issue-ID: CCSDK-3566 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: I98c5bef9286622e0d66b53db687557d798cd53f5 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/setup/src')
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java146
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java23
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java15
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java56
4 files changed, 112 insertions, 128 deletions
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java
index 8a0aeb05e..6148e21d5 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java
@@ -44,95 +44,98 @@ import org.slf4j.LoggerFactory;
public class IstanbulReleaseInformation extends ReleaseInformation {
private final Logger LOG = LoggerFactory.getLogger(IstanbulReleaseInformation.class);
-
+ private static String NORMAL_STRING_MAX_LEN = "1024";
public static final String TIMEZONE_TYPE_FORMAT =
"CHAR(6) DEFAULT NULL CHECK (`%s` regexp '^[+-]\\\\d\\\\d:\\\\d\\\\d$')";
public static final String TABLENAME_CONTROLLER_FORMAT = "controller%s";
public static final String TABLEMAPPING_CONTROLLER =
- "`id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,`desc` VARCHAR(255) CHARACTER SET utf8 ,primary key(id)";
+ "`id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`desc` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,primary key(id)";
private static final String TABLEMAPPING_CONNECTIONLOG_FORMAT = "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`timestamp` DATETIME(3) ,\n"
- + "`status` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`timestamp` DATETIME(3) ,\n"
+ + "`status` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
private static final String TABLEMAPPING_EVENTLOG_FORMAT = "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`source-type` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`object-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`timestamp` DATETIME(3) ,\n" + "`timestamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz")
- + " ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`counter` INTEGER ,\n"
- + "`attribute-name` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`new-value` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_FAULTCURRENT_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`object-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`timestamp` DATETIME(3) ,\n" + "`timestamp-tz` "
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`source-type` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`object-id` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`timestamp` DATETIME(3) ,\n" + "`timestamp-tz` "
+ String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz") + " ,\n"
- + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`counter` INTEGER ,\n"
- + "`severity` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`problem` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_FAULTLOG_FORMAT = "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`source-type` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`object-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`counter` INTEGER ,\n" + "`attribute-name` VARCHAR("
+ + NORMAL_STRING_MAX_LEN + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`new-value` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
+ private static final String TABLEMAPPING_FAULTCURRENT_FORMAT = "`id` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`object-id` VARCHAR(" + NORMAL_STRING_MAX_LEN + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "`timestamp` DATETIME(3) ,\n" + "`timestamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz")
- + " ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`counter` INTEGER ,\n"
- + "`severity` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`problem` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + " ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`counter` INTEGER ,\n"
+ + "`severity` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`problem` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
+ private static final String TABLEMAPPING_FAULTLOG_FORMAT = "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`source-type` VARCHAR("
+ + NORMAL_STRING_MAX_LEN + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`object-id` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`timestamp` DATETIME(3) ,\n" + "`timestamp-tz` "
+ + String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz") + " ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`counter` INTEGER ,\n"
+ + "`severity` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`problem` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
+ private static final String TABLEMAPPING_GUICUTTHROUGH_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`weburi` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_GUICUTTHROUGH_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`name` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`weburi` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ private static final String TABLEMAPPING_HISTORICALPM15M_FORMAT = "`id` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`performance-data` JSON ,\n" + "`granularity-period` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`time-stamp` DATETIME(3) ,\n" + "`time-stamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "time-stamp-tz")
+ + " ,\n" + "`node-name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`uuid-interface` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`layer-protocol-name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`radio-signal-id` VARCHAR("
+ + NORMAL_STRING_MAX_LEN + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`suspect-interval-flag` BOOLEAN ,\n"
+ + "`scanner-id` VARCHAR(" + NORMAL_STRING_MAX_LEN + ") CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_HISTORICALPM15M_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`performance-data` JSON ,\n"
- + "`granularity-period` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`time-stamp` DATETIME(3) ,\n"
+ private static final String TABLEMAPPING_HISTORICALPM24H_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`performance-data` JSON ,\n"
+ + "`granularity-period` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`time-stamp` DATETIME(3) ,\n"
+ "`time-stamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "time-stamp-tz") + " ,\n"
- + "`node-name` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`uuid-interface` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`layer-protocol-name` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`radio-signal-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`suspect-interval-flag` BOOLEAN ,\n"
- + "`scanner-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + "`node-name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`uuid-interface` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`layer-protocol-name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`radio-signal-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`suspect-interval-flag` BOOLEAN ,\n"
+ + "`scanner-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_HISTORICALPM24H_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`performance-data` JSON ,\n"
- + "`granularity-period` VARCHAR(100) CHARACTER SET utf8 ,\n" + "`time-stamp` DATETIME(3) ,\n"
- + "`time-stamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "time-stamp-tz") + " ,\n"
- + "`node-name` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`uuid-interface` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`layer-protocol-name` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`radio-signal-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`suspect-interval-flag` BOOLEAN ,\n"
- + "`scanner-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ private static final String TABLEMAPPING_INVENTORY_FORMAT = "`id` VARCHAR(" + NORMAL_STRING_MAX_LEN
+ + ") CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`version` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`type-name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`date` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`description` VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`uuid` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`part-type-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`model-identifier` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`manufacturer-identifier` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`tree-level` BIGINT ,\n"
+ + "`parent-uuid` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`contained-holder` JSON ,\n"
+ + "`serial` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`manufacturer-name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_INVENTORY_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`version` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`type-name` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`date` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`description` VARCHAR(1024) CHARACTER SET utf8 ,\n"
- + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`uuid` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`part-type-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`model-identifier` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`manufacturer-identifier` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`tree-level` BIGINT ,\n"
- + "`parent-uuid` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`contained-holder` JSON ,\n"
- + "`serial` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`manufacturer-name` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_MAINTENANCE_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`active` BOOLEAN ,\n"
- + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`description` VARCHAR(1024) CHARACTER SET utf8 ,\n"
- + "`problem` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`start` DATETIME(3) ,\n" + "`start-tz` "
+ private static final String TABLEMAPPING_MAINTENANCE_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n" + "`active` BOOLEAN ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`description` VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`problem` VARCHAR("+NORMAL_STRING_MAX_LEN+") CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`start` DATETIME(3) ,\n" + "`start-tz` "
+ String.format(TIMEZONE_TYPE_FORMAT, "start-tz") + " ,\n" + "`end` DATETIME(3) ,\n" + "`end-tz` "
+ String.format(TIMEZONE_TYPE_FORMAT, "end-tz") + " ,\n"
- + "`object-id-ref` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + "`object-id-ref` VARCHAR("+NORMAL_STRING_MAX_LEN+") CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
private static final String TABLEMAPPING_MEDIATORSERVER_FORMAT =
- "`id` int(11) NOT NULL AUTO_INCREMENT,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`name` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`url` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ "`id` int(11) NOT NULL AUTO_INCREMENT,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`url` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_NETWORKELEMENT_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`password` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`host` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`port` BIGINT ,\n" + "`status` VARCHAR(100) CHARACTER SET utf8 ,\n"
- + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`username` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`is-required` BOOLEAN ,\n" + "`core-model-capability` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`device-type` VARCHAR(100) CHARACTER SET utf8 ,\n"
- + "`device-function` VARCHAR(512) CHARACTER SET utf8 ,\n" + "`node-details` JSON ,\n"
- + "`tls-key` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`mount-method` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
- private static final String TABLEMAPPING_USERDATA_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
- + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`value` JSON ,\n"
+ private static final String TABLEMAPPING_NETWORKELEMENT_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`password` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`host` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`port` BIGINT ,\n" + "`status` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`username` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`is-required` BOOLEAN ,\n" + "`core-model-capability` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`device-type` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`device-function` VARCHAR(512) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`node-details` JSON ,\n"
+ + "`tls-key` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`mount-method` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
+ private static final String TABLEMAPPING_USERDATA_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`value` JSON ,\n"
+ + "primary key(id)";
public IstanbulReleaseInformation() {
@@ -176,9 +179,8 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
+ "\"device-function\": {\"type\": \"keyword\"},\"is-required\": {\"type\": \"boolean\"},"
+ "\"status\": {\"type\": \"keyword\"},\"tls-key\": {\"type\": \"keyword\"},"
+ "\"mount-method\": {\"type\":\"keyword\"}}",
- "{\"index\":{\"max_result_window\": 20000,\"number_of_shards\":%d,\"number_of_replicas\":%d},"
- +"\"analysis\":{\"analyzer\":{\"content\":{\"type\":\"custom\",\"tokenizer\":\"whitespace\"}}}}"
- ));
+ "{\"index\":{\"max_result_window\": 20000,\"number_of_shards\":%d,\"number_of_replicas\":%d},"
+ + "\"analysis\":{\"analyzer\":{\"content\":{\"type\":\"custom\",\"tokenizer\":\"whitespace\"}}}}"));
return map;
}
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java
index 03033edad..cf369925c 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java
@@ -49,17 +49,18 @@ public class JakartaReleaseInformation extends ReleaseInformation {
private static final String TIMEZONE_TYPE_FORMAT = IstanbulReleaseInformation.TIMEZONE_TYPE_FORMAT;
private final Logger LOG = LoggerFactory.getLogger(JakartaReleaseInformation.class);
- private static final String TABLEMAPPING_CMLOG_FORMAT =
- "`id` int(11) NOT NULL AUTO_INCREMENT,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
- + "`source-type` VARCHAR(100) CHARACTER SET utf8 ,\n"
- + "`object-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`timestamp` DATETIME(3) ,\n"
- + "`timestamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz")
- + " ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`counter` INTEGER ,\n"
- + "`notification-type` VARCHAR(100) CHARACTER SET utf8 ,\n"
- + "`notification-id` VARCHAR(40) CHARACTER SET utf8 ,\n"
- + "`source-indicator` VARCHAR(100) CHARACTER SET utf8 ,\n"
- + "`path` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`operation` VARCHAR(100) CHARACTER SET utf8 ,\n"
- + "`value` VARCHAR(255) CHARACTER SET utf8 ,\n" + "primary key(id)";
+ private static final String TABLEMAPPING_CMLOG_FORMAT = "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
+ + "`controller-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
+ + "`source-type` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`object-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`timestamp` DATETIME(3) ,\n" + "`timestamp-tz` "
+ + String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz") + " ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`counter` INTEGER ,\n"
+ + "`notification-type` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`notification-id` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`source-indicator` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`path` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "`operation` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin ,\n"
+ + "`value` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin ,\n" + "primary key(id),foreign key(`controller-id`) "
+ + "references `controller%s`(id) ";
public JakartaReleaseInformation() {
super(Release.JAKARTA_R1, createDBMap(), createMariaDBMap());
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
index 6fd4a40a4..a2a1fcdec 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
@@ -163,21 +163,18 @@ public class MariaDBTestBase {
}
public static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex) {
+ return createTable(dbService, cls, entity, autoIndex, true);
+ }
+ public static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex,
+ boolean withControllerId) {
String createStatement = null;
try {
- createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex);
+ createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex,withControllerId);
} catch (UnableToMapClassException e) {
fail(e.getMessage());
}
System.out.println(createStatement);
- try {
- return dbService.write(createStatement);
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-
- }
- return false;
+ return dbService.createTable(createStatement);
}
public String getDBUrl() {
return envDefaultValues.get("SDNRDBURL");
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java
index f39f9b088..ef8998875 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java
@@ -24,10 +24,10 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup;
import static org.junit.Assert.fail;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.lang.reflect.InvocationTargetException;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
-import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -63,12 +63,12 @@ import ch.vorburger.exec.ManagedProcessException;
public class TestMariaDBMapper {
- private static final String MARIADB_USERNAME = "sdnrdb";
- private static final String MARIADB_PASSWORD = "sdnrdb";
- // private static final String MARIADB_HOST = "10.20.11.159";
- private static final String MARIADB_HOST = "sdnrdb";
- private static final int MARIADB_PORT = 3306;
- private static final String MARIADB_DATABASENAME = "sdnrdb";
+// private static final String MARIADB_USERNAME = "sdnrdb";
+// private static final String MARIADB_PASSWORD = "sdnrdb";
+// private static final String MARIADB_HOST = "10.20.11.159";
+// private static final String MARIADB_HOST = "sdnrdb";
+// private static final int MARIADB_PORT = 3306;
+// private static final String MARIADB_DATABASENAME = "sdnrdb";
// private static DbLibService dbService;
@@ -137,7 +137,6 @@ public class TestMariaDBMapper {
writeEntry(builder.build(), Entity.NetworkelementConnection);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| JsonProcessingException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -152,16 +151,19 @@ public class TestMariaDBMapper {
private <T extends DataObject> List<T> readEntry(Entity entity, Class<T> clazz, String id) {
final SelectQuery selectStatement = new SelectQuery(entity.getName());
System.out.println(selectStatement);
+ List<T> list = null;
try {
- return SqlDBMapper.read(dbProvider.getDBService().read(selectStatement.toSql()), clazz);
+ ResultSet data = dbProvider.getDBService().read(selectStatement.toSql());
+ list = SqlDBMapper.read(data, clazz);
+ try { data.close(); } catch (SQLException ignore) { }
+
} catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
- return null;
+ return list;
}
private <T extends DataObject> boolean writeEntry(T data, Entity entity) throws IllegalAccessException,
@@ -173,7 +175,6 @@ public class TestMariaDBMapper {
return dbProvider.getDBService().write(insertStatement.toSql());
} catch (SQLException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -188,41 +189,24 @@ public class TestMariaDBMapper {
try {
return dbService.write(createStatement);
} catch (SQLException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
- private static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex) {
+ public static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex) {
+ return createTable(dbService, cls, entity, autoIndex, true);
+ }
+ public static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex,
+ boolean withControllerId) {
String createStatement = null;
try {
- createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex);
+ createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex,withControllerId);
} catch (UnableToMapClassException e) {
fail(e.getMessage());
}
System.out.println(createStatement);
- try {
- return dbService.write(createStatement);
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-
- }
- return false;
- }
-
- private static Properties getConfig() {
- Properties config = new Properties();
- config.setProperty("org.onap.ccsdk.sli.dbtype", "jdbc");
- config.setProperty("org.onap.ccsdk.sli.jdbc.hosts", MARIADB_HOST);
- config.setProperty("org.onap.ccsdk.sli.jdbc.url",
- String.format("jdbc:mysql://dbhost:%d/%s", MARIADB_PORT, MARIADB_DATABASENAME));
- config.setProperty("org.onap.ccsdk.sli.jdbc.driver", "org.mariadb.jdbc.Driver");
- config.setProperty("org.onap.ccsdk.sli.jdbc.database", MARIADB_DATABASENAME);
- config.setProperty("org.onap.ccsdk.sli.jdbc.user", MARIADB_USERNAME);
- config.setProperty("org.onap.ccsdk.sli.jdbc.password", MARIADB_PASSWORD);
- return config;
+ return dbService.createTable(createStatement);
}
}