diff options
author | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2020-08-06 12:05:00 +0200 |
---|---|---|
committer | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2020-08-06 13:40:26 +0200 |
commit | dea7453051ff7c1e9c8d1dea26f42a318ca9fc2c (patch) | |
tree | e98511a0af3d9c3f492ce2c033acb239d2740245 | |
parent | ddf360bd400fdbb1485b7e507ec53ffa9cb882ba (diff) |
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 <tomasz.wrobel@nokia.com>
Change-Id: I0cc8caf39851344c3a6a868ea6aac1fff6e4183e
9 files changed, 88 insertions, 21 deletions
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 @@ <?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"> @@ -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> 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"> <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> 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<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) { 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<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); 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 { |