diff options
author | 2021-07-19 16:21:25 -0400 | |
---|---|---|
committer | 2021-07-20 09:37:05 -0400 | |
commit | b59b14d47b590ff94b7c98348c1617990d03c86f (patch) | |
tree | 2bccdb90eb3ffa96a8840c1666728ac60b007271 /plugins/forwarding-plugins/src/test | |
parent | 9eba753aed9d5575fa24ab8806e4d614668c75cb (diff) |
Use new RestClientParameters class in distribution
Replaced LifecycleApiForwarderParameters with RestClientParameters.
Also modified the code to get the HttpClient objects once.
This requires changes to property files in CSITs and OOM:
- rename "hostName" to "hostname"
- rename "isHttps" to "useHttps" and move it inside the api & pap
structures
Issue-ID: POLICY-3456
Change-Id: I654c32c9b6628263a68d821e11c5a316e8b6e2cc
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/forwarding-plugins/src/test')
3 files changed, 20 insertions, 11 deletions
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java index 0f010bfc..50520d84 100644 --- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java +++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiForwarderParametersTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T 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. @@ -20,6 +21,7 @@ package org.onap.policy.distribution.forwarding.lifecycle.api; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -52,19 +54,24 @@ public class LifecycleApiForwarderParametersTest { "src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json", LifecycleApiForwarderParameters.class); + configurationParameters.getApiParameters().setClientName("api"); + configurationParameters.getPapParameters().setClientName("pap"); + assertEquals(LifecycleApiForwarderParameters.class.getSimpleName(), configurationParameters.getName()); - assertFalse(configurationParameters.isHttps()); assertTrue(configurationParameters.isDeployPolicies()); - assertEquals(POLICY_API_HOST_NAME, configurationParameters.getApiParameters().getHostName()); + assertEquals(POLICY_API_HOST_NAME, configurationParameters.getApiParameters().getHostname()); assertEquals(POLICY_API_PORT, configurationParameters.getApiParameters().getPort()); + assertFalse(configurationParameters.getApiParameters().isUseHttps()); assertEquals(POLICY_API_USER, configurationParameters.getApiParameters().getUserName()); assertEquals(POLICY_API_PASSWORD, configurationParameters.getApiParameters().getPassword()); - assertEquals(POLICY_PAP_HOST_NAME, configurationParameters.getPapParameters().getHostName()); + assertEquals(POLICY_PAP_HOST_NAME, configurationParameters.getPapParameters().getHostname()); assertEquals(POLICY_PAP_PORT, configurationParameters.getPapParameters().getPort()); + assertFalse(configurationParameters.getPapParameters().isUseHttps()); assertEquals(POLICY_PAP_USER, configurationParameters.getPapParameters().getUserName()); assertEquals(POLICY_PAP_PASSWORD, configurationParameters.getPapParameters().getPassword()); + assertThat(configurationParameters.validate().getResult()).isNull(); assertEquals(ValidationStatus.CLEAN, configurationParameters.validate().getStatus()); } diff --git a/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json b/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json index 0791e1ae..5bb9b65b 100644 --- a/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json +++ b/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParameters.json @@ -1,16 +1,17 @@ { "apiParameters": { - "hostName": "0.0.0.0", + "hostname": "0.0.0.0", "port": 6969, + "useHttps": false, "userName": "healthcheck", "password": "zb!XztG34" }, "papParameters": { - "hostName": "0.0.0.0", + "hostname": "0.0.0.0", "port": 6969, + "useHttps": false, "userName": "healthcheck", "password": "zb!XztG34" }, - "isHttps": false, "deployPolicies": true -}
\ No newline at end of file +} diff --git a/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParametersInvalid.json b/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParametersInvalid.json index ca0558a6..93cb0dd3 100644 --- a/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParametersInvalid.json +++ b/plugins/forwarding-plugins/src/test/resources/parameters/LifecycleApiPolicyForwarderParametersInvalid.json @@ -1,16 +1,17 @@ { "apiParameters": { - "hostName": "", + "hostname": "", "port": -1, + "useHttps": false, "userName": "healthcheck", "password": "zb!XztG34" }, "papParameters": { - "hostName": "", + "hostname": "", "port": -2, + "useHttps": false, "userName": "healthcheck", "password": "zb!XztG34" }, - "isHttps": false, "deployPolicies": true -}
\ No newline at end of file +} |