summaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src
diff options
context:
space:
mode:
authorTej, Tarun <tt3868@att.com>2017-09-19 23:14:33 -0400
committerTej, Tarun <tt3868@att.com>2017-09-20 00:12:17 -0400
commit98ab70838379e3e00a5596fdb32de81a814e2247 (patch)
tree65e379a54d08684cefb17f5c79140432dc9964fd /ONAP-PAP-REST/src
parente64508463caed53e661e4e02e1de971b21f642a7 (diff)
mysql connector to mariadb changes
changes to mysql connector to mariadb connector along with additional Junits Issue-Id: POLICY-219 Change-Id: I26ee1cf733d49d10fccbcd159fe8fc380120efbf Signed-off-by: Tej, Tarun <tt3868@att.com>
Diffstat (limited to 'ONAP-PAP-REST/src')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java4
-rw-r--r--ONAP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl119
-rw-r--r--ONAP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl118
-rw-r--r--ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml4
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java161
-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.java2
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java2
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java2
-rw-r--r--ONAP-PAP-REST/src/test/resources/xacml.pap.properties161
11 files changed, 333 insertions, 244 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
index 7c46990ab..483418c59 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -2156,7 +2156,7 @@ public class PolicyDBDao {
String prefix = null;
if (policy.policyAdapter.getPolicyType().equalsIgnoreCase("Config")) {
- prefix = configPath.substring(configPath.indexOf(policyScope+".")+policyScope.concat(".").length(), configPath.indexOf(policy.policyAdapter.getPolicyName()));
+ prefix = configPath.substring(configPath.indexOf(policyScope+".")+policyScope.concat(".").length(), configPath.lastIndexOf(policy.policyAdapter.getPolicyName()));
if(isNullOrEmpty(policy.policyAdapter.getConfigBodyData())){
String configData = "";
try{
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
index e6514469c..5d2b7f6c7 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
@@ -448,4 +448,8 @@ public class CommonClassDaoImpl implements CommonClassDao{
return null;
}
+ public static void setSessionfactory(SessionFactory sessionfactory) {
+ sessionFactory = sessionfactory;
+ }
+
} \ No newline at end of file
diff --git a/ONAP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl b/ONAP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl
deleted file mode 100644
index c12949aed..000000000
--- a/ONAP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl
+++ /dev/null
@@ -1,119 +0,0 @@
-CREATE TABLE PolicyEntity (policyId BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, policyData TEXT, policyName VARCHAR(255) NOT NULL, policyVersion INTEGER, scope VARCHAR(255) NOT NULL, version INTEGER, actionBodyId BIGINT, configurationDataId BIGINT, PRIMARY KEY (policyId))
-CREATE TABLE ConfigurationDataEntity (configurationDataId BIGINT NOT NULL, configBody TEXT, configType VARCHAR(255) NOT NULL, configurationName VARCHAR(255) NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, version INTEGER, PRIMARY KEY (configurationDataId))
-CREATE TABLE PolicyDBDaoEntity (policyDBDaoUrl VARCHAR NOT NULL, created_date TIMESTAMP, description VARCHAR(2048) NOT NULL, modified_date TIMESTAMP NOT NULL, password VARCHAR, username VARCHAR, PRIMARY KEY (policyDBDaoUrl))
-CREATE TABLE GroupEntity (groupKey BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, defaultGroup BOOLEAN NOT NULL, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, groupId VARCHAR NOT NULL, groupName VARCHAR(255) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, version INTEGER, PRIMARY KEY (groupKey))
-CREATE TABLE PdpEntity (pdpKey BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, jmxPort INTEGER NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, pdpId VARCHAR(255) NOT NULL, pdpName VARCHAR(255) NOT NULL, groupKey BIGINT, PRIMARY KEY (pdpKey))
-CREATE TABLE ActionBodyEntity (actionBodyId BIGINT NOT NULL, actionBody TEXT, actionBodyName VARCHAR(255) NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, version INTEGER, PRIMARY KEY (actionBodyId))
-CREATE TABLE DatabaseLockEntity (lock_key INTEGER NOT NULL, PRIMARY KEY (lock_key))
-CREATE TABLE PolicyVersion (id INTEGER NOT NULL, ACTIVE_VERSION INTEGER, CREATED_BY VARCHAR(45) NOT NULL, created_date TIMESTAMP NOT NULL, HIGHEST_VERSION INTEGER, modified_by VARCHAR(45) NOT NULL, modified_date TIMESTAMP NOT NULL, POLICY_NAME VARCHAR(255) NOT NULL, PRIMARY KEY (id))
-CREATE TABLE POLICYSCORE (id INTEGER NOT NULL, POLICY_NAME VARCHAR NOT NULL, POLICY_SCORE VARCHAR, VERSIONEXTENSION VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE FunctionDefinition (id INTEGER NOT NULL, arg_lb INTEGER NOT NULL, arg_ub INTEGER NOT NULL, ho_arg_lb INTEGER, ho_arg_ub INTEGER, ho_primitive CHAR, is_bag_return INTEGER NOT NULL, is_higher_order INTEGER NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL, return_datatype INTEGER, PRIMARY KEY (id))
-CREATE TABLE Attribute (id INTEGER NOT NULL, ATTRIBUTE_VALUE VARCHAR, created_date TIMESTAMP, description VARCHAR(2048), is_designator CHAR NOT NULL, modified_date TIMESTAMP NOT NULL, PRIORITY VARCHAR, selector_path VARCHAR(2048), xacml_id VARCHAR NOT NULL UNIQUE, category INTEGER, constraint_type INTEGER, datatype INTEGER, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE Category (id INTEGER NOT NULL, grouping VARCHAR(64) NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
-CREATE TABLE ConstraintType (id INTEGER NOT NULL, constraint_type VARCHAR(64) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY (id))
-CREATE TABLE ConstraintValues (id INTEGER NOT NULL, property VARCHAR, value VARCHAR, attribute_id INTEGER, PRIMARY KEY (id))
-CREATE TABLE Datatype (id INTEGER NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
-CREATE TABLE FunctionArguments (id INTEGER NOT NULL, arg_index INTEGER NOT NULL, is_bag INTEGER NOT NULL, datatype_id INTEGER, function_id INTEGER, PRIMARY KEY (id))
-CREATE TABLE UserInfo (loginid VARCHAR(45) NOT NULL, name VARCHAR NOT NULL UNIQUE, PRIMARY KEY (loginid))
-CREATE TABLE ActionPolicyDict (id INTEGER NOT NULL, ATTRIBUTE_NAME VARCHAR NOT NULL, Body VARCHAR, created_date TIMESTAMP, description VARCHAR(2048), Headers VARCHAR, Method VARCHAR NOT NULL, modified_date TIMESTAMP NOT NULL, Type VARCHAR NOT NULL, URL VARCHAR NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE DecisionSettings (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, PRIORITY VARCHAR, xacml_id VARCHAR NOT NULL UNIQUE, datatype INTEGER, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE MicroServiceModels (id INTEGER NOT NULL, annotation VARCHAR(2000) NOT NULL, attributes VARCHAR(255) NOT NULL, dependency VARCHAR(2048), description VARCHAR(2048), enumValues VARCHAR(2000) NOT NULL, modelName VARCHAR NOT NULL UNIQUE, ref_attributes VARCHAR(255) NOT NULL, sub_attributes VARCHAR(2000) NOT NULL, version VARCHAR(2000) NOT NULL, imported_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE actionlist (id INTEGER NOT NULL, actionname VARCHAR NOT NULL, description VARCHAR, PRIMARY KEY (id))
-CREATE TABLE AddressGroup (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, prefixlist VARCHAR, PRIMARY KEY (id))
-CREATE TABLE AttributeAssignment (id INTEGER NOT NULL, attribute_id INTEGER, expression VARCHAR NOT NULL, OBADVICE_id INTEGER, PRIMARY KEY (id))
-CREATE TABLE BRMSParamTemplate (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), rule LONGVARCHAR NOT NULL, param_template_name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE ClosedLoopD2Services (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, service_Name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE ClosedLoopSite (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, site_Name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE DCAEUsers (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE DCAEuuid (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE DescriptiveScope (Id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), scopename VARCHAR NOT NULL, modified_date TIMESTAMP NOT NULL, search VARCHAR, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (Id))
-CREATE TABLE OnapName (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, onap_Name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE EnforcingType (id INTEGER NOT NULL, connectionQuery VARCHAR(255) NOT NULL, enforcingType VARCHAR NOT NULL UNIQUE, script VARCHAR(255) NOT NULL, valueQuery VARCHAR(255) NOT NULL, PRIMARY KEY (id))
-CREATE TABLE GlobalRoleSettings (role VARCHAR(45) NOT NULL, lockdown BOOLEAN, PRIMARY KEY (role))
-CREATE TABLE GroupPolicyScopeList (id INTEGER NOT NULL, description VARCHAR, groupList VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE GroupServiceList (id INTEGER NOT NULL, name VARCHAR NOT NULL, serviceList VARCHAR, PRIMARY KEY (id))
-CREATE TABLE MicroServiceConfigName (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE MicroServiceLocation (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE Obadvice (id INTEGER NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP NOT NULL, description VARCHAR(2048), fulfill_on VARCHAR(32), modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, type VARCHAR NOT NULL, xacml_id VARCHAR(255) NOT NULL, PRIMARY KEY (id))
-CREATE TABLE ObadviceExpressions (id INTEGER NOT NULL, type VARCHAR NOT NULL, obadvice_id INTEGER, attribute_id INTEGER, PRIMARY KEY (id))
-CREATE TABLE PEPOptions (Id INTEGER NOT NULL, Actions VARCHAR, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, PEP_NAME VARCHAR NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (Id))
-CREATE TABLE PIPConfigParams (id INTEGER NOT NULL, PARAM_DEFAULT VARCHAR(2048), PARAM_NAME VARCHAR(1024) NOT NULL, PARAM_VALUE VARCHAR(2048) NOT NULL, REQUIRED CHAR NOT NULL, PIP_ID INTEGER, PRIMARY KEY (id))
-CREATE TABLE PIPConfiguration (id INTEGER NOT NULL, CLASSNAME VARCHAR(2048) NOT NULL, CREATED_BY VARCHAR(255) NOT NULL, CREATED_DATE TIMESTAMP NOT NULL, DESCRIPTION VARCHAR(2048), ISSUER VARCHAR(1024), MODIFIED_BY VARCHAR(255) NOT NULL, MODIFIED_DATE TIMESTAMP NOT NULL, NAME VARCHAR(255) NOT NULL, READ_ONLY CHAR NOT NULL, REQUIRES_RESOLVER CHAR NOT NULL, TYPE INTEGER, PRIMARY KEY (id))
-CREATE TABLE PIPResolver (id INTEGER NOT NULL, CLASSNAME VARCHAR(2048) NOT NULL, CREATED_BY VARCHAR(255) NOT NULL, CREATED_DATE TIMESTAMP NOT NULL, DESCRIPTION VARCHAR(2048), ISSUER VARCHAR(1024), MODIFIED_BY VARCHAR(255) NOT NULL, MODIFIED_DATE TIMESTAMP NOT NULL, NAME VARCHAR(255) NOT NULL, READ_ONLY CHAR NOT NULL, PIP_ID INTEGER, PRIMARY KEY (id))
-CREATE TABLE PIPResolverParams (id INTEGER NOT NULL, PARAM_DEFAULT VARCHAR(2048), PARAM_NAME VARCHAR(1024) NOT NULL, PARAM_VALUE VARCHAR(2048) NOT NULL, REQUIRED CHAR NOT NULL, ID_RESOLVER INTEGER, PRIMARY KEY (id))
-CREATE TABLE PIPType (id INTEGER NOT NULL, type VARCHAR(45) NOT NULL, PRIMARY KEY (id))
-CREATE TABLE PolicyAlgorithms (id INTEGER NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
-CREATE TABLE policy_manangement (id INTEGER NOT NULL, CONFIG_NAME VARCHAR(45) NOT NULL, CREATE_DATE_TIME TIMESTAMP NOT NULL, CREATED_BY VARCHAR(45) NOT NULL, ONAP_NAME VARCHAR(45) NOT NULL, POLICY_NAME VARCHAR(45) NOT NULL, scope VARCHAR(45) NOT NULL, UPDATE_DATE_TIME TIMESTAMP NOT NULL, UPDATED_BY VARCHAR(45) NOT NULL, XML CLOB NOT NULL, PRIMARY KEY (id))
-CREATE TABLE PolicyScopeService (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE PolicyScopeType (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE PolicyScopeResource (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE PolicyScopeClosedLoop (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE portlist (id INTEGER NOT NULL, description VARCHAR, portname VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE protocollist (id INTEGER NOT NULL, description VARCHAR, protocolname VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE RemoteCatalogValues (id INTEGER NOT NULL, name VARCHAR NOT NULL, value VARCHAR, PRIMARY KEY (id))
-CREATE TABLE roles (id INTEGER NOT NULL, role VARCHAR(45) NOT NULL, scope VARCHAR(45), loginid VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE RuleAlgorithms (id INTEGER NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
-CREATE TABLE securityzone (id INTEGER NOT NULL, name VARCHAR NOT NULL, value VARCHAR, PRIMARY KEY (id))
-CREATE TABLE servicegroup (id INTEGER NOT NULL, appprotocol VARCHAR, description VARCHAR, name VARCHAR NOT NULL, ports VARCHAR, transportprotocol VARCHAR, type VARCHAR, PRIMARY KEY (id))
-CREATE TABLE SystemLogDB (id INTEGER NOT NULL, date TIMESTAMP NOT NULL, description VARCHAR(2048), logtype VARCHAR(255) NOT NULL, remote VARCHAR(255) NOT NULL, system VARCHAR(255) NOT NULL, type VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE TERM (id INTEGER NOT NULL, action VARCHAR, created_date TIMESTAMP, destIPList VARCHAR, destPortList VARCHAR, fromzone VARCHAR, modified_date TIMESTAMP NOT NULL, portList VARCHAR, protocolList VARCHAR, srcIPList VARCHAR, srcPortList VARCHAR, description VARCHAR, termName VARCHAR NOT NULL, tozone VARCHAR, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE VarbindDictionary (Id INTEGER NOT NULL, created_date TIMESTAMP, modified_date TIMESTAMP NOT NULL, varbind_Description VARCHAR(2048), varbind_Name VARCHAR NOT NULL UNIQUE, varbind_oid VARCHAR NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (Id))
-CREATE TABLE VMType (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
-CREATE TABLE VNFType (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, vnf_type VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE VSCLAction (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, vscl_action VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
-CREATE TABLE zone (id INTEGER NOT NULL, zonename VARCHAR NOT NULL, zonevalue VARCHAR, PRIMARY KEY (id))
-CREATE TABLE BackUpMonitorEntity (id INTEGER NOT NULL, flag VARCHAR NOT NULL, notification_record LONGVARCHAR, resource_name VARCHAR NOT NULL UNIQUE, node_name VARCHAR NOT NULL, last_seen TIMESTAMP, PRIMARY KEY (id))
-CREATE TABLE StateManagementEntity (id BIGINT NOT NULL, adminState VARCHAR(20) NOT NULL, availStatus VARCHAR(20) NOT NULL, created_Date TIMESTAMP, modifiedDate TIMESTAMP NOT NULL, opState VARCHAR(20) NOT NULL, resourceName VARCHAR(100) NOT NULL UNIQUE, standbyStatus VARCHAR(20) NOT NULL, PRIMARY KEY (id))
-CREATE TABLE ForwardProgressEntity (forwardProgressId BIGINT NOT NULL, created_date TIMESTAMP, fpc_count BIGINT NOT NULL, last_updated TIMESTAMP, resourceName VARCHAR(100) NOT NULL UNIQUE, PRIMARY KEY (forwardProgressId))
-CREATE TABLE ResourceRegistrationEntity (ResourceRegistrationId BIGINT NOT NULL, created_date TIMESTAMP, last_updated TIMESTAMP, nodeType VARCHAR(50), resourceName VARCHAR(100) NOT NULL UNIQUE, resourceUrl VARCHAR(255) NOT NULL UNIQUE, site VARCHAR(50), PRIMARY KEY (ResourceRegistrationId))
-CREATE TABLE IntegrityAuditEntity (id BIGINT NOT NULL, createdDate TIMESTAMP, designated BOOLEAN, jdbcDriver VARCHAR NOT NULL, jdbcPassword VARCHAR NOT NULL, jdbcUrl VARCHAR NOT NULL, jdbcUser VARCHAR NOT NULL, lastUpdated TIMESTAMP, nodeType VARCHAR, persistenceUnit VARCHAR NOT NULL, resourceName VARCHAR NOT NULL UNIQUE, site VARCHAR, PRIMARY KEY (id))
-CREATE TABLE PolicyGroupEntity (groupKey BIGINT NOT NULL, policyId BIGINT NOT NULL, PRIMARY KEY (groupKey, policyId))
-ALTER TABLE PolicyEntity ADD CONSTRAINT FK_PolicyEntity_configurationDataId FOREIGN KEY (configurationDataId) REFERENCES ConfigurationDataEntity (configurationDataId)
-ALTER TABLE PolicyEntity ADD CONSTRAINT FK_PolicyEntity_actionBodyId FOREIGN KEY (actionBodyId) REFERENCES ActionBodyEntity (actionBodyId)
-ALTER TABLE PdpEntity ADD CONSTRAINT FK_PdpEntity_groupKey FOREIGN KEY (groupKey) REFERENCES GroupEntity (groupKey)
-ALTER TABLE FunctionDefinition ADD CONSTRAINT FK_FunctionDefinition_return_datatype FOREIGN KEY (return_datatype) REFERENCES Datatype (id)
-ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_category FOREIGN KEY (category) REFERENCES Category (id)
-ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_constraint_type FOREIGN KEY (constraint_type) REFERENCES ConstraintType (id)
-ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_datatype FOREIGN KEY (datatype) REFERENCES Datatype (id)
-ALTER TABLE ConstraintValues ADD CONSTRAINT FK_ConstraintValues_attribute_id FOREIGN KEY (attribute_id) REFERENCES Attribute (id)
-ALTER TABLE FunctionArguments ADD CONSTRAINT FK_FunctionArguments_function_id FOREIGN KEY (function_id) REFERENCES FunctionDefinition (id)
-ALTER TABLE FunctionArguments ADD CONSTRAINT FK_FunctionArguments_datatype_id FOREIGN KEY (datatype_id) REFERENCES Datatype (id)
-ALTER TABLE ActionPolicyDict ADD CONSTRAINT FK_ActionPolicyDict_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE ActionPolicyDict ADD CONSTRAINT FK_ActionPolicyDict_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE DecisionSettings ADD CONSTRAINT FK_DecisionSettings_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE DecisionSettings ADD CONSTRAINT FK_DecisionSettings_datatype FOREIGN KEY (datatype) REFERENCES Datatype (id)
-ALTER TABLE DecisionSettings ADD CONSTRAINT FK_DecisionSettings_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE MicroServiceModels ADD CONSTRAINT FK_MicroServiceModels_imported_by FOREIGN KEY (imported_by) REFERENCES UserInfo (loginid)
-ALTER TABLE AttributeAssignment ADD CONSTRAINT FK_AttributeAssignment_OBADVICE_id FOREIGN KEY (OBADVICE_id) REFERENCES Obadvice (id)
-ALTER TABLE BRMSParamTemplate ADD CONSTRAINT FK_BRMSParamTemplate_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE ClosedLoopD2Services ADD CONSTRAINT FK_ClosedLoopD2Services_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE ClosedLoopD2Services ADD CONSTRAINT FK_ClosedLoopD2Services_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE ClosedLoopSite ADD CONSTRAINT FK_ClosedLoopSite_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE ClosedLoopSite ADD CONSTRAINT FK_ClosedLoopSite_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE DescriptiveScope ADD CONSTRAINT FK_DescriptiveScope_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE DescriptiveScope ADD CONSTRAINT FK_DescriptiveScope_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE OnapName ADD CONSTRAINT FK_OnapName_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE OnapName ADD CONSTRAINT FK_OnapName_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE ObadviceExpressions ADD CONSTRAINT FK_ObadviceExpressions_obadvice_id FOREIGN KEY (obadvice_id) REFERENCES Obadvice (id)
-ALTER TABLE ObadviceExpressions ADD CONSTRAINT FK_ObadviceExpressions_attribute_id FOREIGN KEY (attribute_id) REFERENCES Attribute (id)
-ALTER TABLE PEPOptions ADD CONSTRAINT FK_PEPOptions_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE PEPOptions ADD CONSTRAINT FK_PEPOptions_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE PIPConfigParams ADD CONSTRAINT FK_PIPConfigParams_PIP_ID FOREIGN KEY (PIP_ID) REFERENCES PIPConfiguration (id)
-ALTER TABLE PIPConfiguration ADD CONSTRAINT FK_PIPConfiguration_TYPE FOREIGN KEY (TYPE) REFERENCES PIPType (id)
-ALTER TABLE PIPResolver ADD CONSTRAINT FK_PIPResolver_PIP_ID FOREIGN KEY (PIP_ID) REFERENCES PIPConfiguration (id)
-ALTER TABLE PIPResolverParams ADD CONSTRAINT FK_PIPResolverParams_ID_RESOLVER FOREIGN KEY (ID_RESOLVER) REFERENCES PIPResolver (id)
-ALTER TABLE roles ADD CONSTRAINT FK_roles_loginid FOREIGN KEY (loginid) REFERENCES UserInfo (loginid)
-ALTER TABLE TERM ADD CONSTRAINT FK_TERM_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE TERM ADD CONSTRAINT FK_TERM_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE VarbindDictionary ADD CONSTRAINT FK_VarbindDictionary_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE VarbindDictionary ADD CONSTRAINT FK_VarbindDictionary_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE VNFType ADD CONSTRAINT FK_VNFType_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE VNFType ADD CONSTRAINT FK_VNFType_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE VSCLAction ADD CONSTRAINT FK_VSCLAction_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
-ALTER TABLE VSCLAction ADD CONSTRAINT FK_VSCLAction_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
-ALTER TABLE PolicyGroupEntity ADD CONSTRAINT FK_PolicyGroupEntity_policyId FOREIGN KEY (policyId) REFERENCES PolicyEntity (policyId)
-ALTER TABLE PolicyGroupEntity ADD CONSTRAINT FK_PolicyGroupEntity_groupKey FOREIGN KEY (groupKey) REFERENCES GroupEntity (groupKey)
-CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT NUMERIC(38), PRIMARY KEY (SEQ_NAME))
-INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)
diff --git a/ONAP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl b/ONAP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl
deleted file mode 100644
index ce1769a4d..000000000
--- a/ONAP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl
+++ /dev/null
@@ -1,118 +0,0 @@
-ALTER TABLE PolicyEntity DROP CONSTRAINT FK_PolicyEntity_configurationDataId
-ALTER TABLE PolicyEntity DROP CONSTRAINT FK_PolicyEntity_actionBodyId
-ALTER TABLE PdpEntity DROP CONSTRAINT FK_PdpEntity_groupKey
-ALTER TABLE FunctionDefinition DROP CONSTRAINT FK_FunctionDefinition_return_datatype
-ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_category
-ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_constraint_type
-ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_created_by
-ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_modified_by
-ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_datatype
-ALTER TABLE ConstraintValues DROP CONSTRAINT FK_ConstraintValues_attribute_id
-ALTER TABLE FunctionArguments DROP CONSTRAINT FK_FunctionArguments_function_id
-ALTER TABLE FunctionArguments DROP CONSTRAINT FK_FunctionArguments_datatype_id
-ALTER TABLE ActionPolicyDict DROP CONSTRAINT FK_ActionPolicyDict_modified_by
-ALTER TABLE ActionPolicyDict DROP CONSTRAINT FK_ActionPolicyDict_created_by
-ALTER TABLE DecisionSettings DROP CONSTRAINT FK_DecisionSettings_created_by
-ALTER TABLE DecisionSettings DROP CONSTRAINT FK_DecisionSettings_datatype
-ALTER TABLE DecisionSettings DROP CONSTRAINT FK_DecisionSettings_modified_by
-ALTER TABLE MicroServiceModels DROP CONSTRAINT FK_MicroServiceModels_imported_by
-ALTER TABLE AttributeAssignment DROP CONSTRAINT FK_AttributeAssignment_OBADVICE_id
-ALTER TABLE BRMSParamTemplate DROP CONSTRAINT FK_BRMSParamTemplate_created_by
-ALTER TABLE ClosedLoopD2Services DROP CONSTRAINT FK_ClosedLoopD2Services_modified_by
-ALTER TABLE ClosedLoopD2Services DROP CONSTRAINT FK_ClosedLoopD2Services_created_by
-ALTER TABLE ClosedLoopSite DROP CONSTRAINT FK_ClosedLoopSite_modified_by
-ALTER TABLE ClosedLoopSite DROP CONSTRAINT FK_ClosedLoopSite_created_by
-ALTER TABLE DescriptiveScope DROP CONSTRAINT FK_DescriptiveScope_created_by
-ALTER TABLE DescriptiveScope DROP CONSTRAINT FK_DescriptiveScope_modified_by
-ALTER TABLE OnapName DROP CONSTRAINT FK_OnapName_modified_by
-ALTER TABLE OnapName DROP CONSTRAINT FK_OnapName_created_by
-ALTER TABLE ObadviceExpressions DROP CONSTRAINT FK_ObadviceExpressions_obadvice_id
-ALTER TABLE ObadviceExpressions DROP CONSTRAINT FK_ObadviceExpressions_attribute_id
-ALTER TABLE PEPOptions DROP CONSTRAINT FK_PEPOptions_modified_by
-ALTER TABLE PEPOptions DROP CONSTRAINT FK_PEPOptions_created_by
-ALTER TABLE PIPConfigParams DROP CONSTRAINT FK_PIPConfigParams_PIP_ID
-ALTER TABLE PIPConfiguration DROP CONSTRAINT FK_PIPConfiguration_TYPE
-ALTER TABLE PIPResolver DROP CONSTRAINT FK_PIPResolver_PIP_ID
-ALTER TABLE PIPResolverParams DROP CONSTRAINT FK_PIPResolverParams_ID_RESOLVER
-ALTER TABLE roles DROP CONSTRAINT FK_roles_loginid
-ALTER TABLE TERM DROP CONSTRAINT FK_TERM_modified_by
-ALTER TABLE TERM DROP CONSTRAINT FK_TERM_created_by
-ALTER TABLE VarbindDictionary DROP CONSTRAINT FK_VarbindDictionary_modified_by
-ALTER TABLE VarbindDictionary DROP CONSTRAINT FK_VarbindDictionary_created_by
-ALTER TABLE VNFType DROP CONSTRAINT FK_VNFType_modified_by
-ALTER TABLE VNFType DROP CONSTRAINT FK_VNFType_created_by
-ALTER TABLE VSCLAction DROP CONSTRAINT FK_VSCLAction_modified_by
-ALTER TABLE VSCLAction DROP CONSTRAINT FK_VSCLAction_created_by
-ALTER TABLE PolicyGroupEntity DROP CONSTRAINT FK_PolicyGroupEntity_policyId
-ALTER TABLE PolicyGroupEntity DROP CONSTRAINT FK_PolicyGroupEntity_groupKey
-DROP TABLE PolicyEntity
-DROP TABLE ConfigurationDataEntity
-DROP TABLE PolicyDBDaoEntity
-DROP TABLE GroupEntity
-DROP TABLE PdpEntity
-DROP TABLE ActionBodyEntity
-DROP TABLE DatabaseLockEntity
-DROP TABLE PolicyVersion
-DROP TABLE POLICYSCORE
-DROP TABLE FunctionDefinition
-DROP TABLE Attribute
-DROP TABLE Category
-DROP TABLE ConstraintType
-DROP TABLE ConstraintValues
-DROP TABLE Datatype
-DROP TABLE FunctionArguments
-DROP TABLE UserInfo
-DROP TABLE ActionPolicyDict
-DROP TABLE DecisionSettings
-DROP TABLE MicroServiceModels
-DROP TABLE actionlist
-DROP TABLE AddressGroup
-DROP TABLE AttributeAssignment
-DROP TABLE BRMSParamTemplate
-DROP TABLE ClosedLoopD2Services
-DROP TABLE ClosedLoopSite
-DROP TABLE DCAEUsers
-DROP TABLE DCAEuuid
-DROP TABLE DescriptiveScope
-DROP TABLE OnapName
-DROP TABLE EnforcingType
-DROP TABLE GlobalRoleSettings
-DROP TABLE GroupPolicyScopeList
-DROP TABLE GroupServiceList
-DROP TABLE MicroServiceConfigName
-DROP TABLE MicroServiceLocation
-DROP TABLE Obadvice
-DROP TABLE ObadviceExpressions
-DROP TABLE PEPOptions
-DROP TABLE PIPConfigParams
-DROP TABLE PIPConfiguration
-DROP TABLE PIPResolver
-DROP TABLE PIPResolverParams
-DROP TABLE PIPType
-DROP TABLE PolicyAlgorithms
-DROP TABLE policy_manangement
-DROP TABLE PolicyScopeService
-DROP TABLE PolicyScopeType
-DROP TABLE PolicyScopeResource
-DROP TABLE PolicyScopeClosedLoop
-DROP TABLE portlist
-DROP TABLE protocollist
-DROP TABLE RemoteCatalogValues
-DROP TABLE roles
-DROP TABLE RuleAlgorithms
-DROP TABLE securityzone
-DROP TABLE servicegroup
-DROP TABLE SystemLogDB
-DROP TABLE TERM
-DROP TABLE VarbindDictionary
-DROP TABLE VMType
-DROP TABLE VNFType
-DROP TABLE VSCLAction
-DROP TABLE zone
-DROP TABLE BackUpMonitorEntity
-DROP TABLE StateManagementEntity
-DROP TABLE ForwardProgressEntity
-DROP TABLE ResourceRegistrationEntity
-DROP TABLE IntegrityAuditEntity
-DROP TABLE PolicyGroupEntity
-DELETE FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'
diff --git a/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml b/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml
index b0a76c40a..7be95014d 100644
--- a/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml
+++ b/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml
@@ -190,8 +190,8 @@
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
- <property name="javax.persistence.schema-generation.scripts.create-target" value="./src/main/resources/META-INF/generatedCreate.ddl"/>
- <property name="javax.persistence.schema-generation.scripts.drop-target" value="./src/main/resources/META-INF/generatedDrop.ddl"/>
+ <property name="javax.persistence.schema-generation.scripts.create-target" value="./src/test/resources/generatedCreate.ddl"/>
+ <property name="javax.persistence.schema-generation.scripts.drop-target" value="./src/test/resources/generatedDrop.ddl"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.create-source" value="metadata-then-script"/>
<property name="javax.persistence.schema-generation.drop-source" value="script"/>
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
new file mode 100644
index 000000000..f110c5b6a
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
@@ -0,0 +1,161 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.pap.test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tomcat.dbcp.dbcp2.BasicDataSource;
+import org.hibernate.SessionFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
+import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
+import org.onap.policy.pap.xacml.rest.policycontroller.PolicyCreation;
+import org.onap.policy.utils.PolicyUtils;
+import org.onap.policy.xacml.std.pap.StdPAPPolicy;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockServletConfig;
+import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder;
+
+import com.mockrunner.mock.web.MockServletInputStream;
+
+
+public class XACMLPAPTest {
+
+ private static final String ENVIRONMENT_HEADER = "Environment";
+ private List<String> headers = new ArrayList<>();
+ private HttpServletRequest httpServletRequest;
+ private HttpServletResponse httpServletResponse;
+ private ServletOutputStream mockOutput;
+ private ServletConfig servletConfig;
+ private XACMLPapServlet pap;
+ private SessionFactory sessionFactory;
+
+ @Before
+ public void setUp() throws ServletException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers));
+ Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers));
+
+ servletConfig = Mockito.mock(MockServletConfig.class);
+ System.setProperty("com.sun.management.jmxremote.port", "9993");
+ Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers));
+ Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME"))
+ .thenReturn("src/test/resources/xacml.pap.properties");
+ pap = new XACMLPapServlet();
+ pap.init(servletConfig);
+ }
+
+ @Test
+ public void testFirwallCreatePolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ String json = "";
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Config");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("Firewall Config", "test", "testDescription", "Test", false, "test", json, 0,
+ "5","default", "false", "");
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Config_FW_test.1.xml");
+
+ }
+
+
+
+ private void setDBDao() throws SQLException {
+ BasicDataSource dataSource = new BasicDataSource();
+ dataSource.setDriverClassName("org.h2.Driver");
+ // In-memory DB for testing
+ dataSource.setUrl("jdbc:h2:mem:test");
+ dataSource.setUsername("sa");
+ dataSource.setPassword("");
+ LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
+ sessionBuilder.scanPackages("org.onap.*", "com.*");
+
+ Properties properties = new Properties();
+ properties.put("hibernate.show_sql", "false");
+ properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
+ properties.put("hibernate.hbm2ddl.auto", "drop");
+ properties.put("hibernate.hbm2ddl.auto", "create");
+
+ sessionBuilder.addProperties(properties);
+ sessionFactory = sessionBuilder.buildSessionFactory();
+
+ // Set up dao with SessionFactory
+ CommonClassDaoImpl.setSessionfactory(sessionFactory);
+ PolicyCreation.setCommonClassDao(new CommonClassDaoImpl());
+ }
+
+ @Test
+ public void testDummy() throws ServletException, IOException {
+
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("POST");
+ mockOutput = Mockito.mock(ServletOutputStream.class);
+
+ try {
+ Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput);
+ } catch (IOException e) {
+ fail();
+ }
+
+ try {
+ pap.service(httpServletRequest, httpServletResponse);
+ assertTrue(true);
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
+ @After
+ public void destroy(){
+ if(sessionFactory!=null){
+ sessionFactory.close();
+ }
+ pap.destroy();
+ }
+}
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 3adb94cd1..b93cca36d 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
@@ -57,7 +57,7 @@ public class ActionPolicyTest {
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"xacml.pap.properties");
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
dynamicRuleAlgorithmLabels.add("test");
dynamicRuleAlgorithmField1.add("testField1");
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 6d1d44605..3854ab984 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
@@ -65,7 +65,7 @@ public class DecisionPolicyTest {
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"xacml.pap.properties");
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
policyAdapter.setPolicyName("Test.Decision_junitTest.1.xml");
policyAdapter.setPolicyDescription("testing");
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java
index aed09ce61..1a97d7fad 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java
@@ -54,7 +54,7 @@ public class FirewallConfigPolicyTest {
@Before
public void setUp() throws Exception {
logger.info("setup: enter");
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"xacml.pap.properties");
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
policyAdapter.setPolicyName("FWjunitTest");
policyAdapter.setPolicyDescription("test");
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 14afa01ca..bba2afa21 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
@@ -68,7 +68,7 @@ public class PolicyDBDaoTest {
EntityManagerFactory emf;
@Before
public void init(){
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"xacml.pap.properties");
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME,"src/test/resources/xacml.pap.properties");
emf = Persistence.createEntityManagerFactory("testPapPU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
diff --git a/ONAP-PAP-REST/src/test/resources/xacml.pap.properties b/ONAP-PAP-REST/src/test/resources/xacml.pap.properties
new file mode 100644
index 000000000..f886435bf
--- /dev/null
+++ b/ONAP-PAP-REST/src/test/resources/xacml.pap.properties
@@ -0,0 +1,161 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP-PAP-REST
+# ================================================================================
+# Copyright (C) 2017 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+#=====================================================================================#
+#================The Below Properties are default, shouldn't change them==============#
+#=====================================================================================#
+#
+# This is our factory that will create our engine
+#
+xacml.PAP.papEngineFactory=org.onap.policy.xacml.std.pap.StdEngineFactory
+# Dictionary and Policy Implementation Classes Properties
+dictionary.impl.className=org.onap.policy.pap.xacml.rest.handler.DictionaryHandlerImpl
+savePolicy.impl.className=org.onap.policy.pap.xacml.rest.handler.SavePolicyHandler
+pushPolicy.impl.className=org.onap.policy.pap.xacml.rest.handler.PushPolicyHandler
+deletePolicy.impl.className=org.onap.policy.pap.xacml.rest.handler.DeleteHandler
+
+#=====================================================================================#
+#===============The Below Properties will be changed based on Environment=============#
+#=====================================================================================#
+#
+# Where we store our PAP PDP Group/Node information
+#
+xacml.pap.pdps=pdps
+#
+# Need the PAP's url (how PDPs will reach it) configured here
+# because we need it to generate the URLs of the Policy Files
+# sent to the PDPs in the configuration when the PAP is first brought up.
+# (In other cases, such as the PDP calling the PAP, we could generate this URL,
+# but for startup there is no other way to get it.)
+#
+#
+xacml.rest.pap.url=http://localhost:8070/pap/
+
+#
+# Upon startup, have the PAP servlet send latest configuration information to all
+# the PDP nodes it knows about.
+#
+xacml.rest.pap.initiate.pdp=true
+#
+# Heartbeat from PAP to PDPs
+#
+# How much time (in milliseconds) between heartbeats
+# (i.e. the time between completing the heartbeat with all PDPs and starting the next cycle)
+#
+xacml.rest.pap.heartbeat.interval=100000
+#
+# Heartbeat connection timeout (in milliseconds)
+#
+xacml.rest.pap.heartbeat.timeout=100000
+
+# new Property Please mention your PAP-REST webapps Location here.
+xacml.rest.config.webapps=src/test/resources/webapps/
+
+#Turn the audit on to synchronize the DB/file system
+#xacml.rest.pap.run.audit.flag=true
+#Turn the audit off to not synchronize the DB/file system
+#xacml.rest.pap.run.audit.flag=false
+xacml.rest.pap.run.audit.flag=true
+
+#Audit will synchronize the file system to match the contents of the DB
+#xacml.rest.pap.filesystem.audit=true
+#Audit will synchronize the DB to match the contents of the file system
+#xacml.rest.pap.filesystem.audit=false
+xacml.rest.pap.filesystem.audit=false
+xacm.xcor.required.pattern=1,1
+# id
+xacml.rest.pap.userid=testpap
+# pass
+xacml.rest.pap.password=alpha123
+# pdps file
+xacml.rest.pdp.idfile=test.properties
+
+#Properties for db access
+#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
+javax.persistence.jdbc.driver=org.h2.Driver
+javax.persistence.jdbc.url=jdbc:h2:file:./sql/xacmlTest
+javax.persistence.jdbc.user=sa
+javax.persistence.jdbc.password=
+
+#Time in ms which a Policy DB transaction will wait to get the transaction lock object
+xacml.rest.pap.transaction.waitms=500000
+
+#Policy DB transaction timeout in ms after it has obtained the transaction lock object
+xacml.rest.pap.transaction.timeoutms=500000
+
+#Policy Audit timeout in ms after it has obtained the transaction lock object
+xacml.rest.pap.audit.timeoutms=500000
+
+#controls how long the pap will wait before giving up when sending notifications to other paps
+xacml.rest.pap.notify.timeoutms=10000
+
+#the number of times an incoming policy update notification will be tried to be processed (or until it succeeds)
+xacml.rest.pap.incomingnotification.tries=4
+
+#***Properties for IntegrityMonitor integration defined in XACMLRestProperties.java***
+
+#The name of the PAP. Must be unique across the system
+xacml.rest.pap.resource.name=site_1.pap_1
+
+#***Properties for IntegrityMonitor integration defined in IntegrityMonitorProperties.java***
+
+#Interval between forward progress counter updates in seconds
+fp_monitor_interval=30
+
+#Number of forward progress counter failures before failover
+failed_counter_threshold=3
+
+#Interval in seconds between test transactions if there is no other traffic
+test_trans_interval=10
+
+#Interval in seconds between updates of the forward progress counter in the DB
+write_fpc_interval=5
+
+#Name of the site
+site_name=site_1
+
+#Node type. Can take values of: pdp-xacml, pdp-drools, pap, pap-admin, logparser, brms-gateway,
+#astra-gateway, elk-server
+node_type=pap
+
+#Dependency groups are groups of resources upon which a node operational state is dependent upon (dependency_groups).
+#Each group is a comma-separated list of resource names and groups are separated by a semicolon. A group may contain
+#one or more members.
+dependency_groups=site_1.logparser_1;site_1.adminconsole_1;site_1.elk_1
+
+# The (optional) period of time in seconds between executions of the integrity audit.
+# Value < 0 : Audit does not run (default value if property is not present = -1)
+# Value = 0 : Audit runs continuously
+# Value > 0 : The period of time in seconds between execution of the audit on a particular node
+integrity_audit_period_seconds=-1
+
+ENVIRONMENT=DEVL
+
+#
+#PolicySafetyChecker properties
+#
+#Turn safetyChecker on/off
+xacml.rest.pap.safetychecker=on
+PDP_URL1 = http://localhost:8082/pdp/, testpdp, alpha456
+CLIENT_ID=
+CLIENT_KEY=
+
+#Micro Service Model Properties
+xacml.policy.msOnapName=http://org.onap
+xacml.policy.msPolicyName=http://org.onap.policy \ No newline at end of file