Merge "Technical debt reduction"
[policy/engine.git] / ONAP-XACML / src / test / java / org / onap / policy / xacml / test / std / pap / StdPDPGroupStatusTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-XACML
4  * ================================================================================
5  * Copyright (C) 2017 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 package org.onap.policy.xacml.test.std.pap;
21
22 import static org.junit.Assert.assertTrue;
23
24 import java.util.HashSet;
25
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.onap.policy.common.logging.flexlogger.FlexLogger;
29 import org.onap.policy.common.logging.flexlogger.Logger;
30 import org.onap.policy.xacml.std.pap.StdPDP;
31 import org.onap.policy.xacml.std.pap.StdPDPGroupStatus;
32 import org.onap.policy.xacml.std.pap.StdPDPPIPConfig;
33
34 public class StdPDPGroupStatusTest {
35
36         private static Logger logger = FlexLogger.getLogger(StdPDPGroupStatus.class);
37         
38         private StdPDPGroupStatus stdPDPGroupStatus;
39         
40         @Before
41         public void setUp(){
42         
43                 try {
44                         stdPDPGroupStatus = new StdPDPGroupStatus();
45                 } catch (Exception e) {
46                         logger.error(e);
47                 } 
48         }
49
50         @Test
51         public void tesGgetStatus() {
52                 try {
53                         assertTrue(stdPDPGroupStatus.getStatus() != null);
54                 } catch (Exception e) {
55                         logger.error(e);
56                 }
57         }
58
59         @Test
60         public void testGetFailedPIPConfigs() {
61                 try {
62                         assertTrue(stdPDPGroupStatus.getFailedPIPConfigs() != null);
63                 } catch (Exception e) {
64                         logger.error(e);
65                 }
66         }
67
68         @Test
69         public void testGetUnknownPDPs() {
70                 try {
71                         assertTrue(stdPDPGroupStatus.getUnknownPDPs() != null);
72                 } catch (Exception e) {
73                         logger.error(e);
74                 }
75         }
76
77         @Test
78         public void testGetLoadErrors() {
79                 try {
80                         stdPDPGroupStatus.setLoadErrors(new HashSet<String>());
81                         assertTrue(stdPDPGroupStatus.getLoadErrors() != null);
82                 } catch (Exception e) {
83                         logger.error(e);
84                 }
85         }
86
87         @Test
88         public void testGetLoadWarnings() {
89                 try {
90                         stdPDPGroupStatus.setLoadWarnings(new HashSet<>());
91                         assertTrue(stdPDPGroupStatus.getLoadWarnings() != null);
92                 } catch (Exception e) {
93                         logger.error(e);
94                 }
95         }
96
97         @Test
98         public void testGetLoadedPolicies() {
99                 try {
100                         stdPDPGroupStatus.setLoadedPolicies(new HashSet<>());
101                         assertTrue(stdPDPGroupStatus.getLoadedPolicies() != null);
102                 } catch (Exception e) {
103                         logger.error(e);
104                 }
105         }
106
107         @Test
108         public void testGetFailedPolicies() {
109                 try {
110                         stdPDPGroupStatus.setFailedPolicies(new HashSet<>());
111                         assertTrue(stdPDPGroupStatus.getFailedPolicies() != null);
112                 } catch (Exception e) {
113                         logger.error(e);
114                 }
115         }
116
117         @Test
118         public void testGetLoadedPipConfigs() {
119                 try {
120                         stdPDPGroupStatus.addLoadedPipConfig(new StdPDPPIPConfig());
121                         assertTrue(stdPDPGroupStatus.getLoadedPipConfigs() != null);
122                 } catch (Exception e) {
123                         logger.error(e);
124                 }
125         }
126
127         @Test
128         public void testGetFailedPipConfigs() {
129                 try {
130                         stdPDPGroupStatus.addFailedPipConfig(new StdPDPPIPConfig());
131                         assertTrue(stdPDPGroupStatus.getFailedPipConfigs() != null);
132                 } catch (Exception e) {
133                         logger.error(e);
134                 }
135         }
136
137         @Test
138         public void testGetInSynchPDPs() {
139                 try {
140                         stdPDPGroupStatus.addInSynchPDP(new StdPDP());
141                         assertTrue(stdPDPGroupStatus.getInSynchPDPs() != null);
142                 } catch (Exception e) {
143                         logger.error(e);
144                 }
145         }
146
147         @Test
148         public void testGetOutOfSynchPDPs() {
149                 try {
150                         stdPDPGroupStatus.addOutOfSynchPDP(new StdPDP());
151                         assertTrue(stdPDPGroupStatus.getOutOfSynchPDPs() != null);
152                 } catch (Exception e) {
153                         logger.error(e);
154                 }
155         }
156
157         @Test
158         public void testGetFailedPDPs() {
159                 try {
160                         stdPDPGroupStatus.addFailedPDP(new StdPDP());
161                         assertTrue(stdPDPGroupStatus.getFailedPDPs() != null);
162                 } catch (Exception e) {
163                         logger.error(e);
164                 }
165         }
166
167         @Test
168         public void testGetUpdatingPDPs() {
169                 try {
170                         stdPDPGroupStatus.addUpdatingPDP(new StdPDP());
171                         assertTrue(stdPDPGroupStatus.getUpdatingPDPs() != null);
172                 } catch (Exception e) {
173                         logger.error(e);
174                 }
175         }
176
177         @Test
178         public void testGetLastUpdateFailedPDPs() {
179                 try {
180                         stdPDPGroupStatus.addLastUpdateFailedPDP(new StdPDP());
181                         assertTrue(stdPDPGroupStatus.getLastUpdateFailedPDPs() != null);
182                 } catch (Exception e) {
183                         logger.error(e);
184                 }
185         }
186
187         @Test
188         public void testGetUnknownStatusPDPs() {
189                 try {
190                         stdPDPGroupStatus.addUnknownPDP(new StdPDP());
191                         assertTrue(stdPDPGroupStatus.getUnknownStatusPDPs() != null);
192                 } catch (Exception e) {
193                         logger.error(e);
194                 }
195         }
196
197         @Test
198         public void testIsGroupOk() {
199                 try {
200                         stdPDPGroupStatus.policiesOK();
201                         assertTrue(stdPDPGroupStatus.isGroupOk() == false);
202                 } catch (Exception e) {
203                         logger.error(e);
204                 }
205         }
206
207 }