aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/test')
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java2
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicyTest.java35
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java101
-rw-r--r--ONAP-PAP-REST/src/test/resources/Config_SampleTest1206.1.xml90
-rw-r--r--ONAP-PAP-REST/src/test/resources/pdps/testgroup2/com.Config_SampleBasePolicy.1.xml90
-rw-r--r--ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.pip.properties9
-rw-r--r--ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.policy.properties5
-rw-r--r--ONAP-PAP-REST/src/test/resources/pdps/xacml.properties10
8 files changed, 249 insertions, 93 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
index 55879ca53..cb09becf3 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/ActionPolicyTest.java
@@ -89,7 +89,7 @@ public class ActionPolicyTest {
attributeMap.put("java", "test");
policyAdapter.setDynamicFieldConfigAttributes(attributeMap);
- component = new ActionPolicy(policyAdapter);
+ component = new ActionPolicy(policyAdapter, null);
logger.info("setUp: exit");
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicyTest.java
index caa5707cc..e16dd9889 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicyTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-PAP-REST
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
*/
package org.onap.policy.pap.xacml.rest.components;
-import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@@ -30,7 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -101,19 +99,12 @@ public class DecisionPolicyTest {
policyAdapter.setRainydayMap(treatmentMap);
policyAdapter.setRainyday(rainyday);
- component = new DecisionPolicy(policyAdapter);
+ component = new DecisionPolicy(policyAdapter, null);
logger.info("setUp: exit");
}
/**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
* Test method for {@link org.openecomp.policy.pap.xacml.rest.components.DecisionPolicy#savePolicies()}.
*/
@Test
@@ -140,25 +131,7 @@ public class DecisionPolicyTest {
public void testPrepareToSaveRainyDay() {
logger.debug("test PrepareToSave Policy: enter");
policyAdapter.setRuleProvider("Rainy_Day");
- component = new DecisionPolicy(policyAdapter);
- boolean response = false;
-
- try {
- response = component.prepareToSave();
- } catch (Exception e) {
- logger.error("Exception Occured"+e);
- }
- assertTrue(response);
- }
-
- /**
- * Test method for {@link org.openecomp.policy.pap.xacml.rest.components.DecisionPolicy#prepareToSave()}.
- */
- @Test
- public void testPrepareToSaveCustom() {
- logger.debug("test PrepareToSave Policy: enter");
- policyAdapter.setRuleProvider("Custom");
- component = new DecisionPolicy(policyAdapter);
+ component = new DecisionPolicy(policyAdapter, null);
boolean response = false;
try {
@@ -168,6 +141,4 @@ public class DecisionPolicyTest {
}
assertTrue(response);
}
-
-
} \ No newline at end of file
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
index 546c5c0c3..c098bf4fa 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-PAP-REST
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,11 @@
package org.onap.policy.pap.xacml.rest.components;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
import java.util.List;
@@ -36,11 +39,10 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Assert;
-//import org.apache.commons.logging.Log;
-//import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pap.xacml.rest.components.PolicyDBDao.PolicyDBDaoTestClass;
@@ -51,14 +53,17 @@ import org.onap.policy.rest.jpa.GroupEntity;
import org.onap.policy.rest.jpa.PdpEntity;
import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
+import org.onap.policy.xacml.std.pap.StdEngine;
import org.onap.policy.xacml.std.pap.StdPDPGroup;
import org.onap.policy.xacml.util.XACMLPolicyWriter;
+import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.util.XACMLProperties;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-public class PolicyDBDaoTest {
+public class PolicyDBDaoTest extends Mockito{
private static Logger logger = FlexLogger.getLogger(PolicyDBDaoTest.class);
@@ -66,8 +71,11 @@ public class PolicyDBDaoTest {
PolicyDBDao dbd;
PolicyDBDao dbd2;
EntityManagerFactory emf;
+ private Path repository;
+ StdEngine stdEngine = null;
+
@Before
- public void init(){
+ public void init() throws PAPException, IOException{
System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
emf = Persistence.createEntityManagerFactory("testPapPU");
EntityManager em = emf.createEntityManager();
@@ -90,15 +98,19 @@ public class PolicyDBDaoTest {
dbd = PolicyDBDao.getPolicyDBDaoInstance(emf);
dbd2 = PolicyDBDao.getPolicyDBDaoInstance(emf);
} catch (Exception e) {
- //logger.error("Exception Occured"+e);
Assert.fail();
}
d = PolicyDBDao.getPolicyDBDaoTestClass();
+ PolicyDBDao.setJunit(true);
+ repository = Paths.get("src/test/resources/pdps");
+ stdEngine = new StdEngine(repository);
+ dbd.setPapEngine(stdEngine);
}
@After
public void cleanUp(){
+ PolicyDBDao.setJunit(false);
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
try{
@@ -119,15 +131,9 @@ public class PolicyDBDaoTest {
} catch (IOException e) {
//could not delete
}
-
}
@Test
- public void computeScopeTest(){
- Assert.assertEquals("com",d.computeScope("C:\\Users\\testuser\\admin\\repo\\com\\", "C:\\Users\\testuser\\admin\\repo"));
- Assert.assertEquals("org.onap.policy",d.computeScope("/Users/testuser/admin/repo/org.onap.policy", "/Users/testuser/admin/repo"));
- }
- @Test
public void getConfigFileTest(){
PolicyRestAdapter pra = new PolicyRestAdapter();
pra.setConfigType(ConfigPolicy.JSON_CONFIG);
@@ -138,23 +144,33 @@ public class PolicyDBDaoTest {
Assert.assertEquals("org.onap.Action_mypolicy.json", configFile);
}
- @Ignore
@Test
public void createFromPolicyObject(){
- String workspaceDir = "src/test/resources/";
- File parentPath = new File(workspaceDir+"/com");
Policy policyObject = new ConfigPolicy();
policyObject.policyAdapter = new PolicyRestAdapter();
policyObject.policyAdapter.setConfigName("testpolicy1");
- policyObject.policyAdapter.setParentPath(parentPath.getAbsolutePath());
policyObject.policyAdapter.setPolicyDescription("my description");
policyObject.policyAdapter.setConfigBodyData("this is my test config file");
- policyObject.policyAdapter.setPolicyName("testpolicy1");
+ policyObject.policyAdapter.setPolicyName("SampleTest1206");
policyObject.policyAdapter.setConfigType(ConfigPolicy.OTHER_CONFIG);
policyObject.policyAdapter.setPolicyType("Config");
- policyObject.policyAdapter.setDomainDir("org.onap");
+ policyObject.policyAdapter.setDomainDir("com");
+ policyObject.policyAdapter.setVersion("1");
PolicyType policyTypeObject = new PolicyType();
policyObject.policyAdapter.setPolicyData(policyTypeObject);
+ ClassLoader classLoader = getClass().getClassLoader();
+ PolicyType policyConfig = new PolicyType();
+ policyConfig.setVersion(Integer.toString(1));
+ policyConfig.setPolicyId("");
+ policyConfig.setTarget(new TargetType());
+ policyObject.policyAdapter.setData(policyConfig);
+ mock(XACMLPolicyWriter.class);
+ try {
+ policyObject.policyAdapter.setParentPath(IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")));
+ } catch (Exception e2) {
+ fail();
+ }
+
PolicyDBDaoTransaction transaction = dbd.getNewTransaction();
try{
transaction.createPolicy(policyObject, "testuser1");
@@ -166,57 +182,31 @@ public class PolicyDBDaoTest {
EntityManager getData = emf.createEntityManager();
Query getDataQuery = getData.createQuery("SELECT p FROM PolicyEntity p WHERE p.scope=:scope AND p.policyName=:name");
- getDataQuery.setParameter("scope", "org.onap");
- getDataQuery.setParameter("name","Config_testpolicy1.xml");
+ getDataQuery.setParameter("scope", "com");
+ getDataQuery.setParameter("name","Config_SampleTest1206.1.xml");
PolicyEntity result = null;
try{
- result = (PolicyEntity)getDataQuery.getSingleResult();
+ result = (PolicyEntity)getDataQuery.getSingleResult();
} catch(Exception e){
logger.error("Exception Occured"+e);
Assert.fail();
}
String expectedData;
try {
- expectedData = IOUtils.toString(XACMLPolicyWriter.getXmlAsInputStream(policyTypeObject));
+ expectedData = IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml"));
} catch (IOException e1) {
expectedData = "";
}
Assert.assertEquals(expectedData, result.getPolicyData());
getData.close();
result = null;
- File policyFile = new File(workspaceDir+"/org/onap/Config_testpolicy1.xml");
- try{
- transaction = dbd.getNewTransaction();
- transaction.deletePolicy(policyFile.getAbsolutePath());
- } catch(Exception e){
- logger.error("Exception Occured"+e);
- Assert.fail();
- }
- Assert.assertTrue(transaction.isTransactionOpen());
- try{
- transaction.deletePolicy(policyFile.getAbsolutePath());
- Assert.fail();
- } catch(IllegalStateException e){
- //pass
- } catch(Exception e){
- Assert.fail();
- }
+
transaction.commitTransaction();
Assert.assertFalse(transaction.isTransactionOpen());
- try{
- transaction = dbd.getNewTransaction();
- transaction.deletePolicy(policyFile.getAbsolutePath());
- } catch(Exception e){
- logger.error("Exception Occured"+e);
- Assert.fail();
- }
- //Assert.assertFalse(transaction.isTransactionOpen());
- transaction.commitTransaction();
}
- @Ignore
@Test
- public void groupTransactions(){
+ public void groupTransactions(){
PolicyDBDaoTransaction group = dbd.getNewTransaction();
String groupName = "test group 1";
try{
@@ -405,9 +395,6 @@ public class PolicyDBDaoTest {
Assert.fail();
}
-
- //add policy to group
-
//update group
OnapPDPGroup pdpGroup = new StdPDPGroup("testgroup2", false, "newtestgroup2", "this is my new description", Paths.get("/"));
group = dbd.getNewTransaction();
@@ -441,12 +428,6 @@ public class PolicyDBDaoTest {
em.close();
}
- @Test
- public void getDescriptionFromXacmlTest(){
- String myTestDesc = "hello this is a test";
- String desc = d.getDescriptionFromXacml("<Description>"+myTestDesc+"</Description>");
- Assert.assertEquals(myTestDesc, desc);
- }
@Ignore
@Test
public void threadingStabilityTest(){
@@ -618,4 +599,4 @@ public class PolicyDBDaoTest {
}
}
-}
+} \ No newline at end of file
diff --git a/ONAP-PAP-REST/src/test/resources/Config_SampleTest1206.1.xml b/ONAP-PAP-REST/src/test/resources/Config_SampleTest1206.1.xml
new file mode 100644
index 000000000..dcfd0c5eb
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/resources/Config_SampleTest1206.1.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
+ <Description>SampleTest1206@CreatedBy:test@CreatedBy:@ModifiedBy:test@ModifiedBy:</Description>
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_SampleTest1206.1.xml</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ <AllOf>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">success</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PROD</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">True</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">08-06-2017</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleTest1206</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <Rule RuleId="urn:com:xacml:rule:id:7e46d503-af54-4ea5-a86c-9eb6dd1f4f43" Effect="Permit">
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <AdviceExpressions>
+ <AdviceExpression AdviceId="configID" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_SampleTest1206.1.txt</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_SampleTest1206.1.xml</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">success</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleTest1206</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PROD</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">True</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">08-06-2017</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ </AdviceExpressions>
+ </Rule>
+</Policy>
diff --git a/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/com.Config_SampleBasePolicy.1.xml b/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/com.Config_SampleBasePolicy.1.xml
new file mode 100644
index 000000000..168cb5525
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/com.Config_SampleBasePolicy.1.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:xacml:policy:id:0bc4aa91-cb41-420a-93e1-eca6098797a3" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
+ <Description>SampleBasePolicy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_SampleBasePolicy.1.xml</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ <AllOf>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ONAP_TEST_123</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">17-01-2018</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.onap.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleBasePolicy</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <Rule RuleId="" Effect="Permit">
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <AdviceExpressions>
+ <AdviceExpression AdviceId="configID" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_SampleBasePolicy.1.txt</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_SampleBasePolicy.1.xml</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ONAP_TEST_123</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleBasePolicy</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">17-01-2018</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ </AdviceExpressions>
+ </Rule>
+</Policy>
diff --git a/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.pip.properties b/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.pip.properties
new file mode 100644
index 000000000..bc4027a5f
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.pip.properties
@@ -0,0 +1,9 @@
+#
+#Wed Feb 14 16:26:32 EST 2018
+historydb.name=operationHistoryDB
+AAF.description=AAFEngine to communicate with AAF to take decisions
+historydb.issuer=org\:onap\:xacml\:guard\:historydb
+AAF.classname=org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine
+AAF.name=AAFEngine
+historydb.classname=org.onap.policy.xacml.std.pip.engines.OperationHistoryEngine
+xacml.pip.engines=historydb,AAF
diff --git a/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.policy.properties b/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.policy.properties
new file mode 100644
index 000000000..d2218a8b5
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/resources/pdps/testgroup2/xacml.policy.properties
@@ -0,0 +1,5 @@
+#
+#Wed Feb 14 16:26:32 EST 2018
+com.Config_SampleBasePolicy.1.xml.name=com.Config_SampleBasePolicy
+xacml.referencedPolicies=
+xacml.rootPolicies=com.Config_SampleBasePolicy.1.xml
diff --git a/ONAP-PAP-REST/src/test/resources/pdps/xacml.properties b/ONAP-PAP-REST/src/test/resources/pdps/xacml.properties
new file mode 100644
index 000000000..a6b85a04f
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/resources/pdps/xacml.properties
@@ -0,0 +1,10 @@
+#
+#Wed Feb 14 16:29:58 EST 2018
+default.description=this is my new description.
+default.name=newtestgroup2
+default.pdps=http\://localhost\:8082/pdp/
+http\://localhost\:8082/pdp/.description=Registered on first startup
+http\://localhost\:8082/pdp/.jmxport=
+http\://localhost\:8082/pdp/.name=http\://localhost\:8082/pdp/
+xacml.pap.groups=testgroup2
+xacml.pap.groups.default=testgroup2