From 172b8dcd3a772c03ec1d233cfd6602d901c61b99 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Thu, 5 Mar 2020 07:55:57 -0500 Subject: TOSCA Compliant Guard Policies Fixing the legacy guard policies and renaming them so we are able to differentiate them. Adding newer, cleaner TOSCA Guard Policies that match the operational guard policies. Removing legacy guard policies. Fixing JUnit so that they don't use indexes to test whether versions are changed correctly. Added back in new guard policies. Fixed the guard policy types to use camel case. Issue-ID: POLICY-2243 Change-Id: Ie611f26f73f41e64c0b467f524f470739158f437 Signed-off-by: Pamela Dragosh --- .../models/provider/PolicyModelsProvider.java | 45 ---------------------- .../impl/DatabasePolicyModelsProviderImpl.java | 35 ----------------- .../impl/DummyPolicyModelsProviderImpl.java | 28 -------------- 3 files changed, 108 deletions(-) (limited to 'models-provider/src/main/java') diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java index 767a0fb6f..a8fc4ed73 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java @@ -22,7 +22,6 @@ package org.onap.policy.models.provider; import java.util.Date; import java.util.List; -import java.util.Map; import lombok.NonNull; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.pdp.concepts.Pdp; @@ -35,8 +34,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; -import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy; /** @@ -238,48 +235,6 @@ public interface PolicyModelsProvider extends AutoCloseable { public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId, @NonNull final String policyVersion) throws PfModelException; - /** - * Get legacy guard policy. - * - * @param policyId ID of the policy - * @param policyVersion version of the policy, set to null to get the latest policy - * @return the policies found - * @throws PfModelException on errors getting policies - */ - public Map getGuardPolicy(@NonNull final String policyId, - final String policyVersion) throws PfModelException; - - /** - * Create legacy guard policy. - * - * @param legacyGuardPolicy the definition of the policy to be created. - * @return the created policy - * @throws PfModelException on errors creating policies - */ - public Map createGuardPolicy( - @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException; - - /** - * Update legacy guard policy. - * - * @param legacyGuardPolicy the definition of the policy to be updated - * @return the updated policy - * @throws PfModelException on errors updating policies - */ - public Map updateGuardPolicy( - @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException; - - /** - * Delete legacy guard policy. - * - * @param policyId ID of the policy. - * @param policyVersion version of the policy - * @return the deleted policy - * @throws PfModelException on errors deleting policies - */ - public Map deleteGuardPolicy(@NonNull final String policyId, - @NonNull final String policyVersion) throws PfModelException; - /** * Get PDP groups. * diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java index 3cae650a3..195b88247 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java @@ -24,7 +24,6 @@ package org.onap.policy.models.provider.impl; import java.util.Base64; import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Properties; import javax.ws.rs.core.Response; @@ -55,8 +54,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.authorative.provider.AuthorativeToscaProvider; -import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; -import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy; import org.onap.policy.models.tosca.legacy.provider.LegacyProvider; import org.slf4j.Logger; @@ -279,38 +276,6 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { return new LegacyProvider().deleteOperationalPolicy(pfDao, policyId, policyVersion); } - @Override - public Map getGuardPolicy(@NonNull final String policyId, - final String policyVersion) throws PfModelException { - assertInitialized(); - return new LegacyProvider().getGuardPolicy(pfDao, policyId, policyVersion); - } - - @Override - public Map - createGuardPolicy(@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException { - assertInitialized(); - return new LegacyProvider().createGuardPolicy(pfDao, legacyGuardPolicy); - } - - @Override - public Map - updateGuardPolicy(@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException { - assertInitialized(); - return new LegacyProvider().updateGuardPolicy(pfDao, legacyGuardPolicy); - } - - @Override - public Map deleteGuardPolicy(@NonNull final String policyId, - @NonNull final String policyVersion) throws PfModelException { - assertInitialized(); - - assertPolicyNotDeployedInPdpGroup( - new ToscaPolicyIdentifier(policyId, policyVersion + LegacyProvider.LEGACY_MINOR_PATCH_SUFFIX)); - - return new LegacyProvider().deleteGuardPolicy(pfDao, policyId, policyVersion); - } - @Override public List getPdpGroups(final String name) throws PfModelException { assertInitialized(); diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index c09c6c233..aece188f9 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -23,9 +23,7 @@ package org.onap.policy.models.provider.impl; import java.util.ArrayList; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.ws.rs.core.Response; @@ -45,8 +43,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; -import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy; /** @@ -170,30 +166,6 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { return new LegacyOperationalPolicy(); } - @Override - public Map getGuardPolicy(final String policyId, final String policyVersion) - throws PfModelException { - return new HashMap<>(); - } - - @Override - public Map createGuardPolicy(final LegacyGuardPolicyInput legacyGuardPolicy) - throws PfModelException { - return new HashMap<>(); - } - - @Override - public Map updateGuardPolicy(final LegacyGuardPolicyInput legacyGuardPolicy) - throws PfModelException { - return new HashMap<>(); - } - - @Override - public Map deleteGuardPolicy(final String policyId, final String policyVersion) - throws PfModelException { - return new HashMap<>(); - } - @Override public List getPdpGroups(final String name) throws PfModelException { return new ArrayList<>(); -- cgit 1.2.3-korg