Merge "Add New Junit Tests For ONAP-XACML"
[policy/engine.git] / ONAP-XACML / src / test / java / org / onap / policy / xacml / test / std / pap / StdPDPTest.java
1 package org.onap.policy.xacml.test.std.pap;
2 /*-
3  * ============LICENSE_START=======================================================
4  * ONAP-XACML
5  * ================================================================================
6  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 import static org.junit.Assert.*;
22
23 import java.util.HashSet;
24
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.onap.policy.common.logging.flexlogger.FlexLogger;
28 import org.onap.policy.common.logging.flexlogger.Logger;
29 import org.onap.policy.xacml.std.pap.StdPDP;
30 import org.onap.policy.xacml.std.pap.StdPDPStatus;
31
32 public class StdPDPTest {
33
34         private static Logger logger = FlexLogger.getLogger(StdPDPTest.class);
35         
36         private StdPDP stdPDP;
37         
38         @Before
39         public void setUp(){
40         
41                 try {
42                         stdPDP = new StdPDP();
43                 } catch (Exception e) {
44                         logger.error(e);
45                 } 
46         }
47
48         @Test
49         public void testGetId() {
50                 try {
51                         stdPDP.setId("testId");
52                         assertTrue(stdPDP.getId() != null);
53                 } catch (Exception e) {
54                         logger.error(e);
55                 }
56         }
57
58         @Test
59         public void testGetName() {
60                 try {
61                         stdPDP.setName("abc");
62                         assertTrue(stdPDP.getName() != null);
63                 } catch (Exception e) {
64                         logger.error(e);
65                 }
66         }
67
68         @Test
69         public void testGetDescription() {
70                 try {
71                         stdPDP.setDescription("somee here");
72                         assertTrue(stdPDP.getDescription() != null);
73                 } catch (Exception e) {
74                         logger.error(e);
75                 }
76         }
77
78         @Test
79         public void testGetStatus() {
80                 try {
81                         stdPDP.setStatus(new StdPDPStatus());
82                         assertTrue(stdPDP.getStatus() != null);
83                 } catch (Exception e) {
84                         logger.error(e);
85                 }
86         }
87
88         @Test
89         public void testGetPipConfigs() {
90                 try {
91                         assertTrue(stdPDP.getPipConfigs() != null);
92                 } catch (Exception e) {
93                         logger.error(e);
94                 }
95         }
96
97         @Test
98         public void testGetJmxPort() {
99                 try {
100                         stdPDP.setJmxPort(123);
101                         assertTrue(stdPDP.getJmxPort() != null);
102                 } catch (Exception e) {
103                         logger.error(e);
104                 }
105         }
106
107 }