Merge "Add New Junit Tests For ONAP-XACML"
[policy/engine.git] / ONAP-XACML / src / test / java / org / onap / policy / xacml / test / std / pap / StdEngineTest.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.io.IOException;
25 import java.nio.file.Path;
26 import java.nio.file.Paths;
27 import java.util.Properties;
28
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.onap.policy.common.logging.flexlogger.FlexLogger;
32 import org.onap.policy.common.logging.flexlogger.Logger;
33 import org.onap.policy.xacml.api.pap.OnapPDP;
34 import org.onap.policy.xacml.std.pap.StdEngine;
35
36 import com.att.research.xacml.api.pap.PAPException;
37 import com.att.research.xacml.std.pap.StdPDP;
38
39 public class StdEngineTest {
40         
41         private static Logger logger = FlexLogger.getLogger(StdEngineTest.class);
42         private Path repository;
43         Properties properties = new Properties();
44         StdEngine stdEngine = null;
45         
46         @Before
47         public void setUp(){
48         
49                 repository = Paths.get("src/test/resources/pdps");
50                 try {
51                         stdEngine = new StdEngine(repository);
52                 } catch (PAPException e) {
53                         logger.info(e);
54                 } catch (IOException e) {
55                         logger.info(e);
56                 }
57         }
58
59         @Test
60         public void testGetDefaultGroup(){
61                 try {
62                         assertTrue(stdEngine.getDefaultGroup() != null);
63                 } catch (PAPException e) {
64                         logger.info(e);
65                 }
66         }       
67         @Test
68         public void testGetGroup(){
69                 try {
70                         assertTrue(stdEngine.getGroup("1") == null);
71                 } catch (PAPException e) {
72                         logger.info(e);
73                 }
74                 
75         }       
76         
77         @Test
78         public void testGetOnapPDPGroups(){
79                 try {
80                         assertTrue(stdEngine.getOnapPDPGroups() != null);
81                 } catch (PAPException e) {
82                         logger.info(e);
83                 }       
84         }       
85         @Test
86         public void testGetPDP(){
87                 try {
88                         assertTrue(stdEngine.getPDP("1") == null);
89                 } catch (PAPException e) {
90                         logger.info(e);
91                 }
92         }       
93         @Test
94         public void testGetPDPGroup(){
95                 try {
96                         assertTrue(stdEngine.getPDPGroup(null) == null);
97                 } catch (PAPException e) {
98                         logger.info(e);
99                 }
100         }
101 }