6e5959d08f84f17dcc28680f21f644c13dd8afa8
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / APIPolicyConfigResponseTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.policy.test;
22
23 import java.util.HashMap;
24 import java.util.Map;
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; 
31
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;
38         
39         @Test
40         public final void testSetAndGet() {
41                 APIPolicyConfigResponse response = new APIPolicyConfigResponse();
42                 response.setConfig(testValue);
43                 assertEquals(response.getConfig(), testValue);
44                 
45                 response.setType(testType);
46                 assertEquals(response.getType(), testType);
47                 
48                 response.setPolicyConfigStatus(testStatus);
49                 assertEquals(response.getPolicyConfigStatus(), testStatus);
50                 
51                 response.setPolicyConfigMessage(testValue);
52                 assertEquals(response.getPolicyConfigMessage(), testValue);
53                 
54                 response.setPolicyName(testValue);
55                 assertEquals(response.getPolicyName(), testValue);
56                 
57                 response.setPolicyType(testConfigType);
58                 assertEquals(response.getPolicyType(), testConfigType);
59                 
60                 response.setPolicyVersion(testValue);
61                 assertEquals(response.getPolicyVersion(), testValue);
62                 
63                 Map<String, String> testMap = new HashMap<String, String>();
64                 testMap.put(testKey, testValue);
65                 
66                 response.setMatchingConditions(testMap);
67                 assertEquals(response.getMatchingConditions(), testMap);
68                 
69                 response.setProperty(testMap);
70                 assertEquals(response.getProperty(), testMap);
71                 
72                 response.setResponseAttributes(testMap);
73                 assertEquals(response.getResponseAttributes(), testMap);
74         }
75 }