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