2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.test;
23 import java.util.HashMap;
25 import org.junit.Test;
26 import org.onap.policy.api.PolicyConfigStatus;
27 import org.onap.policy.api.PolicyConfigType;
28 import org.onap.policy.api.PolicyType;
29 import org.onap.policy.models.APIPolicyConfigResponse;
30 import junit.framework.TestCase;
32 public class APIPolicyConfigResponseTest extends TestCase {
33 private final String testKey = "testKey";
34 private final String testValue = "testValue";
35 private final PolicyType testType = PolicyType.JSON;
36 private final PolicyConfigStatus testStatus = PolicyConfigStatus.CONFIG_RETRIEVED;
37 private final PolicyConfigType testConfigType = PolicyConfigType.BRMS_PARAM;
40 public final void testSetAndGet() {
41 APIPolicyConfigResponse response = new APIPolicyConfigResponse();
42 response.setConfig(testValue);
43 assertEquals(response.getConfig(), testValue);
45 response.setType(testType);
46 assertEquals(response.getType(), testType);
48 response.setPolicyConfigStatus(testStatus);
49 assertEquals(response.getPolicyConfigStatus(), testStatus);
51 response.setPolicyConfigMessage(testValue);
52 assertEquals(response.getPolicyConfigMessage(), testValue);
54 response.setPolicyName(testValue);
55 assertEquals(response.getPolicyName(), testValue);
57 response.setPolicyType(testConfigType);
58 assertEquals(response.getPolicyType(), testConfigType);
60 response.setPolicyVersion(testValue);
61 assertEquals(response.getPolicyVersion(), testValue);
63 Map<String, String> testMap = new HashMap<String, String>();
64 testMap.put(testKey, testValue);
66 response.setMatchingConditions(testMap);
67 assertEquals(response.getMatchingConditions(), testMap);
69 response.setProperty(testMap);
70 assertEquals(response.getProperty(), testMap);
72 response.setResponseAttributes(testMap);
73 assertEquals(response.getResponseAttributes(), testMap);