aboutsummaryrefslogtreecommitdiffstats
path: root/models-provider/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-05 07:55:57 -0500
committerPamela Dragosh <pdragosh@research.att.com>2020-03-06 08:37:31 -0500
commit172b8dcd3a772c03ec1d233cfd6602d901c61b99 (patch)
treeddc93d353d4a087f729517befd103f75e0cd5102 /models-provider/src/main
parent2358a161a4bbd0f0c97696b61fd725c33f7267e6 (diff)
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 <pdragosh@research.att.com>
Diffstat (limited to 'models-provider/src/main')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java45
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java35
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java28
3 files changed, 0 insertions, 108 deletions
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;
/**
@@ -239,48 +236,6 @@ public interface PolicyModelsProvider extends AutoCloseable {
@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<String, LegacyGuardPolicyOutput> 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<String, LegacyGuardPolicyOutput> 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<String, LegacyGuardPolicyOutput> 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<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId,
- @NonNull final String policyVersion) throws PfModelException;
-
- /**
* Get PDP groups.
*
* @param name the name of the policy to get, null to get all 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;
@@ -280,38 +277,6 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId,
- final String policyVersion) throws PfModelException {
- assertInitialized();
- return new LegacyProvider().getGuardPolicy(pfDao, policyId, policyVersion);
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput>
- createGuardPolicy(@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
- assertInitialized();
- return new LegacyProvider().createGuardPolicy(pfDao, legacyGuardPolicy);
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput>
- updateGuardPolicy(@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
- assertInitialized();
- return new LegacyProvider().updateGuardPolicy(pfDao, legacyGuardPolicy);
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput> 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<PdpGroup> getPdpGroups(final String name) throws PfModelException {
assertInitialized();
return new PdpProvider().getPdpGroups(pfDao, name);
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;
/**
@@ -171,30 +167,6 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(final String policyId, final String policyVersion)
- throws PfModelException {
- return new HashMap<>();
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(final LegacyGuardPolicyInput legacyGuardPolicy)
- throws PfModelException {
- return new HashMap<>();
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(final LegacyGuardPolicyInput legacyGuardPolicy)
- throws PfModelException {
- return new HashMap<>();
- }
-
- @Override
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(final String policyId, final String policyVersion)
- throws PfModelException {
- return new HashMap<>();
- }
-
- @Override
public List<PdpGroup> getPdpGroups(final String name) throws PfModelException {
return new ArrayList<>();
}