2 * ============LICENSE_START=======================================================
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
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.
18 * ============LICENSE_END=========================================================
20 package org.onap.policy.xacml.test.util;
22 import static org.junit.Assert.assertTrue;
25 import java.io.IOException;
26 import java.nio.file.Path;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.onap.policy.xacml.util.XACMLPolicyWriter;
34 public class XACMLPolicyWriterTest {
35 private static final Log logger = LogFactory.getLog(XACMLPolicyWriterTest.class);
36 private static Path configPolicyPathValue;
37 private static Path actionPolicyPathValue;
42 ClassLoader classLoader = getClass().getClassLoader();
44 templateFile = new File(classLoader.getResource("Config_SampleTest1206.1.xml").getFile());
45 configPolicyPathValue = templateFile.toPath();
46 templateFile = new File(classLoader.getResource("Action_TestActionPolicy.1.xml").getFile());
47 actionPolicyPathValue = templateFile.toPath();
48 } catch (Exception e1) {
49 logger.error("Exception Occured"+e1);
53 @SuppressWarnings("static-access")
55 public void xacmlPolicyWriterTest() throws IOException{
56 XACMLPolicyWriter writer = new XACMLPolicyWriter();
57 String configResponseValue = writer.changeFileNameInXmlWhenRenamePolicy(configPolicyPathValue);
58 assertTrue(configResponseValue.equals("txt"));
59 String actionResponseValue = writer.changeFileNameInXmlWhenRenamePolicy(actionPolicyPathValue);
60 assertTrue(actionResponseValue.equals("json"));