From cad8b87bffb3b10c67f8b68ce8fcee5e5a3dcc35 Mon Sep 17 00:00:00 2001
From: Jim Hahn
Date: Thu, 17 Jun 2021 17:35:26 -0400
Subject: Use lombok annotations for aai, appc, appclcm, cds
Issue-ID: POLICY-3396
Change-Id: I81b6b0c7929809ffaeadadd6144e9b9f394bfdc8
Signed-off-by: Jim Hahn
---
.../java/org/onap/policy/aai/AaiConstants.java | 12 ++---
.../main/java/org/onap/policy/aai/AaiManager.java | 15 ++-----
.../org/onap/policy/aai/util/Serialization.java | 9 ++--
.../java/org/onap/policy/appc/CommonHeader.java | 17 +++----
.../main/java/org/onap/policy/appc/Request.java | 17 +++----
.../main/java/org/onap/policy/appc/Response.java | 15 +++----
.../java/org/onap/policy/appc/ResponseStatus.java | 52 ++--------------------
.../org/onap/policy/appc/util/Serialization.java | 7 ++-
.../org/onap/policy/appc/CommonHeaderTest.java | 3 +-
.../java/org/onap/policy/appc/RequestTest.java | 3 +-
.../org/onap/policy/appc/ResponseStatusTest.java | 5 ++-
.../java/org/onap/policy/appc/ResponseTest.java | 5 ++-
.../onap/policy/appclcm/AppcLcmResponseCode.java | 15 +++----
.../onap/policy/appclcm/util/Serialization.java | 7 ++-
.../main/java/org/onap/policy/cds/CdsResponse.java | 9 +---
.../client/BasicAuthClientHeaderInterceptor.java | 8 ++--
.../policy/cds/client/CdsProcessorHandler.java | 7 +--
17 files changed, 61 insertions(+), 145 deletions(-)
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiConstants.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiConstants.java
index 084e4a504..e6c46e5e2 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiConstants.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiConstants.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -20,15 +20,15 @@
package org.onap.policy.aai;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* Constants used with A&AI classes.
*/
-public class AaiConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class AaiConstants {
public static final String ACTOR_NAME = "AAI";
public static final String CONTEXT_PREFIX = ACTOR_NAME + ".";
-
- private AaiConstants() {
- // do nothing
- }
}
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
index b2a410733..a6a671815 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
+import lombok.AllArgsConstructor;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -44,6 +45,7 @@ import org.slf4j.LoggerFactory;
/**
* This class handles communication towards and responses from A&AI for this module.
*/
+@AllArgsConstructor
public final class AaiManager {
// TODO remove this class
@@ -55,9 +57,6 @@ public final class AaiManager {
private static final StandardCoder CODER = new StandardCoder();
- // The REST manager used for processing REST calls for this AAI manager
- private final RestManager restManager;
-
/** custom query and other AAI resource URLs. */
private static final String CQ_URL = "/aai/v21/query?format=resource";
private static final String TENANT_URL = "/aai/v21/search/nodes-query?"
@@ -66,14 +65,8 @@ public final class AaiManager {
private static final String PNF_URL = PREFIX + "/network/pnfs/pnf/";
private static final String AAI_DEPTH_SUFFIX = "?depth=0";
- /**
- * Constructor, create the AAI manager with the specified REST manager.
- *
- * @param restManager the rest manager to use for REST calls
- */
- public AaiManager(final RestManager restManager) {
- this.restManager = restManager;
- }
+ // The REST manager used for processing REST calls for this AAI manager
+ private final RestManager restManager;
/**
* Creates the custom query payload from a tenant query response.
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
index 7a14a854f..4b2be050a 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,12 +23,11 @@ package org.onap.policy.aai.util;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Serialization {
public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
-
- private Serialization() {
- // Private constructor to prevent subclassing
- }
}
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
index d48d7250c..e2b6be268 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,11 +30,15 @@ import java.util.Map;
import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
+import lombok.ToString;
@Getter
@Setter
@EqualsAndHashCode
+@NoArgsConstructor
+@ToString
public class CommonHeader implements Serializable {
private static final long serialVersionUID = -3581658269910980336L;
@@ -59,10 +63,6 @@ public class CommonHeader implements Serializable {
@SerializedName("Flags")
private Collection
*/
+@AllArgsConstructor
public class BasicAuthClientHeaderInterceptor implements ClientInterceptor {
static final String BASIC_AUTH_HEADER_KEY = "Authorization";
private CdsServerProperties props;
- BasicAuthClientHeaderInterceptor(CdsServerProperties props) {
- this.props = props;
- }
-
@Override
public ClientCall interceptCall(MethodDescriptor method,
CallOptions callOptions, Channel channel) {
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
index bb7a038db..6c4d6caab 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
@@ -22,6 +22,7 @@ package org.onap.policy.cds.client;
import io.grpc.ManagedChannel;
import io.grpc.stub.StreamObserver;
import java.util.concurrent.CountDownLatch;
+import lombok.AllArgsConstructor;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
@@ -33,6 +34,7 @@ import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@AllArgsConstructor
public class CdsProcessorHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CdsProcessorHandler.class);
private static final String LOG_MSG = "[{}|{}|{}|]{}{}";
@@ -40,11 +42,6 @@ public class CdsProcessorHandler {
private CdsProcessorListener listener;
private String url;
- CdsProcessorHandler(final CdsProcessorListener listener, String url) {
- this.listener = listener;
- this.url = url;
- }
-
CountDownLatch process(ExecutionServiceInput request, ManagedChannel channel) {
final var header = request.getActionIdentifiers();
LOGGER.info("Processing blueprint({}:{}) for action({})", header.getBlueprintVersion(),
--
cgit 1.2.3-korg