aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/forwarding-plugins/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-06 16:39:17 -0400
committerJim Hahn <jrh3@att.com>2021-05-06 16:48:30 -0400
commit8cd519ee397bd6661eddfeea1b989a99d1caac2e (patch)
tree0770d461c5afd76ecf7e603885cb7f2e936c654c /plugins/forwarding-plugins/src
parenta05cc62b6426d31c23f60dbe4a6f367331431ea4 (diff)
Fix sonars in policy-distribution
Fixed: - use "var" instead of actual type Issue-ID: POLICY-3285 Change-Id: I0dba2f96870722b4071ac0085287bc91a27dde88 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/forwarding-plugins/src')
-rw-r--r--plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarder.java10
-rw-r--r--plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java11
2 files changed, 9 insertions, 12 deletions
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarder.java
index 59d3efc8..b50d6ff3 100644
--- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarder.java
+++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/file/FilePolicyForwarder.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Intel Crop. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
+ * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -21,12 +21,10 @@
package org.onap.policy.distribution.forwarding.file;
-import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
-import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import org.onap.policy.common.parameters.ParameterService;
@@ -53,7 +51,7 @@ public class FilePolicyForwarder implements PolicyForwarder {
public void configure(final String parameterGroupName) {
fileForwarderParameters = ParameterService.get(parameterGroupName);
try {
- final Path path = Paths.get(fileForwarderParameters.getPath());
+ final var path = Paths.get(fileForwarderParameters.getPath());
if (!path.toFile().exists()) {
Files.createDirectories(path);
}
@@ -87,8 +85,8 @@ public class FilePolicyForwarder implements PolicyForwarder {
*/
private void forwardPolicy(final ToscaPolicy pol) throws PolicyForwardingException {
final String name = pol.getName();
- final Path path = Paths.get(fileForwarderParameters.getPath(), name);
- try (BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
+ final var path = Paths.get(fileForwarderParameters.getPath(), name);
+ try (var writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
writer.write("policyName: " + name);
if (fileForwarderParameters.isVerbose()) {
writer.newLine();
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java
index d45b07f6..b6f41fbf 100644
--- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java
+++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2020-2021 AT&T Inc.
+ * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.distribution.forwarding.lifecycle.api;
-import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -87,7 +86,7 @@ public class LifecycleApiPolicyForwarder implements PolicyForwarder {
Response policyCreated = null;
try {
if (entity instanceof ToscaServiceTemplate) {
- final ToscaServiceTemplate toscaServiceTemplate = (ToscaServiceTemplate) entity;
+ final var toscaServiceTemplate = (ToscaServiceTemplate) entity;
if (null != toscaServiceTemplate.getPolicyTypes() && !toscaServiceTemplate.getPolicyTypes().isEmpty()) {
createPolicyType(toscaServiceTemplate);
}
@@ -123,13 +122,13 @@ public class LifecycleApiPolicyForwarder implements PolicyForwarder {
}
private Response deployPolicy(final ToscaServiceTemplate toscaServiceTemplate) throws PolicyForwardingException {
- final PdpDeployPolicies pdpPolicies = new PdpDeployPolicies();
+ final var pdpPolicies = new PdpDeployPolicies();
final List<ToscaConceptIdentifierOptVersion> policyIdentifierList = new ArrayList<>();
for (final Map<String, ToscaPolicy> policyMap : toscaServiceTemplate.getToscaTopologyTemplate().getPolicies()) {
final String policyId = policyMap.entrySet().iterator().next().getValue().getMetadata().get("policy-id");
final String policyVersion =
policyMap.entrySet().iterator().next().getValue().getMetadata().get("policy-version");
- final ToscaConceptIdentifierOptVersion toscaPolicyIdentifier =
+ final var toscaPolicyIdentifier =
new ToscaConceptIdentifierOptVersion(policyId, policyVersion);
policyIdentifierList.add(toscaPolicyIdentifier);
}
@@ -141,7 +140,7 @@ public class LifecycleApiPolicyForwarder implements PolicyForwarder {
throws PolicyForwardingException {
Response response = null;
try {
- response = getHttpClient(wantApi).post(path, entity, ImmutableMap.of(HttpHeaders.ACCEPT,
+ response = getHttpClient(wantApi).post(path, entity, Map.of(HttpHeaders.ACCEPT,
MediaType.APPLICATION_JSON, HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON));
if (response.getStatus() / 100 != 2) {
LOGGER.error(