diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-11-04 11:28:16 +0000 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2024-11-04 11:29:27 +0000 |
commit | 687db79756f7119e76fefa3bd5d2fc4f22a8a818 (patch) | |
tree | 39cbd906d3a063c37e543a4cd05777a27ecd07d3 | |
parent | 646881bafcf735aeadac905f0d945c8201b8b1f7 (diff) |
Fix references and organize dependencies in policy-distribution
after splitting policy-endpoints and message-bus in policy-common
Issue-ID: POLICY-5131
Change-Id: I93082f1db411c3f2c55244cca355ecce7f4e4dea
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
11 files changed, 45 insertions, 47 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java index b78031b7..7611669f 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java @@ -1,7 +1,8 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +22,15 @@ package org.onap.policy.distribution.main.parameters; -import java.util.LinkedHashMap; import java.util.Map; import lombok.Getter; import lombok.Setter; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.parameters.ParameterGroupImpl; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.common.parameters.annotations.Size; import org.onap.policy.common.parameters.annotations.Valid; +import org.onap.policy.common.parameters.rest.RestServerParameters; import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters; @@ -53,13 +53,13 @@ public class DistributionParameterGroup extends ParameterGroupImpl { private Map<String, @NotNull @Valid ReceptionHandlerParameters> receptionHandlerParameters; private Map<String, @NotNull @Valid ReceptionHandlerConfigurationParameterGroup> - receptionHandlerConfigurationParameters = new LinkedHashMap<>(); + receptionHandlerConfigurationParameters; private Map<String, @NotNull @Valid PolicyForwarderConfigurationParameterGroup> - policyForwarderConfigurationParameters = new LinkedHashMap<>(); + policyForwarderConfigurationParameters; private Map<String, @NotNull @Valid PolicyDecoderConfigurationParameterGroup> - policyDecoderConfigurationParameters = new LinkedHashMap<>(); + policyDecoderConfigurationParameters; // @formatter:on /** diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java index e9e4b04e..ac6c6428 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java +++ b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java @@ -1,7 +1,8 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2023 Bell Canada. All rights reserved. + * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2023 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +32,7 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; -import org.onap.policy.common.endpoints.report.HealthCheckReport; +import org.onap.policy.common.utils.report.HealthCheckReport; /** * Class to provide distribution REST services. diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java b/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java index e4ebffef..96763cab 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java +++ b/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,8 +22,8 @@ package org.onap.policy.distribution.main.rest; -import org.onap.policy.common.endpoints.report.HealthCheckReport; import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.common.utils.report.HealthCheckReport; import org.onap.policy.distribution.main.startstop.DistributionActivator; /** diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java index 57fa97d1..744c7a0a 100644 --- a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java +++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.HashMap; import java.util.Map; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.common.parameters.rest.RestServerParameters; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -77,7 +77,7 @@ public class CommonTestData { public static final String CONFIG_FILE = "src/test/resources/parameters/TestConfigParams.json"; - private Coder coder = new StandardCoder(); + private final Coder coder = new StandardCoder(); /** * Makes a parameter configuration file by substituting an available port number within a @@ -153,11 +153,10 @@ public class CommonTestData { * @return the receptionHandlerParameters object */ public Map<String, ReceptionHandlerParameters> getReceptionHandlerParameters(final boolean isEmpty) { - final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = - new HashMap<String, ReceptionHandlerParameters>(); + final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = new HashMap<>(); if (!isEmpty) { - final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders(isEmpty); - final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(isEmpty); + final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders(false); + final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(false); final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders); final ReceptionHandlerParameters rhParameters = new ReceptionHandlerParameters(RECEPTION_HANDLER_TYPE, RECEPTION_HANDLER_CLASS_NAME, RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); @@ -175,7 +174,7 @@ public class CommonTestData { public Map<String, ReceptionHandlerConfigurationParameterGroup> getReceptionHandlerConfigurationParameters( final boolean isEmpty) { final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters = - new HashMap<String, ReceptionHandlerConfigurationParameterGroup>(); + new HashMap<>(); if (!isEmpty) { final DummyReceptionHandlerParameterGroup dummyReceptionHandlerParameterGroup = new DummyReceptionHandlerParameterGroup(); @@ -197,9 +196,7 @@ public class CommonTestData { public PluginHandlerParameters getPluginHandlerParameters(final boolean isEmpty) { final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders(isEmpty); final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(isEmpty); - final PluginHandlerParameters pluginHandlerParameters = - new PluginHandlerParameters(policyDecoders, policyForwarders); - return pluginHandlerParameters; + return new PluginHandlerParameters(policyDecoders, policyForwarders); } /** @@ -210,7 +207,7 @@ public class CommonTestData { */ public Map<String, PolicyForwarderParameters> getPolicyForwarders(final boolean isEmpty) { final Map<String, PolicyForwarderParameters> policyForwarders = - new HashMap<String, PolicyForwarderParameters>(); + new HashMap<>(); if (!isEmpty) { final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS); @@ -226,7 +223,7 @@ public class CommonTestData { * @return the policyDecoders object */ public Map<String, PolicyDecoderParameters> getPolicyDecoders(final boolean isEmpty) { - final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<String, PolicyDecoderParameters>(); + final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>(); if (!isEmpty) { final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS); @@ -244,7 +241,7 @@ public class CommonTestData { public Map<String, PolicyForwarderConfigurationParameterGroup> getPolicyForwarderConfigurationParameters( final boolean isEmpty) { final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters = - new HashMap<String, PolicyForwarderConfigurationParameterGroup>(); + new HashMap<>(); if (!isEmpty) { final DummyPolicyForwarderParameterGroup parameters = new DummyPolicyForwarderParameterGroup(); parameters.setHostname(FORWARDER_HOST); @@ -267,7 +264,7 @@ public class CommonTestData { public Map<String, PolicyDecoderConfigurationParameterGroup> getPolicyDecoderConfigurationParameters( final boolean isEmpty) { final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters = - new HashMap<String, PolicyDecoderConfigurationParameterGroup>(); + new HashMap<>(); if (!isEmpty) { final DummyPolicyDecoderParameterGroup dummyPolicyForwarderParameterGroup = new DummyPolicyDecoderParameterGroup(); diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java index a48b0bd7..4f472b3d 100755 --- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java +++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2021, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +29,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Map; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.parameters.ValidationResult; +import org.onap.policy.common.parameters.rest.RestServerParameters; import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup; import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup; import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup; diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java index c85994d8..10039e80 100644 --- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java +++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java @@ -35,9 +35,9 @@ import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.onap.policy.common.endpoints.http.server.RestServer; -import org.onap.policy.common.endpoints.report.HealthCheckReport; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.common.utils.report.HealthCheckReport; import org.onap.policy.distribution.main.PolicyDistributionException; import org.onap.policy.distribution.main.parameters.CommonTestData; import org.onap.policy.distribution.main.startstop.Main; diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java index a99b1e3f..0a2ea51d 100644 --- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java +++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java @@ -24,6 +24,7 @@ package org.onap.policy.distribution.main.rest; import static org.assertj.core.api.Assertions.assertThatCode; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.core.MediaType; @@ -33,9 +34,9 @@ import javax.net.ssl.SSLContext; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.report.HealthCheckReport; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.common.utils.report.HealthCheckReport; import org.onap.policy.common.utils.security.SelfSignedKeyStore; import org.onap.policy.distribution.main.PolicyDistributionException; import org.onap.policy.distribution.main.parameters.CommonTestData; @@ -65,7 +66,7 @@ class TestHttpsDistributionRestServer { "HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive)"; final var main = startDistributionService(); final var report = performHealthCheck(); - validateReport(NAME, SELF, true, 200, ALIVE, reportString, report); + validateReport(reportString, report); assertThatCode(() -> stopDistributionService(main)).doesNotThrowAnyException(); } @@ -104,13 +105,12 @@ class TestHttpsDistributionRestServer { return invocationBuilder.get(HealthCheckReport.class); } - private void validateReport(final String name, final String url, final boolean healthy, final int code, - final String message, final String reportString, final HealthCheckReport report) { - assertEquals(name, report.getName()); - assertEquals(url, report.getUrl()); - assertEquals(healthy, report.isHealthy()); - assertEquals(code, report.getCode()); - assertEquals(message, report.getMessage()); + private void validateReport(final String reportString, final HealthCheckReport report) { + assertEquals(TestHttpsDistributionRestServer.NAME, report.getName()); + assertEquals(TestHttpsDistributionRestServer.SELF, report.getUrl()); + assertTrue(report.isHealthy()); + assertEquals(200, report.getCode()); + assertEquals(TestHttpsDistributionRestServer.ALIVE, report.getMessage()); assertEquals(reportString, report.toString()); } } diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParameters.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParameters.java index 2b7efbd5..25f7bdcc 100644 --- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParameters.java +++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiAutomationCompositionForwarderParameters.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,10 @@ package org.onap.policy.distribution.forwarding.lifecycle.api; import lombok.Getter; -import org.onap.policy.common.endpoints.parameters.RestClientParameters; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.common.parameters.annotations.Valid; +import org.onap.policy.common.parameters.rest.RestClientParameters; import org.onap.policy.distribution.main.parameters.PolicyForwarderConfigurationParameterGroup; /** diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParameters.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParameters.java index 060be1ad..5c0e0e38 100644 --- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParameters.java +++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParameters.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,10 +22,10 @@ package org.onap.policy.distribution.forwarding.lifecycle.api; import lombok.Getter; -import org.onap.policy.common.endpoints.parameters.RestClientParameters; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.common.parameters.annotations.Valid; +import org.onap.policy.common.parameters.rest.RestClientParameters; import org.onap.policy.distribution.main.parameters.PolicyForwarderConfigurationParameterGroup; /** diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorMain.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorMain.java index be8cc827..1f1a1a33 100644 --- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorMain.java +++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiAutomationCompositionSimulatorMain.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Nordix Foundation. + * Copyright (C) 2022-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ package org.onap.policy.distribution.forwarding.testclasses; import java.util.List; import org.onap.policy.common.endpoints.http.server.RestServer; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.common.parameters.rest.RestServerParameters; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiSimulatorMain.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiSimulatorMain.java index ef89149c..cfb67c60 100644 --- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiSimulatorMain.java +++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/testclasses/LifecycleApiSimulatorMain.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2023 Nordix Foundation. + * Copyright (C) 2019, 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ package org.onap.policy.distribution.forwarding.testclasses; import java.util.List; import org.onap.policy.common.endpoints.http.server.RestServer; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.common.parameters.rest.RestServerParameters; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; |