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.reception.decoding.pdpx;
 
  24 import static org.junit.Assert.assertEquals;
 
  26 import org.junit.Test;
 
  27 import org.onap.policy.common.parameters.ValidationStatus;
 
  30  * Class to perform unit test of {@link PolicyDecoderCsarPdpxConfigurationParameterGroup}.
 
  32  * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
 
  34 public class TestPolicyDecoderCsarPdpxConfigurationParameterGroup {
 
  37     public void testValidParameters() {
 
  38         final PolicyDecoderCsarPdpxConfigurationParameterGroup parameterGroup = CommonTestData
 
  39                 .getPolicyDecoderParameters("src/test/resources/parameters/PdpxPolicyDecoderParameters.json",
 
  40                         PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
 
  42         assertEquals(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName(), parameterGroup.getName());
 
  43         assertEquals("onapName", parameterGroup.getOnapName());
 
  44         assertEquals("OOF", parameterGroup.getPolicyNamePrefix());
 
  45         assertEquals("5", parameterGroup.getPriority());
 
  46         assertEquals("2", parameterGroup.getRiskLevel());
 
  47         assertEquals("Test", parameterGroup.getRiskType());
 
  48         assertEquals("1.0", parameterGroup.getVersion());
 
  49         assertEquals(ValidationStatus.CLEAN, parameterGroup.validate().getStatus());
 
  53     public void testInvalidParameters() {
 
  54         final PolicyDecoderCsarPdpxConfigurationParameterGroup parameterGroup = CommonTestData
 
  55                 .getPolicyDecoderParameters("src/test/resources/parameters/PdpxPolicyDecoderParametersInvalid.json",
 
  56                         PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
 
  58         assertEquals(ValidationStatus.INVALID, parameterGroup.validate().getStatus());
 
  62     public void testEmptyParameters() {
 
  63         final PolicyDecoderCsarPdpxConfigurationParameterGroup configurationParameters =
 
  64                 CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
 
  65                         PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
 
  67         assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());