2  * ============LICENSE_START=======================================================
 
   3  *  Copyright (C) 2018 Ericsson. All rights reserved.
 
   4  *  Modifications Copyright (C) 2019 Nordix Foundation.
 
   5  * ================================================================================
 
   6  * Licensed under the Apache License, Version 2.0 (the "License");
 
   7  * you may not use this file except in compliance with the License.
 
   8  * You may obtain a copy of the License at
 
  10  *      http://www.apache.org/licenses/LICENSE-2.0
 
  12  * Unless required by applicable law or agreed to in writing, software
 
  13  * distributed under the License is distributed on an "AS IS" BASIS,
 
  14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  15  * See the License for the specific language governing permissions and
 
  16  * limitations under the License.
 
  18  * SPDX-License-Identifier: Apache-2.0
 
  19  * ============LICENSE_END=========================================================
 
  22 package org.onap.policy.distribution.forwarding.apex.pdp;
 
  24 import static org.junit.Assert.assertEquals;
 
  25 import static org.junit.Assert.assertFalse;
 
  26 import static org.junit.Assert.assertTrue;
 
  28 import org.junit.Test;
 
  29 import org.onap.policy.common.parameters.ValidationStatus;
 
  30 import org.onap.policy.distribution.forwarding.xacml.pdp.testclasses.CommonTestData;
 
  33  * Class to perform unit test of {@link ApexPdpPolicyForwarderParameterGroup}.
 
  35  * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
 
  37 public class ApexPdpPolicyForwarderParameterGroupTest {
 
  40     public void testValidParameters() {
 
  41         final ApexPdpPolicyForwarderParameterGroup configurationParameters = CommonTestData
 
  42                 .getPolicyForwarderParameters("src/test/resources/parameters/ApexPdpPolicyForwarderParameters.json",
 
  43                         ApexPdpPolicyForwarderParameterGroup.class);
 
  44         assertEquals(ApexPdpPolicyForwarderParameterGroup.class.getSimpleName(), configurationParameters.getName());
 
  45         assertTrue(configurationParameters.isForceUpdate());
 
  46         assertEquals("10.10.10.10", configurationParameters.getHostname());
 
  47         assertEquals(1234, configurationParameters.getPort());
 
  48         assertFalse(configurationParameters.isIgnoreConflicts());
 
  49         assertEquals(ValidationStatus.CLEAN, configurationParameters.validate().getStatus());
 
  53     public void testInvalidParameters() {
 
  54         final ApexPdpPolicyForwarderParameterGroup configurationParameters =
 
  55                 CommonTestData.getPolicyForwarderParameters(
 
  56                         "src/test/resources/parameters/ApexPdpPolicyForwarderParametersInvalid.json",
 
  57                         ApexPdpPolicyForwarderParameterGroup.class);
 
  59         assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());
 
  63     public void testEmptyParameters() {
 
  64         final ApexPdpPolicyForwarderParameterGroup configurationParameters =
 
  65                 CommonTestData.getPolicyForwarderParameters("src/test/resources/parameters/EmptyParameters.json",
 
  66                         ApexPdpPolicyForwarderParameterGroup.class);
 
  68         assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());