summaryrefslogtreecommitdiffstats
path: root/artifactbroker/plugins/forwarding-plugins/src
diff options
context:
space:
mode:
authorliboNet <libo.zhu@intel.com>2019-04-17 05:25:58 +0800
committerliboNet <libo.zhu@intel.com>2019-04-17 06:02:40 +0800
commit88d98921926c194899a393aa08f4793afc026b8c (patch)
treeff8881712568ffff94a52d58dd742b326945bcb5 /artifactbroker/plugins/forwarding-plugins/src
parentdc1321b4c135242c67e94f5af57d0e39866ce2d8 (diff)
Fix the sonar issue and clm issue
. Fix the bugs by using try-with-resources method . Add unit test for GsonUtil . Fix the org.springframework : spring-web issue by removing the dependency in forwarding plugin Change-Id: I01f6461ea2a0f0363247dd3571dd56dcf68a7f90 Issue-ID: MULTICLOUD-569 Signed-off-by: liboNet <libo.zhu@intel.com>
Diffstat (limited to 'artifactbroker/plugins/forwarding-plugins/src')
-rw-r--r--artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpArtifactForwarder.java2
-rw-r--r--artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyAdapter.java53
-rw-r--r--artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/AbstractXacmlPdpPolicyAdapter.java54
-rw-r--r--artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/XacmlPdpOptimizationPolicyAdapter.java54
4 files changed, 0 insertions, 163 deletions
diff --git a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpArtifactForwarder.java b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpArtifactForwarder.java
index 3fe6dd8..4179fc7 100644
--- a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpArtifactForwarder.java
+++ b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpArtifactForwarder.java
@@ -52,12 +52,10 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.ArtifactForwarder;
-import org.onap.policy.distribution.forwarding.xacml.pdp.adapters.XacmlPdpOptimizationPolicyAdapter;
import org.onap.policy.distribution.model.CloudArtifact;
import org.onap.policy.distribution.model.PolicyInput;
import org.onap.policy.distribution.model.VfModuleModel;
import org.onap.sdc.api.notification.IArtifactInfo;
-import org.springframework.http.HttpStatus;
/**
diff --git a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyAdapter.java b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyAdapter.java
deleted file mode 100644
index c50eac1..0000000
--- a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyAdapter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.forwarding.xacml.pdp;
-
-import org.onap.policy.api.PolicyParameters;
-import org.onap.policy.api.PushPolicyParameters;
-import org.onap.policy.distribution.model.Policy;
-
-/**
- * Adapts {@link Policy} objects to objects compatible with the XACML PDP API.
- */
-public interface XacmlPdpPolicyAdapter<T extends Policy> {
-
- /**
- * Get the policy.
- *
- * @return the policy
- */
- T getPolicy();
-
- /**
- * Get as a {@link PolicyParameters} object.
- *
- * @returna {@link PolicyParameters} object
- */
- PolicyParameters getAsPolicyParameters();
-
- /**
- * Get as a {@link PushPolicyParameters} object.
- *
- * @returna {@link PushPolicyParameters} object
- */
- PushPolicyParameters getAsPushPolicyParameters(final String pdpGroups);
-
-}
diff --git a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/AbstractXacmlPdpPolicyAdapter.java b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/AbstractXacmlPdpPolicyAdapter.java
deleted file mode 100644
index c136516..0000000
--- a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/AbstractXacmlPdpPolicyAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.forwarding.xacml.pdp.adapters;
-
-import org.onap.policy.api.PushPolicyParameters;
-import org.onap.policy.distribution.forwarding.xacml.pdp.XacmlPdpPolicyAdapter;
-import org.onap.policy.distribution.model.Policy;
-
-/**
- * Base class for {@link XacmlPdpPolicyAdapter} implementations.
- *
- * @param <T> the type of policy the adapter handles
- */
-public abstract class AbstractXacmlPdpPolicyAdapter<T extends Policy> implements XacmlPdpPolicyAdapter<T> {
-
- private T policy;
-
- protected AbstractXacmlPdpPolicyAdapter(T policy) {
- this.policy = policy;
- }
-
- @Override
- public T getPolicy() {
- return policy;
- }
-
- @Override
- public PushPolicyParameters getAsPushPolicyParameters(String pdpGroups) {
- PushPolicyParameters pushPolicyParameters = new PushPolicyParameters();
- pushPolicyParameters.setPolicyName(policy.getPolicyName());
- pushPolicyParameters.setPolicyType(policy.getPolicyType());
- pushPolicyParameters.setPdpGroup(pdpGroups);
- return pushPolicyParameters;
- }
-
-}
diff --git a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/XacmlPdpOptimizationPolicyAdapter.java b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/XacmlPdpOptimizationPolicyAdapter.java
deleted file mode 100644
index 1ec654f..0000000
--- a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/adapters/XacmlPdpOptimizationPolicyAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.forwarding.xacml.pdp.adapters;
-
-import org.onap.policy.api.PolicyConfigType;
-import org.onap.policy.api.PolicyParameters;
-import org.onap.policy.distribution.model.OptimizationPolicy;
-
-/**
- * Adapts {@link OptimizationPolicy} objects to objects compatible with the XACML PDP API.
- */
-public class XacmlPdpOptimizationPolicyAdapter extends AbstractXacmlPdpPolicyAdapter<OptimizationPolicy> {
-
- /**
- * Create an instance to adapt the given {@link OptimizationPolicy}.
- *
- * @param optimizationPolicy the {@link OptimizationPolicy} to be adapted
- */
- public XacmlPdpOptimizationPolicyAdapter(final OptimizationPolicy optimizationPolicy) {
- super(optimizationPolicy);
- }
-
- @Override
- public PolicyParameters getAsPolicyParameters() {
- PolicyParameters policyParameters = new PolicyParameters();
- policyParameters.setPolicyName(getPolicy().getPolicyName());
- policyParameters.setPolicyDescription(getPolicy().getPolicyDescription());
- policyParameters.setPolicyConfigType(PolicyConfigType.valueOf(getPolicy().getPolicyConfigType()));
- policyParameters.setOnapName(getPolicy().getOnapName());
- policyParameters.setRiskLevel(getPolicy().getRiskLevel());
- policyParameters.setConfigBody(getPolicy().getConfigBody());
- policyParameters.setRiskType(getPolicy().getRiskType());
- return policyParameters;
- }
-
-}