From: Tomasz Wrobel Date: Thu, 6 Aug 2020 10:05:00 +0000 (+0200) Subject: Fix maven build issue in truststore-merger X-Git-Tag: 2.0.0~7 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=dea7453051ff7c1e9c8d1dea26f42a318ca9fc2c;p=oom%2Fplatform%2Fcert-service.git Fix maven build issue in truststore-merger -update pom in truststore-merger -update UT -update log messages Issue-ID: DCAEGEN2-2253 Signed-off-by: Tomasz Wrobel Change-Id: I0cc8caf39851344c3a6a868ea6aac1fff6e4183e --- diff --git a/certServiceClient/pom.xml b/certServiceClient/pom.xml index c05ecc46..8c156413 100644 --- a/certServiceClient/pom.xml +++ b/certServiceClient/pom.xml @@ -1,4 +1,17 @@ + diff --git a/pom.xml b/pom.xml index 919ac7b0..5b582f32 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ /content/repositories/snapshots/ /content/repositories/releases/ /content/repositories/staging/ - /content/sites/site/org/onap/oom/cert-service/${project.artifactId}/${project.version} + /content/sites/site/org/onap/oom/platform/cert-service/${project.artifactId}/${project.version} 11 http://localhost:8080/v3/api-docs.yaml diff --git a/trustStoreMerger/pom.xml b/trustStoreMerger/pom.xml index 7f0db366..201365ca 100644 --- a/trustStoreMerger/pom.xml +++ b/trustStoreMerger/pom.xml @@ -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"> - aaf-certservice - org.onap.aaf.certservice + oom-certservice + org.onap.oom.platform.cert-service 1.2.0-SNAPSHOT 4.0.0 diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java index ee57b3aa..3a3b9b6e 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java @@ -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 index 00000000..13c8c726 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ConfigurationEnvs.java @@ -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"; +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java index b7b73e6b..e23a1add 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java @@ -19,14 +19,15 @@ 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 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 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 truststores) { return truststores.stream() - .allMatch(pathValidator::isTruststorePathValid); + .allMatch(pathValidator::isTruststorePathValid); } private boolean validateTruststoresPasswords(List truststoresPasswords) { return truststoresPasswords.stream() - .allMatch(pathValidator::isTruststorePasswordPathValid); + .allMatch(pathValidator::isTruststorePasswordPathValid); } private List splitToList(String stringToSplit) { diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java index eea0551d..fa0b8cde 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java @@ -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 truststores = pathsProvider.getTruststores(); List 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); diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/TrustStoreMergerTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/TrustStoreMergerTest.java index 4787897a..a7c62361 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/TrustStoreMergerTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/TrustStoreMergerTest.java @@ -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); } } diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java index d52d1899..6b017709 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java @@ -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 {