adapt ES version to 7.9.x

add new ES mapping for honolulu

Issue-ID: SDNC-1411
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Change-Id: I477f87cd5b6da564663b6677e3cd94afef4dd1a6
diff --git a/sdnr/wt/data-provider/setup/pom.xml b/sdnr/wt/data-provider/setup/pom.xml
index 3a1b597..865d557 100644
--- a/sdnr/wt/data-provider/setup/pom.xml
+++ b/sdnr/wt/data-provider/setup/pom.xml
@@ -87,7 +87,7 @@
                     <clusterName>testCluster</clusterName>
                     <transportPort>49504</transportPort>
                     <httpPort>${databaseport}</httpPort>
-                    <version>7.6.1</version>
+                    <version>7.9.3</version>
                 </configuration>
                 <executions>
                     <execution>
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java
index 9b7a493..913313b 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java
@@ -34,6 +34,7 @@
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformation;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformationR2;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.guilin.GuilinReleaseInformation;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.honolulu.HonoluluReleaseInformation;
 
 public abstract class ReleaseInformation {
 
@@ -142,6 +143,8 @@
                 return new FrankfurtReleaseInformationR2();
             case GUILIN_R1:
                 return new GuilinReleaseInformation();
+            case HONOLULU_R1:
+                return new HonoluluReleaseInformation();
             default:
                 return null;
         }
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java
index ab3f311..c3974b9 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java
@@ -25,9 +25,10 @@
 
     CONNECTIONLOG("connectionlog"), EVENTLOG("eventlog"), FAULTLOG("faultlog"), FAULTCURRENT(
             "faultcurrent"), HISTORICAL_PERFORMANCE_15M("historicalperformance15m"), HISTORICAL_PERFORMANCE_24H(
-                    "historicalperformance24h"), INVENTORY("inventory"), INVENTORYTOPLEVEL(
-                            "inventorytoplevel"), MAINTENANCE("maintenance"), MEDIATOR_SERVER(
-                                    "mediator-server"), REQUIRED_NETWORKELEMENT("required-networkelement");
+                    "historicalperformance24h"), INVENTORY(
+                            "inventory"), INVENTORYTOPLEVEL("inventorytoplevel"), MAINTENANCE(
+                                    "maintenance"), MEDIATOR_SERVER("mediator-server"), REQUIRED_NETWORKELEMENT(
+                                            "required-networkelement"), GUICUTTHROUGH("guicutthrough");
 
     private final String value;
 
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java
index 4f55f4c..9b67bd4 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java
@@ -29,20 +29,26 @@
     EL_ALTO("el alto", "_v1", new EsVersion(2, 2, 0), new EsVersion(2, 2, 0)),
     FRANKFURT_R1("frankfurt-R1", "-v2", new EsVersion(6, 4, 3), new EsVersion(6, 8, 6)),
     FRANKFURT_R2("frankfurt-R2", "-v3", new EsVersion(7, 0, 1), new EsVersion(7, 6, 1)),
-    GUILIN_R1("guilin-R1", "-v4", new EsVersion(7,1,1), new EsVersion(7,6,1));
+    GUILIN_R1("guilin-R1", "-v4", new EsVersion(7,1,1), new EsVersion(7,6,1)),
+	HONOLULU_R1("honolulu-R1", "-v5", new EsVersion(7,1,1), new EsVersion(8,0,0), false);
 
-    public static final Release CURRENT_RELEASE = Release.GUILIN_R1;
+    public static final Release CURRENT_RELEASE = Release.HONOLULU_R1;
 
     private final String value;
     private final String dbSuffix;
     private final EsVersion minDbVersion;
     private final EsVersion maxDbVersion;
+    private final boolean includeEndVersion;
 
-    private Release(String s, String dbsuffix, EsVersion minDbVersion, EsVersion maxDbVersion) {
+	private Release(String s, String dbsuffix, EsVersion minDbVersion, EsVersion maxDbVersion) {
+		this(s, dbsuffix, minDbVersion, maxDbVersion, true);
+	}
+    private Release(String s, String dbsuffix, EsVersion minDbVersion, EsVersion maxDbVersion, boolean includeEnd) {
         this.value = s;
         this.dbSuffix = dbsuffix;
         this.minDbVersion = minDbVersion;
         this.maxDbVersion = maxDbVersion;
+        this.includeEndVersion = includeEnd;
     }
 
     @Override
@@ -83,25 +89,20 @@
         return null;
     }
 
-    /**
-     * @return
-     */
     public String getDBSuffix() {
         return this.dbSuffix;
     }
 
-    /**
-     * @return
-     */
     public EsVersion getDBVersion() {
         return this.minDbVersion;
     }
 
-    /**
-     * @param dbVersion2
-     * @return
-     */
     public boolean isDbInRange(EsVersion dbVersion) {
-        return dbVersion.isNewerOrEqualThan(minDbVersion) && dbVersion.isOlderOrEqualThan(maxDbVersion);
+        if(this.includeEndVersion) {
+            return dbVersion.isNewerOrEqualThan(minDbVersion) && dbVersion.isOlderOrEqualThan(maxDbVersion);
+        }
+        else {
+            return dbVersion.isNewerOrEqualThan(minDbVersion) && dbVersion.isOlderThan(maxDbVersion);
+        }
     }
 }
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
index 993d026..6d2da90 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
@@ -31,9 +31,9 @@
  */
 public enum ReleaseGroup {
 
-    EL_ALTO(Release.EL_ALTO), FRANKFURT(Release.FRANKFURT_R1, Release.FRANKFURT_R2), GUILIN(Release.GUILIN_R1);
+    EL_ALTO(Release.EL_ALTO), FRANKFURT(Release.FRANKFURT_R1, Release.FRANKFURT_R2), GUILIN(Release.GUILIN_R1), HONOLULU(Release.HONOLULU_R1);
 
-    public static final ReleaseGroup CURRENT_RELEASE = GUILIN;
+    public static final ReleaseGroup CURRENT_RELEASE = HONOLULU;
 
     private final List<Release> releases;
 
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java
new file mode 100644
index 0000000..255a031
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java
@@ -0,0 +1,79 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.honolulu;
+
+import java.io.IOException;
+import java.util.Map;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.ClusterSettingsRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.ClusterSettingsResponse;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.ReleaseInformation;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DatabaseInfo;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DatabaseInfo7;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.KeepDataSearchHitConverter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformationR2;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HonoluluReleaseInformation extends ReleaseInformation {
+
+    private final Logger LOG = LoggerFactory.getLogger(HonoluluReleaseInformation.class);
+    public HonoluluReleaseInformation() {
+        super(Release.HONOLULU_R1,createDBMap());
+
+    }
+
+    private static Map<ComponentName, DatabaseInfo> createDBMap() {
+        Map<ComponentName, DatabaseInfo> map= FrankfurtReleaseInformationR2.createDBMap();
+        map.put(ComponentName.GUICUTTHROUGH, new DatabaseInfo7("guicutthrough", "guicutthrough",
+                "{\"name\": {\"type\": \"keyword\"},\"weburi\": {\"type\": \"keyword\"}}"));
+        return map;
+    }
+
+    @Override
+    public SearchHitConverter getConverter(Release dst, ComponentName comp) {
+        if (dst == Release.HONOLULU_R1) {
+            return new KeepDataSearchHitConverter(comp);
+        }
+        return null;
+    }
+
+    @Override
+    protected boolean runPreInitCommands(HtDatabaseClient dbClient) {
+        ClusterSettingsResponse response = null;
+        try {
+            response = dbClient.setupClusterSettings(new ClusterSettingsRequest(false).maxCompilationsPerMinute(400));
+        } catch (IOException e) {
+            LOG.warn("problem setting up cluster: {}", e);
+        }
+        return response == null ? false : response.isAcknowledged();
+    }
+
+    @Override
+    protected boolean runPostInitCommands(HtDatabaseClient dbClient) {
+        return true;
+    }
+
+}