2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019-2021 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.pdp.xacml.application.common;
25 import static org.assertj.core.api.Assertions.assertThat;
27 import java.io.FileInputStream;
28 import java.util.Properties;
29 import org.junit.Test;
31 public class OnapPolicyFinderFactoryTest {
34 public void testFinder() throws Exception {
36 // Load our test properties to use
38 Properties properties = new Properties();
39 try (FileInputStream is = new FileInputStream("src/test/resources/finder.test.properties")) {
42 OnapPolicyFinderFactory finder = new OnapPolicyFinderFactory(properties);
43 assertThat(finder).isNotNull();
45 assertThat(finder.getPolicyFinder()).isNotNull();
46 assertThat(finder.getPolicyFinder(properties)).isNotNull();
50 public void testFinderWithCombiningAlgorithm() throws Exception {
52 // Load our test properties to use
54 Properties properties = new Properties();
55 try (FileInputStream is = new FileInputStream("src/test/resources/finder.test.properties")) {
59 // Set a combining algorithm
61 properties.put("xacml.att.policyFinderFactory.combineRootPolicies",
62 "urn:com:att:xacml:3.0:policy-combining-algorithm:combined-permit-overrides");
63 OnapPolicyFinderFactory finder = new OnapPolicyFinderFactory(properties);
64 assertThat(finder).isNotNull();