From e0addf5b588a1244f9679becd90999dfcb4c3a94 Mon Sep 17 00:00:00 2001 From: "ITSERVICES\\rb7147" Date: Tue, 25 Apr 2017 11:46:00 -0400 Subject: Policy 1707 commit to LF Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 --- .../pap/xacml/rest/components/PolicyDBDaoTest.java | 44 +++++++++------------- 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java') diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java index 81f33c99b..1009e03bc 100644 --- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java +++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java @@ -36,41 +36,34 @@ import javax.persistence.Persistence; import javax.persistence.PersistenceException; import javax.persistence.Query; +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.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter; -import org.openecomp.policy.pap.xacml.rest.components.ConfigPolicy; -import org.openecomp.policy.pap.xacml.rest.components.Policy; -import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao; -import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDaoTransaction; +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao.PolicyDBDaoTestClass; import org.openecomp.policy.rest.XACMLRestProperties; +import org.openecomp.policy.rest.adapter.PolicyRestAdapter; import org.openecomp.policy.rest.jpa.ActionBodyEntity; import org.openecomp.policy.rest.jpa.GroupEntity; import org.openecomp.policy.rest.jpa.PdpEntity; import org.openecomp.policy.rest.jpa.PolicyEntity; import org.openecomp.policy.rest.util.Webapps; - -import com.att.research.xacml.api.pap.PAPException; - import org.openecomp.policy.xacml.api.pap.EcompPDPGroup; import org.openecomp.policy.xacml.std.pap.StdPDPGroup; import org.openecomp.policy.xacml.util.XACMLPolicyWriter; -import com.att.research.xacml.util.XACMLProperties; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; -import org.junit.Before; -import org.junit.After; -import org.junit.Ignore; +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 org.junit.Assert; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; - @Ignore //only run locally as timing sometimes causes failures on Jenkins public class PolicyDBDaoTest { @@ -180,14 +173,14 @@ public class PolicyDBDaoTest { // Assert.fail(); // } String filePath = null; - String xmlFile = "\n\n \n \n \n \n \n 99\n \n \n \n \n \n \n \n \n \n \n PDPAction\n \n \n REST\n \n \n http://localhost:8056/pcd\n \n \n GET\n \n \n $URLaction/com.Action_patbaction7.json\n \n \n \n \n\n"; + String xmlFile = "\n\n \n \n \n \n \n 99\n \n \n \n \n \n \n \n \n \n \n PDPAction\n \n \n REST\n \n \n http://localhost:8056/pcd\n \n \n GET\n \n \n $URLaction/com.Action_patbaction7.json\n \n \n \n \n\n"; String jsonFile = "{\"actionAttribute\":\"Memory\"}"; try{ //policy file InputStream in = new ByteArrayInputStream(xmlFile.getBytes()); String workspaceDir = "src/test/resources/junitTestCreatedDirectory/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE)+"/admin/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY); - FileUtils.forceMkdir(new File(workspaceDir+"/org/openecomp")); + FileUtils.forceMkdir(new File(workspaceDir+"/com/att")); File outFile = new File(workspaceDir+"/org/openecomp/Action_mypol.xml"); OutputStream out = new FileOutputStream(outFile); IOUtils.copy(in, out); @@ -283,7 +276,7 @@ public class PolicyDBDaoTest { } willFail.close(); - fakeFile = new File("directorythatdoesnotexist/"+workspaceDir+"org/openecomp/Action_mypol2.xml"); + fakeFile = new File("directorythatdoesnotexist/"+workspaceDir+"com/att/Action_mypol2.xml"); willFail = dbd.getNewTransaction(); try{ willFail.createPolicy(fakeFile.getAbsolutePath(), "user1"); @@ -319,7 +312,7 @@ public class PolicyDBDaoTest { @Test public void createFromPolicyObject(){ String workspaceDir = "src/test/resources/junitTestCreatedDirectory/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE)+"/admin/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY); - File parentPath = new File(workspaceDir+"/org/openecomp"); + File parentPath = new File(workspaceDir+"/com/att"); File scope = new File(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE)+"/admin/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY)); Policy policyObject = new ConfigPolicy(); policyObject.policyAdapter = new PolicyRestAdapter(); @@ -635,7 +628,6 @@ public class PolicyDBDaoTest { System.out.println("Decrypted password: "+decr); Assert.assertEquals("testpassword", decr); } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); Assert.fail(); } @@ -670,7 +662,6 @@ public class PolicyDBDaoTest { } Thread.sleep(sleepTime); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } if(logger.isDebugEnabled()){ @@ -712,7 +703,6 @@ public class PolicyDBDaoTest { } Thread.sleep(sleepTime); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } if(logger.isDebugEnabled()){ -- cgit 1.2.3-korg