Fix maven build issue in truststore-merger 79/110979/3
authorTomasz Wrobel <tomasz.wrobel@nokia.com>
Thu, 6 Aug 2020 10:05:00 +0000 (12:05 +0200)
committerTomasz Wrobel <tomasz.wrobel@nokia.com>
Thu, 6 Aug 2020 11:40:26 +0000 (13:40 +0200)
-update pom in truststore-merger
-update UT
-update log messages

Issue-ID: DCAEGEN2-2253
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: I0cc8caf39851344c3a6a868ea6aac1fff6e4183e

certServiceClient/pom.xml
pom.xml
trustStoreMerger/pom.xml
trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java
trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ConfigurationEnvs.java [new file with mode: 0644]
trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java
trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java
trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/TrustStoreMergerTest.java
trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java

index c05ecc4..8c15641 100644 (file)
@@ -1,4 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+    ================================================================================
+       Copyright (c) 2020 Nokia. 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=========================================================
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
diff --git a/pom.xml b/pom.xml
index 919ac7b..5b582f3 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
         <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
         <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
         <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
-        <sitePath>/content/sites/site/org/onap/oom/cert-service/${project.artifactId}/${project.version}</sitePath>
+        <sitePath>/content/sites/site/org/onap/oom/platform/cert-service/${project.artifactId}/${project.version}</sitePath>
         <java.version>11</java.version>
         <springdoc-openapi-maven-plugin.apiDocsUrl>http://localhost:8080/v3/api-docs.yaml</springdoc-openapi-maven-plugin.apiDocsUrl>
 
index 7f0db36..201365c 100644 (file)
@@ -3,8 +3,8 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
-        <artifactId>aaf-certservice</artifactId>
-        <groupId>org.onap.aaf.certservice</groupId>
+        <artifactId>oom-certservice</artifactId>
+        <groupId>org.onap.oom.platform.cert-service</groupId>
         <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
index ee57b3a..3a3b9b6 100644 (file)
@@ -24,7 +24,6 @@ import org.onap.oom.truststoremerger.api.ExitableException;
 import org.onap.oom.truststoremerger.certification.file.EnvProvider;
 import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider;
 import org.onap.oom.truststoremerger.configuration.MergerConfiguration;
-import org.onap.oom.truststoremerger.configuration.MergerConfigurationException;
 import org.onap.oom.truststoremerger.configuration.MergerConfigurationFactory;
 import org.onap.oom.truststoremerger.certification.file.PathValidator;
 
diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ConfigurationEnvs.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ConfigurationEnvs.java
new file mode 100644 (file)
index 0000000..13c8c72
--- /dev/null
@@ -0,0 +1,26 @@
+/*============LICENSE_START=======================================================
+ * oom-truststore-merger
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. 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.oom.truststoremerger.api;
+
+public class ConfigurationEnvs {
+
+    public static final String TRUSTSTORES_ENV = "TRUSTSTORES";
+    public static final String TRUSTSTORES_PASSWORDS_ENV = "TRUSTSTORES_PASSWORDS";
+}
index b7b73e6..e23a1ad 100644 (file)
 
 package org.onap.oom.truststoremerger.certification.file;
 
+import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_ENV;
+import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_ENV;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.Predicate;
 
 public class TruststoresPathsProvider {
 
-    static final String TRUSTSTORES_ENV = "TRUSTSTORES";
-    static final String TRUSTSTORES_PASSWORDS_ENV = "TRUSTSTORES_PASSWORDS";
     private static final String DELIMITER = ":";
     private static final int NEGATIVE_SPLIT_LIMIT = -1;
 
@@ -40,27 +41,29 @@ public class TruststoresPathsProvider {
 
     public List<String> getTruststores() throws TruststoresPathsProviderException {
         return envProvider.getEnv(TRUSTSTORES_ENV)
-                .filter(Predicate.not(String::isEmpty))
-                .map(this::splitToList)
-                .filter(this::validateTruststores)
-                .orElseThrow(() -> new TruststoresPathsProviderException("TRUSTSTORES environment variable does not contain valid truststores paths"));
+            .filter(Predicate.not(String::isEmpty))
+            .map(this::splitToList)
+            .filter(this::validateTruststores)
+            .orElseThrow(() -> new TruststoresPathsProviderException(
+                TRUSTSTORES_ENV + " environment variable does not contain valid truststores paths"));
     }
 
     public List<String> getTruststoresPasswords() throws TruststoresPathsProviderException {
         return envProvider.getEnv(TRUSTSTORES_PASSWORDS_ENV)
-                .map(this::splitToList)
-                .filter(this::validateTruststoresPasswords)
-                .orElseThrow(() -> new TruststoresPathsProviderException("TRUSTSTORES_PASSWORDS environment variable does not contain valid passwords paths"));
+            .map(this::splitToList)
+            .filter(this::validateTruststoresPasswords)
+            .orElseThrow(() -> new TruststoresPathsProviderException(
+                TRUSTSTORES_PASSWORDS_ENV + " environment variable does not contain valid passwords paths"));
     }
 
     private boolean validateTruststores(List<String> truststores) {
         return truststores.stream()
-                .allMatch(pathValidator::isTruststorePathValid);
+            .allMatch(pathValidator::isTruststorePathValid);
     }
 
     private boolean validateTruststoresPasswords(List<String> truststoresPasswords) {
         return truststoresPasswords.stream()
-                .allMatch(pathValidator::isTruststorePasswordPathValid);
+            .allMatch(pathValidator::isTruststorePasswordPathValid);
     }
 
     private List<String> splitToList(String stringToSplit) {
index eea0551..fa0b8cd 100644 (file)
@@ -22,6 +22,9 @@ package org.onap.oom.truststoremerger.configuration;
 import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider;
 import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProviderException;
 
+import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_ENV;
+import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_ENV;
+
 import java.util.List;
 
 public class MergerConfigurationFactory {
@@ -32,12 +35,15 @@ public class MergerConfigurationFactory {
         this.pathsProvider = pathsProvider;
     }
 
-    public MergerConfiguration createConfiguration() throws MergerConfigurationException, TruststoresPathsProviderException {
+    public MergerConfiguration createConfiguration()
+        throws MergerConfigurationException, TruststoresPathsProviderException {
         List<String> truststores = pathsProvider.getTruststores();
         List<String> truststoresPasswords = pathsProvider.getTruststoresPasswords();
 
         if (truststores.size() != truststoresPasswords.size()) {
-            throw new MergerConfigurationException("Size of TRUSTSTORES does not match size of TRUSTSTORES_PASSWORDS environment variables");
+            throw new MergerConfigurationException(
+                "Size of " + TRUSTSTORES_ENV
+                    + " does not match size of " + TRUSTSTORES_PASSWORDS_ENV + " environment variables");
         }
 
         return new MergerConfiguration(truststores, truststoresPasswords);
index 4787897..a7c6236 100644 (file)
@@ -34,9 +34,9 @@ class TrustStoreMergerTest {
     AppExitHandler appExitHandler;
 
     @Test
-    void shouldExitWithMergeConfigurationExceptionDueToMissingEnvs() {
+    void shouldExitWithTruststoresPathsProviderExceptionDueToMissingTrustoresPathEnvs() {
         new TrustStoreMerger(appExitHandler).run();
 
-        verify(appExitHandler).exit(ExitStatus.MERGER_CONFIGURATION_EXCEPTION);
+        verify(appExitHandler).exit(ExitStatus.TRUSTSTORES_PATHS_PROVIDER_EXCEPTION);
     }
 }
index d52d189..6b01770 100644 (file)
@@ -1,3 +1,22 @@
+/*============LICENSE_START=======================================================
+ * oom-truststore-merger
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. 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.oom.truststoremerger.certification.file;
 
 import org.junit.jupiter.api.BeforeEach;
@@ -11,8 +30,9 @@ import java.util.Optional;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
 import static org.mockito.Mockito.when;
-import static org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider.TRUSTSTORES_ENV;
-import static org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider.TRUSTSTORES_PASSWORDS_ENV;
+import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_ENV;
+import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_ENV;
+
 
 @ExtendWith(MockitoExtension.class)
 class TruststoresPathsProviderTest {