From 535c4e4717ce2e926026d085a8064f2308a2b375 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Tue, 26 May 2015 04:05:20 -0400 Subject: [PATCH] Fixing policy deletion --- .../carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java | 4 ++-- .../wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java index 09626d9c3d..92e54dde6c 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java @@ -1181,7 +1181,7 @@ public class PolicyDAOImpl implements PolicyDAO { stmt.executeUpdate(); - String locationPolicy = "DELETE FROM DM_LOCATION WHERE POLICY_ID = ?"; + /*String locationPolicy = "DELETE FROM DM_LOCATION WHERE POLICY_ID = ?"; stmt = conn.prepareStatement(locationPolicy); stmt.setInt(1, policyId); stmt.executeUpdate(); @@ -1196,7 +1196,7 @@ public class PolicyDAOImpl implements PolicyDAO { String datePolicy = "DELETE FROM DM_DATE WHERE POLICY_ID = ?"; stmt = conn.prepareStatement(datePolicy); stmt.setInt(1, policyId); - stmt.executeUpdate(); + stmt.executeUpdate();*/ String deleteCriteria = "DELETE FROM DM_POLICY_CRITERIA WHERE POLICY_ID = ?"; diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java index 720e24a950..f1feec859f 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java @@ -405,4 +405,13 @@ public class PolicyDAOTestCase { } + @Test(dependsOnMethods = ("getRoleRelatedPolicyThirdTime")) + public void deletPolicy() throws PolicyManagementException { + PolicyAdministratorPoint policyAdministratorPoint = new PolicyAdministratorPointImpl(); + policyAdministratorPoint.deletePolicy(1); + + log.debug("First policy deleted."); + } + + }