summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java4
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java4
-rw-r--r--models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java4
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java12
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java4
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java17
-rw-r--r--models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java7
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java22
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java14
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java12
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java6
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java22
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java23
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java7
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java9
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java4
-rw-r--r--models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java4
-rw-r--r--models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java8
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java6
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/DelayedIdentString.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationFinalResult.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/ActorImpl.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java5
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java18
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperatorPartial.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java4
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java50
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java16
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java6
-rw-r--r--models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmResponseCode.java4
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorGrpcClient.java8
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java9
-rw-r--r--models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java26
-rw-r--r--models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java3
-rw-r--r--models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java4
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java15
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java6
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java12
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java9
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java5
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java2
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/ConsumerGroupData.java4
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/TopicData.java4
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java11
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java4
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java5
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java6
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java6
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java12
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java4
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java3
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java12
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java11
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java20
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterHandler.java2
-rw-r--r--models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java12
-rw-r--r--models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java2
65 files changed, 269 insertions, 287 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
index 27dd56c60..ca3a55ced 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.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.
@@ -76,7 +76,7 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
final Map<String, String> request = makeRequest();
Map<String, Object> headers = makeHeaders();
- StringBuilder str = new StringBuilder(getClient().getBaseUrl());
+ var str = new StringBuilder(getClient().getBaseUrl());
String path = getPath();
WebTarget web = getClient().getWebTarget().path(path);
@@ -89,7 +89,7 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
webldr.header(header.getKey(), header.getValue());
}
- String url = str.toString();
+ var url = str.toString();
String strRequest = prettyPrint(request);
logMessage(EventType.OUT, CommInfrastructure.REST, url, strRequest);
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
index 1f19918e1..839fe139c 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
@@ -70,7 +70,7 @@ public class AaiGetPnfOperation extends AaiGetOperation {
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
Map<String, Object> headers = makeHeaders();
- StringBuilder str = new StringBuilder(getClient().getBaseUrl());
+ var str = new StringBuilder(getClient().getBaseUrl());
String target = getRequiredProperty(OperationProperties.AAI_TARGET_ENTITY, "target entity");
String path = getPath() + URI_SEP + URLEncoder.encode(target, StandardCharsets.UTF_8);
@@ -82,7 +82,7 @@ public class AaiGetPnfOperation extends AaiGetOperation {
Builder webldr = web.request();
addHeaders(webldr, headers);
- String url = str.toString();
+ var url = str.toString();
logMessage(EventType.OUT, CommInfrastructure.REST, url, null);
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
index 412e463eb..4f09dcb51 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
@@ -67,7 +67,7 @@ public class AaiGetTenantOperation extends AaiGetOperation {
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
final Map<String, Object> headers = makeHeaders();
- StringBuilder str = new StringBuilder(getClient().getBaseUrl());
+ var str = new StringBuilder(getClient().getBaseUrl());
String path = getPath();
WebTarget web = getClient().getWebTarget().path(path);
@@ -81,7 +81,7 @@ public class AaiGetTenantOperation extends AaiGetOperation {
Builder webldr = web.request();
addHeaders(webldr, headers);
- String url = str.toString();
+ var url = str.toString();
logMessage(EventType.OUT, CommInfrastructure.REST, url, null);
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
index 31b4aec6e..b8ec634e3 100644
--- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
@@ -79,7 +79,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request,
* @return a new request
*/
protected Request makeRequest(int attempt, GenericVnf targetVnf) {
- Request request = new Request();
+ var request = new Request();
request.setCommonHeader(new CommonHeader());
request.getCommonHeader().setRequestId(params.getRequestId());
request.getCommonHeader().setSubRequestId(getSubRequestId());
@@ -139,7 +139,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request,
return Status.STILL_WAITING;
}
- ResponseCode code = ResponseCode.toResponseCode(response.getStatus().getCode());
+ var code = ResponseCode.toResponseCode(response.getStatus().getCode());
if (code == null) {
throw new IllegalArgumentException(
"unknown APPC-C response status code: " + response.getStatus().getCode());
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
index 559709e9a..c3aae6879 100644
--- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
+++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
@@ -69,15 +69,15 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
protected AppcLcmDmaapWrapper makeRequest(int attempt) {
String subRequestId = getSubRequestId();
- AppcLcmCommonHeader header = new AppcLcmCommonHeader();
+ var header = new AppcLcmCommonHeader();
header.setOriginatorId(params.getRequestId().toString());
header.setRequestId(params.getRequestId());
header.setSubRequestId(subRequestId);
- AppcLcmInput inputRequest = new AppcLcmInput();
+ var inputRequest = new AppcLcmInput();
inputRequest.setCommonHeader(header);
- AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter(getName());
+ var recipeFormatter = new AppcLcmRecipeFormatter(getName());
inputRequest.setAction(recipeFormatter.getBodyRecipe());
/*
@@ -99,10 +99,10 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
inputRequest.setPayload(null);
}
- AppcLcmBody body = new AppcLcmBody();
+ var body = new AppcLcmBody();
body.setInput(inputRequest);
- AppcLcmDmaapWrapper dmaapRequest = new AppcLcmDmaapWrapper();
+ var dmaapRequest = new AppcLcmDmaapWrapper();
dmaapRequest.setBody(body);
dmaapRequest.setVersion("2.0");
dmaapRequest.setCorrelationId(params.getRequestId() + "-" + subRequestId);
@@ -123,7 +123,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
*/
private void convertPayload(Map<String, Object> source, AppcLcmInput request) {
try {
- String encodedPayloadString = getCoder().encode(source);
+ var encodedPayloadString = getCoder().encode(source);
request.setPayload(encodedPayloadString);
} catch (CoderException e) {
throw new IllegalArgumentException("Cannot convert payload", e);
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
index 4da23f1a8..53ad5689a 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 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.
@@ -19,7 +20,6 @@
package org.onap.policy.controlloop.actor.cds;
import java.util.concurrent.CompletableFuture;
-import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.onap.policy.cds.api.CdsProcessorListener;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -55,7 +55,7 @@ public class CdsActorServiceManager implements CdsProcessorListener {
@Override
public void onMessage(final ExecutionServiceOutput message) {
LOGGER.info("Received notification from CDS: {}", message);
- EventType eventType = message.getStatus().getEventType();
+ var eventType = message.getStatus().getEventType();
switch (eventType) {
case EVENT_COMPONENT_PROCESSING:
LOGGER.info("CDS is processing the message: {}", message);
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
index 44d51813a..87eaa9572 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -23,7 +23,6 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Struct;
-import com.google.protobuf.Struct.Builder;
import com.google.protobuf.util.JsonFormat;
import java.util.Collections;
import java.util.HashMap;
@@ -168,13 +167,13 @@ public class GrpcOperation extends OperationPartial {
}
protected String getServiceInstanceId() {
- ServiceInstance serviceInstance =
- getRequiredProperty(OperationProperties.AAI_SERVICE, "Target service instance");
+ var serviceInstance = (ServiceInstance) getRequiredProperty(OperationProperties.AAI_SERVICE,
+ "Target service instance");
return serviceInstance.getServiceInstanceId();
}
protected String getVnfId() {
- GenericVnf genericVnf = getRequiredProperty(OperationProperties.AAI_RESOURCE_VNF, "Target generic vnf");
+ var genericVnf = (GenericVnf) getRequiredProperty(OperationProperties.AAI_RESOURCE_VNF, "Target generic vnf");
return genericVnf.getVnfId();
}
@@ -240,7 +239,7 @@ public class GrpcOperation extends OperationPartial {
// Embed payload from policy to ConfigDeployRequest object, serialize and inject
// into grpc request.
String cbaActionName = params.getOperation();
- CdsActionRequest request = new CdsActionRequest();
+ var request = new CdsActionRequest();
request.setPolicyPayload(payload);
request.setActionName(cbaActionName);
request.setResolutionKey(UUID.randomUUID().toString());
@@ -260,7 +259,7 @@ public class GrpcOperation extends OperationPartial {
request.setAdditionalEventParams(additionalParams);
}
- Builder struct = Struct.newBuilder();
+ var struct = Struct.newBuilder();
try {
String requestStr = request.generateCdsPayload();
Preconditions.checkState(!Strings.isNullOrEmpty(requestStr),
@@ -272,11 +271,11 @@ public class GrpcOperation extends OperationPartial {
}
// Build CDS gRPC request common-header
- CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(CdsActorConstants.ORIGINATOR_ID)
+ var commonHeader = CommonHeader.newBuilder().setOriginatorId(CdsActorConstants.ORIGINATOR_ID)
.setRequestId(params.getRequestId().toString()).setSubRequestId(getSubRequestId()).build();
// Build CDS gRPC request action-identifier
- ActionIdentifiers actionIdentifiers =
+ var actionIdentifiers =
ActionIdentifiers.newBuilder().setBlueprintName(cbaName).setBlueprintVersion(cbaVersion)
.setActionName(cbaActionName).setMode(CdsActorConstants.CDS_MODE).build();
diff --git a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
index f18a04fd1..6291c9331 100644
--- a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
+++ b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.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.
@@ -23,7 +23,6 @@ package org.onap.policy.controlloop.actor.guard;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -96,8 +95,8 @@ public class DecisionOperation extends HttpOperation<DecisionResponse> {
// guard is disabled, thus it is always treated as a success
logger.info("{}: guard disabled, always succeeds for {}", getFullName(), params.getRequestId());
- final Executor executor = params.getExecutor();
- final CallbackManager callbacks = new CallbackManager();
+ final var executor = params.getExecutor();
+ final var callbacks = new CallbackManager();
return CompletableFuture.completedFuture(makeOutcome())
.whenCompleteAsync(callbackStarted(callbacks), executor)
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java
index 61bf8385a..2f6654d09 100644
--- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java
@@ -71,45 +71,45 @@ public class BandwidthOnDemandOperation extends SdncOperation {
throw new IllegalArgumentException("missing enrichment data, " + SERVICE_ID_KEY);
}
- SdncHealVfModuleParameter bandwidth = new SdncHealVfModuleParameter();
+ var bandwidth = new SdncHealVfModuleParameter();
bandwidth.setName(BANDWIDTH);
bandwidth.setValue(getRequiredProperty(OperationProperties.ENRICHMENT_BANDWIDTH,
"bandwidth from enrichment data"));
- SdncHealVfModuleParameter timeStamp = new SdncHealVfModuleParameter();
+ var timeStamp = new SdncHealVfModuleParameter();
timeStamp.setName(BANDWIDTH_CHANGE_TIME);
timeStamp.setValue(getRequiredProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME,
"bandwidth change time from enrichment data"));
- SdncHealVfModuleParametersInfo vfParametersInfo = new SdncHealVfModuleParametersInfo();
+ var vfParametersInfo = new SdncHealVfModuleParametersInfo();
vfParametersInfo.addParameters(bandwidth);
vfParametersInfo.addParameters(timeStamp);
- SdncHealVfModuleRequestInput vfRequestInfo = new SdncHealVfModuleRequestInput();
+ var vfRequestInfo = new SdncHealVfModuleRequestInput();
vfRequestInfo.setVfModuleParametersInfo(vfParametersInfo);
- SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo();
+ var serviceInfo = new SdncHealServiceInfo();
serviceInfo.setServiceInstanceId(serviceInstance);
- SdncHealRequestInfo requestInfo = new SdncHealRequestInfo();
+ var requestInfo = new SdncHealRequestInfo();
requestInfo.setRequestAction("SdwanBandwidthChange");
- SdncHealRequestHeaderInfo headerInfo = new SdncHealRequestHeaderInfo();
+ var headerInfo = new SdncHealRequestHeaderInfo();
headerInfo.setSvcAction("update");
headerInfo.setSvcRequestId(getSubRequestId());
- SdncRequest request = new SdncRequest();
+ var request = new SdncRequest();
request.setNsInstanceId(serviceInstance);
request.setRequestId(params.getRequestId());
request.setUrl("/" + getPath());
- SdncHealVnfInfo vnfInfo = new SdncHealVnfInfo();
+ var vnfInfo = new SdncHealVnfInfo();
vnfInfo.setVnfId(getRequiredProperty(OperationProperties.ENRICHMENT_VNF_ID, "VNF id from enrichment data"));
- SdncHealVfModuleInfo vfModuleInfo = new SdncHealVfModuleInfo();
+ var vfModuleInfo = new SdncHealVfModuleInfo();
vfModuleInfo.setVfModuleId("");
- SdncHealRequest healRequest = new SdncHealRequest();
+ var healRequest = new SdncHealRequest();
healRequest.setVnfInfo(vnfInfo);
healRequest.setVfModuleInfo(vfModuleInfo);
healRequest.setRequestHeaderInfo(headerInfo);
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java
index 02209bbd2..562266d5b 100644
--- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.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.
@@ -61,29 +61,29 @@ public class RerouteOperation extends SdncOperation {
if (StringUtils.isBlank(serviceInstance)) {
throw new IllegalArgumentException("missing enrichment data, " + SERVICE_ID_KEY);
}
- SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo();
+ var serviceInfo = new SdncHealServiceInfo();
serviceInfo.setServiceInstanceId(serviceInstance);
String networkId = getProperty(OperationProperties.ENRICHMENT_NETWORK_ID);
if (StringUtils.isBlank(networkId)) {
throw new IllegalArgumentException("missing enrichment data, " + NETWORK_ID_KEY);
}
- SdncHealNetworkInfo networkInfo = new SdncHealNetworkInfo();
+ var networkInfo = new SdncHealNetworkInfo();
networkInfo.setNetworkId(networkId);
- SdncHealRequestInfo requestInfo = new SdncHealRequestInfo();
+ var requestInfo = new SdncHealRequestInfo();
requestInfo.setRequestAction("ReoptimizeSOTNInstance");
- SdncHealRequestHeaderInfo headerInfo = new SdncHealRequestHeaderInfo();
+ var headerInfo = new SdncHealRequestHeaderInfo();
headerInfo.setSvcAction("reoptimize");
headerInfo.setSvcRequestId(getSubRequestId());
- SdncRequest request = new SdncRequest();
+ var request = new SdncRequest();
request.setNsInstanceId(serviceInstance);
request.setRequestId(params.getRequestId());
request.setUrl("/" + getPath());
- SdncHealRequest healRequest = new SdncHealRequest();
+ var healRequest = new SdncHealRequest();
healRequest.setRequestHeaderInfo(headerInfo);
healRequest.setNetworkInfo(networkInfo);
healRequest.setRequestInfo(requestInfo);
diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
index ebfbaba68..5b30c673a 100644
--- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
+++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
@@ -83,7 +83,7 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
return Status.FAILURE;
}
- StatusCodeEnum code = StatusCodeEnum.fromStatusCode(response.getStatus().getCode());
+ var code = StatusCodeEnum.fromStatusCode(response.getStatus().getCode());
if (code == null) {
logger.warn("unknown SDNR response status code: {}", response.getStatus().getCode());
@@ -119,7 +119,7 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
return setOutcome(outcome, result);
}
- PciResponse pciResponse = responseWrapper.getBody().getOutput();
+ var pciResponse = responseWrapper.getBody().getOutput();
if (pciResponse.getStatus() == null || pciResponse.getStatus().getValue() == null) {
return setOutcome(outcome, result);
}
@@ -135,17 +135,17 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
/* Construct an SDNR request using pci Model */
- PciMessage dmaapRequest = new PciMessage();
+ var dmaapRequest = new PciMessage();
dmaapRequest.setVersion("1.0");
dmaapRequest.setCorrelationId(params.getRequestId() + "-" + subRequestId);
dmaapRequest.setType("request");
dmaapRequest.setRpcName(params.getOperation().toLowerCase());
/* This is the actual request that is placed in the dmaap wrapper. */
- final PciRequest sdnrRequest = new PciRequest();
+ final var sdnrRequest = new PciRequest();
/* The common header is a required field for all SDNR requests. */
- PciCommonHeader requestCommonHeader = new PciCommonHeader();
+ var requestCommonHeader = new PciCommonHeader();
requestCommonHeader.setRequestId(params.getRequestId());
requestCommonHeader.setSubRequestId(subRequestId);
@@ -156,7 +156,7 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
/*
* Once the pci request is constructed, add it into the body of the dmaap wrapper.
*/
- PciBody body = new PciBody();
+ var body = new PciBody();
body.setInput(sdnrRequest);
dmaapRequest.setBody(body);
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
index 8d3fb59af..824c4340e 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
@@ -251,7 +251,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
}
protected SoModelInfo prepareSoModelInfo() {
- SoModelInfo soModelInfo = new SoModelInfo();
+ var soModelInfo = new SoModelInfo();
soModelInfo.setModelCustomizationId(modelCustomizationId);
soModelInfo.setModelInvariantId(modelInvariantId);
soModelInfo.setModelName(modelName);
@@ -267,7 +267,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
* @return SO request information
*/
protected SoRequestInfo constructRequestInfo() {
- SoRequestInfo soRequestInfo = new SoRequestInfo();
+ var soRequestInfo = new SoRequestInfo();
soRequestInfo.setSource("POLICY");
soRequestInfo.setSuppressRollback(false);
soRequestInfo.setRequestorId("policy");
@@ -323,7 +323,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
* @return SO cloud configuration
*/
protected SoCloudConfiguration constructCloudConfiguration(Tenant tenantItem, CloudRegion cloudRegionItem) {
- SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
+ var cloudConfiguration = new SoCloudConfiguration();
cloudConfiguration.setTenantId(getRequiredText("tenant ID", tenantItem.getTenantId()));
cloudConfiguration.setLcpCloudRegionId(getRequiredText("cloud region ID", cloudRegionItem.getCloudRegionId()));
return cloudConfiguration;
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
index 3d753bb0b..10c673705 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
@@ -28,11 +28,7 @@ import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.aai.domain.yang.CloudRegion;
-import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ModelVer;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.Tenant;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -110,7 +106,7 @@ public class VfModuleCreate extends SoOperation {
*/
@Override
protected Status detmStatus(Response rawResponse, SoResponse response) {
- Status status = super.detmStatus(rawResponse, response);
+ var status = super.detmStatus(rawResponse, response);
if (status == Status.SUCCESS) {
setVfCount(getVfCount() + 1);
@@ -125,15 +121,15 @@ public class VfModuleCreate extends SoOperation {
* @return a pair containing the request URL and the new request
*/
protected Pair<String, SoRequest> makeRequest() {
- final SoModelInfo soModelInfo = prepareSoModelInfo();
- final GenericVnf vnfItem = getVnfItem();
- final ServiceInstance vnfServiceItem = getServiceInstance();
- final Tenant tenantItem = getDefaultTenant();
- final CloudRegion cloudRegionItem = getDefaultCloudRegion();
+ final var soModelInfo = prepareSoModelInfo();
+ final var vnfItem = getVnfItem();
+ final var vnfServiceItem = getServiceInstance();
+ final var tenantItem = getDefaultTenant();
+ final var cloudRegionItem = getDefaultCloudRegion();
final ModelVer vnfModel = getVnfModel();
final ModelVer vnfServiceModel = getServiceModel();
- SoRequest request = new SoRequest();
+ var request = new SoRequest();
request.setOperationType(SoOperationType.SCALE_OUT);
//
@@ -155,8 +151,8 @@ public class VfModuleCreate extends SoOperation {
request.getRequestDetails().getRequestInfo().setInstanceName("vfModuleName");
// relatedInstanceList
- SoRelatedInstanceListElement relatedInstanceListElement1 = new SoRelatedInstanceListElement();
- SoRelatedInstanceListElement relatedInstanceListElement2 = new SoRelatedInstanceListElement();
+ var relatedInstanceListElement1 = new SoRelatedInstanceListElement();
+ var relatedInstanceListElement2 = new SoRelatedInstanceListElement();
relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance());
relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance());
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
index 1881b5c58..09584b487 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
@@ -38,10 +38,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.aai.domain.yang.CloudRegion;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.Tenant;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
@@ -50,7 +46,6 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.pipeline.PipelineControllerFuture;
-import org.onap.policy.so.SoModelInfo;
import org.onap.policy.so.SoOperationType;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoRequestDetails;
@@ -129,7 +124,7 @@ public class VfModuleDelete extends SoOperation {
final String url = getClient().getBaseUrl() + uri;
- Builder builder = HttpRequest.newBuilder(URI.create(url));
+ var builder = HttpRequest.newBuilder(URI.create(url));
builder = builder.header("Content-type", contentType);
builder = addAuthHeader(builder);
@@ -191,7 +186,7 @@ public class VfModuleDelete extends SoOperation {
*/
@Override
protected Status detmStatus(Response rawResponse, SoResponse response) {
- Status status = super.detmStatus(rawResponse, response);
+ var status = super.detmStatus(rawResponse, response);
if (status == Status.SUCCESS) {
setVfCount(getVfCount() - 1);
@@ -206,20 +201,20 @@ public class VfModuleDelete extends SoOperation {
* @return a pair containing the request URL and the new request
*/
protected Pair<String, SoRequest> makeRequest() {
- final SoModelInfo soModelInfo = prepareSoModelInfo();
- final GenericVnf vnfItem = getVnfItem();
- final ServiceInstance vnfServiceItem = getServiceInstance();
- final Tenant tenantItem = getDefaultTenant();
- final CloudRegion cloudRegionItem = getDefaultCloudRegion();
+ final var soModelInfo = prepareSoModelInfo();
+ final var vnfItem = getVnfItem();
+ final var vnfServiceItem = getServiceInstance();
+ final var tenantItem = getDefaultTenant();
+ final var cloudRegionItem = getDefaultCloudRegion();
- SoRequest request = new SoRequest();
+ var request = new SoRequest();
request.setOperationType(SoOperationType.DELETE_VF_MODULE);
//
//
// Do NOT send SO the requestId, they do not support this field
//
- SoRequestDetails details = new SoRequestDetails();
+ var details = new SoRequestDetails();
request.setRequestDetails(details);
details.setRelatedInstanceList(null);
details.setConfigurationParameters(null);
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java
index 304d4cd44..7aa5b9470 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.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.
@@ -30,7 +30,6 @@ import lombok.Getter;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
-import org.onap.policy.common.endpoints.http.client.HttpClientFactory;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.BeanValidationResult;
@@ -116,7 +115,7 @@ public class BasicActor {
*/
private MyConfig readConfig(String yamlConfigFile) {
try {
- String yaml = ResourceUtils.getResourceAsString(yamlConfigFile);
+ var yaml = ResourceUtils.getResourceAsString(yamlConfigFile);
if (yaml == null) {
throw new FileNotFoundException(yamlConfigFile);
}
@@ -139,7 +138,7 @@ public class BasicActor {
stopOtherServices();
if (config.getHttpClients() != null) {
- HttpClientFactory factory = HttpClientFactoryInstance.getClientFactory();
+ var factory = HttpClientFactoryInstance.getClientFactory();
for (BusTopicParams params : config.getHttpClients()) {
factory.build(params);
}
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
index f30802c32..3e06f1c11 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
@@ -31,6 +31,7 @@ import org.mockito.Mock;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
+import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
@@ -97,13 +98,17 @@ public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation
/**
* Starts the topic.
+ *
+ * @throws InterruptedException if interrupted
+ * @throws BidirectionalTopicClientException if the client cannot be built
*/
- protected static void initBeforeClass(String sinkTopic, String sourceTopic) throws Exception {
+ protected static void initBeforeClass(String sinkTopic, String sourceTopic)
+ throws InterruptedException, BidirectionalTopicClientException {
Util.buildDmaapSim();
// note: the sink and source names are swapped for the simulator
- TopicParameters ptopic = new TopicParameters();
+ var ptopic = new TopicParameters();
ptopic.setTopic(sourceTopic);
ptopic.setManaged(true);
ptopic.setServers(List.of("localhost"));
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
index 766e0fb2d..39adbf55d 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
@@ -53,7 +53,7 @@ public class BasicOperation {
protected static final String EVENT_VERSION = "my-event-version";
protected static final Executor blockingExecutor = command -> {
- Thread thread = new Thread(command);
+ var thread = new Thread(command);
thread.setDaemon(true);
thread.start();
};
@@ -137,7 +137,7 @@ public class BasicOperation {
*/
protected <R> void verifyRequest(String expectedJsonFile, R request, String... ignore) throws CoderException {
String json = coder.encode(request, true);
- String expected = ResourceUtils.getResourceAsString(expectedJsonFile);
+ var expected = ResourceUtils.getResourceAsString(expectedJsonFile);
// strip various items, because they change for each request
for (String stripper : ignore) {
diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java
index bc9642888..784054886 100644
--- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java
+++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.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.
@@ -61,7 +61,7 @@ public class Restart extends VfcOperation {
*/
protected Pair<String, VfcRequest> makeRequest() {
- VfcRequest request = super.constructVfcRequest();
+ var request = super.constructVfcRequest();
String requestUrl = "/" + request.getNsInstanceId() + "/heal";
return Pair.of(requestUrl, request);
}
diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
index 2d6dc5802..3e64506bf 100644
--- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
+++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
@@ -172,20 +172,20 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> {
"Missing enrichment data for service instance, server id, or server name.");
}
- VfcHealActionVmInfo vmActionInfo = new VfcHealActionVmInfo();
+ var vmActionInfo = new VfcHealActionVmInfo();
vmActionInfo.setVmid(vmId);
vmActionInfo.setVmname(vmName);
- VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams();
+ var additionalParams = new VfcHealAdditionalParams();
additionalParams.setAction(getName());
additionalParams.setActionInfo(vmActionInfo);
- VfcHealRequest healRequest = new VfcHealRequest();
+ var healRequest = new VfcHealRequest();
healRequest.setVnfInstanceId(vnfId);
healRequest.setCause(getName());
healRequest.setAdditionalParams(additionalParams);
- VfcRequest request = new VfcRequest();
+ var request = new VfcRequest();
request.setHealRequest(healRequest);
request.setNsInstanceId(serviceInstance);
request.setRequestId(params.getRequestId());
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
index 4347c1d10..5cd4c8410 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ActorService
* ================================================================================
- * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -89,7 +89,7 @@ public class ActorService extends StartConfigPartial<Map<String, Object>> {
}
actors.sort((actor1, actor2) -> {
- int cmp = Integer.compare(actor1.getSequenceNumber(), actor2.getSequenceNumber());
+ var cmp = Integer.compare(actor1.getSequenceNumber(), actor2.getSequenceNumber());
if (cmp != 0) {
return cmp;
}
@@ -108,7 +108,7 @@ public class ActorService extends StartConfigPartial<Map<String, Object>> {
* @throws IllegalArgumentException if no actor by the given name exists
*/
public Actor getActor(String name) {
- Actor actor = name2actor.get(name);
+ var actor = name2actor.get(name);
if (actor == null) {
throw new IllegalArgumentException("unknown actor " + name);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/DelayedIdentString.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/DelayedIdentString.java
index b7a9a53ad..dc105d903 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/DelayedIdentString.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/DelayedIdentString.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.
@@ -45,7 +45,7 @@ public class DelayedIdentString {
return NULL_STRING;
}
- String ident = objectToString();
+ var ident = objectToString();
if (ident == null) {
return NULL_STRING;
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationFinalResult.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationFinalResult.java
index 67d25f2a9..f9f3a1038 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationFinalResult.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationFinalResult.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* models
* ================================================================================
- * 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.
@@ -96,7 +96,7 @@ public enum OperationFinalResult {
* @return true if a result
*/
public static boolean isResult(String result, OperationFinalResult finalResult) {
- OperationFinalResult toResult = OperationFinalResult.toResult(result);
+ var toResult = OperationFinalResult.toResult(result);
if (toResult == null) {
return false;
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java
index f5947e77d..758f49238 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.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.
@@ -69,7 +69,7 @@ public class OperationOutcome {
* @return ControlLoopOperation
*/
public ControlLoopOperation toControlLoopOperation() {
- ControlLoopOperation clo = new ControlLoopOperation();
+ var clo = new ControlLoopOperation();
clo.setActor(actor);
clo.setOperation(operation);
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/ActorImpl.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/ActorImpl.java
index 336860ecb..36e5268af 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/ActorImpl.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/ActorImpl.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.
@@ -95,7 +95,7 @@ public class ActorImpl extends StartConfigPartial<Map<String, Object>> implement
@Override
public Operator getOperator(String name) {
- Operator operator = name2operator.get(name);
+ var operator = name2operator.get(name);
if (operator == null) {
throw new IllegalArgumentException("unknown operator " + getName() + "." + name);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
index b0ad38eff..c4d5cca33 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
@@ -22,7 +22,6 @@ package org.onap.policy.controlloop.actorserviceprovider.impl;
import java.util.List;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
import java.util.function.BiConsumer;
import lombok.Getter;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
@@ -106,11 +105,11 @@ public abstract class BidirectionalTopicOperation<Q, S> extends OperationPartial
@Override
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
- final Q request = makeRequest(attempt);
+ final var request = makeRequest(attempt);
final List<String> expectedKeyValues = getExpectedKeyValues(attempt, request);
final PipelineControllerFuture<OperationOutcome> controller = new PipelineControllerFuture<>();
- final Executor executor = params.getExecutor();
+ final var executor = params.getExecutor();
// register a listener BEFORE publishing
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
index a4b48d432..4812e7739 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
@@ -182,7 +181,7 @@ public abstract class HttpOperation<T> extends OperationPartial {
final PipelineControllerFuture<OperationOutcome> controller = new PipelineControllerFuture<>();
final CompletableFuture<Response> future = new CompletableFuture<>();
- final Executor executor = params.getExecutor();
+ final var executor = params.getExecutor();
// arrange for the callback to complete "future"
InvocationCallback<Response> callback = new InvocationCallback<>() {
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
index 7ad0cd82e..5fbf7d2df 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
@@ -225,9 +225,9 @@ public abstract class OperationPartial implements Operation {
logger.info("{}: start operation attempt {} for {}", getFullName(), attempt, params.getRequestId());
- final Executor executor = params.getExecutor();
- final OperationOutcome outcome = makeOutcome();
- final CallbackManager callbacks = new CallbackManager();
+ final var executor = params.getExecutor();
+ final var outcome = makeOutcome();
+ final var callbacks = new CallbackManager();
// this operation attempt gets its own controller
final PipelineControllerFuture<OperationOutcome> controller = new PipelineControllerFuture<>();
@@ -594,14 +594,13 @@ public abstract class OperationPartial implements Operation {
* @return an array of futures, possibly zero-length. If the array is of size one,
* then that one item should be returned instead of the controller
*/
+ @SuppressWarnings("unchecked")
private CompletableFuture<OperationOutcome>[] attachFutures(PipelineControllerFuture<OperationOutcome> controller,
List<Supplier<CompletableFuture<OperationOutcome>>> futureMakers,
UnaryOperator<CompletableFuture<OperationOutcome>> adorn) {
if (futureMakers.isEmpty()) {
- @SuppressWarnings("unchecked")
- CompletableFuture<OperationOutcome>[] result = new CompletableFuture[0];
- return result;
+ return new CompletableFuture[0];
}
// the last, unadorned future that is created
@@ -631,8 +630,7 @@ public abstract class OperationPartial implements Operation {
}
}
- @SuppressWarnings("unchecked")
- CompletableFuture<OperationOutcome>[] result = new CompletableFuture[futures.size()];
+ var result = new CompletableFuture[futures.size()];
if (result.length == 1) {
// special case - return the unadorned future
@@ -747,7 +745,7 @@ public abstract class OperationPartial implements Operation {
* executing
*/
final PipelineControllerFuture<OperationOutcome> controller = new PipelineControllerFuture<>();
- final Executor executor = params.getExecutor();
+ final var executor = params.getExecutor();
// @formatter:off
controller.wrap(nextTask)
@@ -830,7 +828,7 @@ public abstract class OperationPartial implements Operation {
outcome.setEnd(null);
// pass a copy to the callback
- OperationOutcome outcome2 = new OperationOutcome(outcome);
+ var outcome2 = new OperationOutcome(outcome);
outcome2.setFinalOutcome(false);
params.callbackStarted(outcome2);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperatorPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperatorPartial.java
index e75e99eaa..eacb10777 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperatorPartial.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperatorPartial.java
@@ -38,7 +38,7 @@ public abstract class OperatorPartial extends StartConfigPartial<Map<String, Obj
*/
@Getter
private final Executor blockingExecutor = command -> {
- Thread thread = new Thread(command);
+ var thread = new Thread(command);
thread.setDaemon(true);
thread.start();
};
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
index f28777097..22dfc28bc 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.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.
@@ -188,7 +188,7 @@ public class ControlLoopOperationParams {
* @return a new operation outcome
*/
public OperationOutcome makeOutcome() {
- OperationOutcome outcome = new OperationOutcome();
+ var outcome = new OperationOutcome();
outcome.setActor(getActor());
outcome.setOperation(getOperation());
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java
index 2648959bb..d638c9d3d 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
*
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -95,13 +95,13 @@ public class AaiCqResponse implements Serializable {
public AaiCqResponse(String jsonString) {
// Read JSON String and add all AaiObjects
- JSONObject responseObj = new JSONObject(jsonString);
- JSONArray resultsArray = new JSONArray();
+ var responseObj = new JSONObject(jsonString);
+ var resultsArray = new JSONArray();
if (responseObj.has("results")) {
resultsArray = (JSONArray) responseObj.get("results");
}
- for (int i = 0; i < resultsArray.length(); i++) {
- final JSONObject resultObject = resultsArray.getJSONObject(i);
+ for (var i = 0; i < resultsArray.length(); i++) {
+ final var resultObject = resultsArray.getJSONObject(i);
extractVserver(resultObject);
extractGenericVnf(resultObject);
@@ -118,11 +118,11 @@ public class AaiCqResponse implements Serializable {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject("vserver").toString()));
// Getting the vserver pojo again from the json
- Vserver vserver = this.getAaiObject(json, Vserver.class);
+ var vserver = this.getAaiObject(json, Vserver.class);
this.inventoryResponseItems.add(vserver);
}
}
@@ -131,11 +131,11 @@ public class AaiCqResponse implements Serializable {
if (resultObject.has(GENERIC_VNF)) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject(GENERIC_VNF).toString()));
// Getting the generic vnf pojo again from the json
- GenericVnf genericVnf = this.getAaiObject(json, GenericVnf.class);
+ var genericVnf = this.getAaiObject(json, GenericVnf.class);
this.inventoryResponseItems.add(genericVnf);
}
@@ -146,11 +146,11 @@ public class AaiCqResponse implements Serializable {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject("service-instance").toString()));
// Getting the employee pojo again from the json
- ServiceInstance serviceInstance = this.getAaiObject(json, ServiceInstance.class);
+ var serviceInstance = this.getAaiObject(json, ServiceInstance.class);
this.inventoryResponseItems.add(serviceInstance);
}
@@ -160,11 +160,11 @@ public class AaiCqResponse implements Serializable {
if (resultObject.has(VF_MODULE)) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject(VF_MODULE).toString()));
// Getting the vf module pojo again from the json
- VfModule vfModule = this.getAaiObject(json, VfModule.class);
+ var vfModule = this.getAaiObject(json, VfModule.class);
this.inventoryResponseItems.add(vfModule);
}
@@ -174,11 +174,11 @@ public class AaiCqResponse implements Serializable {
if (resultObject.has("cloud-region")) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject("cloud-region").toString()));
// Getting the cloud region pojo again from the json
- CloudRegion cloudRegion = this.getAaiObject(json, CloudRegion.class);
+ var cloudRegion = this.getAaiObject(json, CloudRegion.class);
this.inventoryResponseItems.add(cloudRegion);
}
@@ -188,11 +188,11 @@ public class AaiCqResponse implements Serializable {
if (resultObject.has("tenant")) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject("tenant").toString()));
// Getting the tenant pojo again from the json
- Tenant tenant = this.getAaiObject(json, Tenant.class);
+ var tenant = this.getAaiObject(json, Tenant.class);
this.inventoryResponseItems.add(tenant);
}
@@ -202,11 +202,11 @@ public class AaiCqResponse implements Serializable {
if (resultObject.has("model-ver")) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(
+ var json = new StreamSource(
new StringReader(resultObject.getJSONObject("model-ver").toString()));
// Getting the ModelVer pojo again from the json
- ModelVer modelVer = this.getAaiObject(json, ModelVer.class);
+ var modelVer = this.getAaiObject(json, ModelVer.class);
this.inventoryResponseItems.add(modelVer);
}
@@ -409,13 +409,13 @@ public class AaiCqResponse implements Serializable {
GenericVnf genericVnf = null;
// Get the vserver associated with the query
- Vserver vserver = this.getVserver();
+ var vserver = this.getVserver();
// Get the relationships of the vserver
List<Relationship> relations = vserver.getRelationshipList().getRelationship();
// Find the relationship of the genericVNF
- String genericVnfId = "";
+ var genericVnfId = "";
List<RelationshipData> relationshipData = null;
// Iterate through the list of relationships and get generic vnf
@@ -457,13 +457,13 @@ public class AaiCqResponse implements Serializable {
VfModule vfModule = null;
// Get the vserver associated with the query
- Vserver vserver = this.getVserver();
+ var vserver = this.getVserver();
// Get the relationships of the vserver
List<Relationship> relations = vserver.getRelationshipList().getRelationship();
// Find the relationship of VfModule
- String vfModuleId = "";
+ var vfModuleId = "";
List<RelationshipData> relationshipData = null;
// Iterate through the list of relationships and get vf module
@@ -554,7 +554,7 @@ public class AaiCqResponse implements Serializable {
*/
public Vserver getVserver() {
Vserver vserver = null;
- int index = 0;
+ var index = 0;
while (this.inventoryResponseItems.get(index).getClass() != Vserver.class) {
index = index + 1;
}
@@ -605,7 +605,7 @@ public class AaiCqResponse implements Serializable {
*/
public int getVfModuleCount(String custId, String invId, String verId) {
List<VfModule> vfModuleList = this.getAllVfModules();
- int count = 0;
+ var count = 0;
for (VfModule vfModule : vfModuleList) {
if (vfModule.getModelCustomizationId() == null || vfModule.getModelInvariantId() == null
|| vfModule.getModelVersionId() == null) {
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 16ee887af..b2a410733 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
@@ -86,17 +86,17 @@ public final class AaiManager {
if (getResponse == null) {
return null;
} else {
- JSONObject responseObj = new JSONObject(getResponse);
+ var responseObj = new JSONObject(getResponse);
JSONArray resultsArray;
if (responseObj.has("result-data")) {
resultsArray = (JSONArray) responseObj.get("result-data");
} else {
return null;
}
- String resourceLink = resultsArray.getJSONObject(0).getString("resource-link");
- String start = resourceLink.replace(PREFIX, "");
- String query = "query/closed-loop";
- JSONObject payload = new JSONObject();
+ var resourceLink = resultsArray.getJSONObject(0).getString("resource-link");
+ var start = resourceLink.replace(PREFIX, "");
+ var query = "query/closed-loop";
+ var payload = new JSONObject();
payload.put("start", start);
payload.put("query", query);
return payload.toString();
@@ -119,7 +119,7 @@ public final class AaiManager {
String urlGet = url + TENANT_URL;
- String getResponse = getStringQuery(urlGet, username, password, requestId, vserver);
+ var getResponse = getStringQuery(urlGet, username, password, requestId, vserver);
return createCustomQueryPayload(getResponse);
}
@@ -186,7 +186,7 @@ public final class AaiManager {
String urlGet = url + key;
- int attemptsLeft = 3;
+ var attemptsLeft = 3;
while (attemptsLeft-- > 0) {
NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|]", CommInfrastructure.REST, urlGet);
@@ -255,7 +255,7 @@ public final class AaiManager {
logger.error("Failed to encode the pnfName: {} using UTF-8", pnfName, e);
return null;
}
- String responseGet = getStringQuery(urlGet, username, password, requestId, pnfName);
+ var responseGet = getStringQuery(urlGet, username, password, requestId, pnfName);
if (responseGet == null) {
logger.error("Null response from AAI for the url: {}.", urlGet);
return null;
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
index 8a2c2cded..6a0e19a42 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,8 +47,8 @@ public class ResponseStatus implements Serializable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
+ final var prime = 31;
+ var result = 1;
result = prime * result + code;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmResponseCode.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmResponseCode.java
index 9d36ff809..43697e9e8 100644
--- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmResponseCode.java
+++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmResponseCode.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appclcm
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
@@ -59,7 +59,7 @@ public class AppcLcmResponseCode implements Serializable {
* @return the string value equivalent of the APPC response code
*/
public static String toResponseValue(int code) {
- StatusCodeEnum statusCodeEnum = StatusCodeEnum.fromStatusCode(code);
+ var statusCodeEnum = StatusCodeEnum.fromStatusCode(code);
return (statusCodeEnum != null) ? statusCodeEnum.toString() : null;
}
}
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorGrpcClient.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorGrpcClient.java
index 29fa687c0..ce0918d5e 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorGrpcClient.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorGrpcClient.java
@@ -54,13 +54,7 @@ public class CdsProcessorGrpcClient implements AutoCloseable {
Preconditions.checkState(validationResult.getStatus().isValid(), "Error validating CDS server "
+ "properties: " + validationResult.getResult());
- StringBuilder bldr = new StringBuilder("gRPC://");
- bldr.append(props.getHost());
- bldr.append(":");
- bldr.append(props.getPort());
- bldr.append('/');
-
- String url = bldr.toString();
+ String url = "gRPC://" + props.getHost() + ":" + props.getPort() + "/";
this.channel = NettyChannelBuilder.forAddress(props.getHost(), props.getPort())
.intercept(new BasicAuthClientHeaderInterceptor(props)).usePlaintext().build();
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 660908bfa..bb7a038db 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
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Bell Canada.
- * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -22,7 +22,6 @@ package org.onap.policy.cds.client;
import io.grpc.ManagedChannel;
import io.grpc.stub.StreamObserver;
import java.util.concurrent.CountDownLatch;
-import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
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;
@@ -47,13 +46,13 @@ public class CdsProcessorHandler {
}
CountDownLatch process(ExecutionServiceInput request, ManagedChannel channel) {
- final ActionIdentifiers header = request.getActionIdentifiers();
+ final var header = request.getActionIdentifiers();
LOGGER.info("Processing blueprint({}:{}) for action({})", header.getBlueprintVersion(),
header.getBlueprintName(), header.getBlueprintVersion());
- final CountDownLatch finishLatch = new CountDownLatch(1);
+ final var finishLatch = new CountDownLatch(1);
final BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel);
- final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() {
+ final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<>() {
@Override
public void onNext(ExecutionServiceOutput output) {
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, output.toString());
diff --git a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java
index 4f37e9592..a91548fca 100644
--- a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java
+++ b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* rest
* ================================================================================
- * 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-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -61,11 +61,11 @@ public class RestManager {
*/
public Pair<Integer, String> put(String url, String username, String password, Map<String, String> headers,
String contentType, String body) {
- HttpPut put = new HttpPut(url);
+ var put = new HttpPut(url);
addHeaders(put, username, password, headers);
put.addHeader(CONTENT_TYPE, contentType);
try {
- StringEntity input = new StringEntity(body);
+ var input = new StringEntity(body);
input.setContentType(contentType);
put.setEntity(input);
} catch (Exception e) {
@@ -88,11 +88,11 @@ public class RestManager {
*/
public Pair<Integer, String> post(String url, String username, String password, Map<String, String> headers,
String contentType, String body) {
- HttpPost post = new HttpPost(url);
+ var post = new HttpPost(url);
addHeaders(post, username, password, headers);
post.addHeader(CONTENT_TYPE, contentType);
try {
- StringEntity input = new StringEntity(body);
+ var input = new StringEntity(body);
input.setContentType(contentType);
post.setEntity(input);
} catch (Exception e) {
@@ -112,7 +112,7 @@ public class RestManager {
* @return a Pair for the response status and the body
*/
public Pair<Integer, String> get(String url, String username, String password, Map<String, String> headers) {
- HttpGet get = new HttpGet(url);
+ var get = new HttpGet(url);
addHeaders(get, username, password, headers);
return sendRequest(get);
}
@@ -131,12 +131,12 @@ public class RestManager {
*/
public Pair<Integer, String> delete(String url, String username, String password, Map<String, String> headers,
String contentType, String body) {
- HttpDeleteWithBody delete = new HttpDeleteWithBody(url);
+ var delete = new HttpDeleteWithBody(url);
addHeaders(delete, username, password, headers);
if (body != null && !body.isEmpty()) {
delete.addHeader(CONTENT_TYPE, contentType);
try {
- StringEntity input = new StringEntity(body);
+ var input = new StringEntity(body);
input.setContentType(contentType);
delete.setEntity(input);
} catch (Exception e) {
@@ -157,7 +157,7 @@ public class RestManager {
* @return the response status code and the body
*/
public Pair<Integer, String> delete(String url, String username, String password, Map<String, String> headers) {
- HttpDelete delete = new HttpDelete(url);
+ var delete = new HttpDelete(url);
addHeaders(delete, username, password, headers);
return sendRequest(delete);
}
@@ -174,12 +174,12 @@ public class RestManager {
*/
public Pair<Integer, String> patch(String url, String username, String password, Map<String, String> headers,
String body) {
- String contentType = "application/merge-patch+json";
- HttpPatch patch = new HttpPatch(url);
+ var contentType = "application/merge-patch+json";
+ var patch = new HttpPatch(url);
addHeaders(patch, username, password, headers);
patch.addHeader(CONTENT_TYPE, contentType);
try {
- StringEntity input = new StringEntity(body);
+ var input = new StringEntity(body);
input.setContentType(contentType);
patch.setEntity(input);
} catch (Exception e) {
@@ -204,7 +204,7 @@ public class RestManager {
HttpClientBuilder.create().setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE).build()) {
HttpResponse response = client.execute(request);
if (response != null) {
- String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8");
+ var returnBody = EntityUtils.toString(response.getEntity(), "UTF-8");
logger.debug("HTTP Response Status Code: {}", response.getStatusLine().getStatusCode());
logger.debug("HTTP Response Body:");
logger.debug(returnBody);
diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java
index 35a85d779..90864d42c 100644
--- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java
+++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java
@@ -5,6 +5,7 @@
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 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.
@@ -59,7 +60,7 @@ public class PciResponseCode implements Serializable {
* @return the string value equivalent of the SDNR response code
*/
public static String toResponseValue(int code) {
- StatusCodeEnum statusCodeEnum = StatusCodeEnum.fromStatusCode(code);
+ var statusCodeEnum = StatusCodeEnum.fromStatusCode(code);
return (statusCodeEnum != null) ? statusCodeEnum.toString() : null;
}
}
diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java
index a5e4336da..90aea71ee 100644
--- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java
+++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java
@@ -57,7 +57,7 @@ public final class Serialization {
@Override
public JsonElement serialize(PciRequest src, Type typeOfSrc, JsonSerializationContext context) {
JsonElement requestJson = gsonPretty.toJsonTree(src, PciRequest.class);
- JsonObject input = new JsonObject();
+ var input = new JsonObject();
input.add("input", requestJson);
return input;
@@ -74,7 +74,7 @@ public final class Serialization {
@Override
public JsonElement serialize(PciResponse src, Type typeOfSrc, JsonSerializationContext context) {
JsonElement responseJson = gsonPretty.toJsonTree(src, PciResponse.class);
- JsonObject output = new JsonObject();
+ var output = new JsonObject();
output.add("output", responseJson);
return output;
}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java
index beb852864..b6eef29d2 100644
--- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -70,7 +70,7 @@ public class SoResponseWrapper implements Serializable {
@Override
public int hashCode() {
- final int prime = 31;
+ final var prime = 31;
int result = super.hashCode();
result = prime * result + ((soResponse == null) ? 0 : soResponse.hashCode());
result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java
index 3b0d8cd72..a8ec6e5e9 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.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.
@@ -46,7 +46,7 @@ public class AppcLcmTopicServer extends TopicServer<AppcLcmDmaapWrapper> {
return null;
}
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appclcm/appc.lcm.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appclcm/appc.lcm.success.json");
return response.replace("${replaceMe}", request.getBody().getInput().getCommonHeader().getSubRequestId());
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java
index c3f0435c9..9447e01ac 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.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.
@@ -46,7 +46,7 @@ public class AppcLegacyTopicServer extends TopicServer<Request> {
return null;
}
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appc/appc.legacy.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appc/appc.legacy.success.json");
return response.replace("${replaceMe}", request.getCommonHeader().getSubRequestId());
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
index 222bd7fee..1677a3504 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
- * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,7 +34,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
@@ -93,7 +92,7 @@ public class CdsSimulator implements Runnable {
public void onNext(final ExecutionServiceInput executionServiceInput) {
LOGGER.info("Received request input to CDS: {}", executionServiceInput);
try {
- Builder builder = getResponse(executionServiceInput, countOfSuccesfulEvents);
+ var builder = getResponse(executionServiceInput, countOfSuccesfulEvents);
TimeUnit.MILLISECONDS.sleep(requestedResponseDelayMs);
responseObserver.onNext(builder.build());
} catch (InvalidProtocolBufferException e) {
@@ -151,9 +150,9 @@ public class CdsSimulator implements Runnable {
*/
public Builder getResponse(ExecutionServiceInput executionServiceInput, int countOfSuccesfulEvents)
throws InvalidProtocolBufferException {
- String resourceName = "DefaultResponseEvent";
+ var resourceName = "DefaultResponseEvent";
if (!StringUtils.isBlank(executionServiceInput.getActionIdentifiers().getActionName())) {
- ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+ var actionIdentifiers = executionServiceInput.getActionIdentifiers();
resourceName = actionIdentifiers.getBlueprintName() + "-" + actionIdentifiers.getActionName();
}
if (countOfSuccesfulEvents > 0 && countOfEvents.getAndIncrement() % countOfSuccesfulEvents == 0) {
@@ -163,11 +162,11 @@ public class CdsSimulator implements Runnable {
resourceName = resourceName + ".json";
}
LOGGER.info("Fetching response from {}", resourceName);
- String responseString = ResourceUtils.getResourceAsString(resourceLocation + resourceName);
- Builder builder = ExecutionServiceOutput.newBuilder();
+ var responseString = ResourceUtils.getResourceAsString(resourceLocation + resourceName);
+ var builder = ExecutionServiceOutput.newBuilder();
if (null == responseString) {
LOGGER.info("Expected response file {} not found in {}", resourceName, resourceLocation);
- ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+ var actionIdentifiers = executionServiceInput.getActionIdentifiers();
builder.setCommonHeader(executionServiceInput.getCommonHeader());
builder.setActionIdentifiers(actionIdentifiers);
builder.setPayload(executionServiceInput.getPayload());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
index f915f86d8..7a33a1950 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * 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");
@@ -49,7 +49,7 @@ public class GuardSimulatorJaxRs {
@SuppressWarnings("unchecked")
Map<String, String> guard = (Map<String, String>) req.getResource().get("guard");
String clName = guard.get("clname");
- DecisionResponse response = new DecisionResponse();
+ var response = new DecisionResponse();
if (DENY_CLNAME.equals(clName)) {
response.setStatus("Deny");
response.setAdvice(Collections.emptyMap());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
index b6e8b04bc..7a28791ba 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Huawei. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-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.
@@ -65,9 +65,9 @@ public class SdncSimulatorJaxRs {
private String makeSuccessResponse() {
- final SdncResponse response = new SdncResponse();
+ final var response = new SdncResponse();
response.setRequestId(UUID.randomUUID().toString());
- SdncResponseOutput responseOutput = new SdncResponseOutput();
+ var responseOutput = new SdncResponseOutput();
responseOutput.setResponseCode("200");
responseOutput.setAckFinalIndicator("Y");
responseOutput.setSvcRequestId(UUID.randomUUID().toString());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java
index 9aad4d4b3..cf297e5d9 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.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.
@@ -46,7 +46,7 @@ public class SdnrTopicServer extends TopicServer<PciMessage> {
return null;
}
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/sdnr/vpci.sdnr.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/sdnr/vpci.sdnr.success.json");
return response.replace("${replaceMe}", request.getBody().getInput().getCommonHeader().getSubRequestId());
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
index 12a523a65..3d2187895 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * 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.
* Modifications Copyright (C) 2020 Wipro Limited.
* ================================================================================
@@ -135,9 +135,9 @@ public class SoSimulatorJaxRs {
}
private String makeStarted() {
- String requestId = UUID.randomUUID().toString();
+ var requestId = UUID.randomUUID().toString();
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.started.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.started.json");
incomplete.add(requestId);
@@ -145,17 +145,17 @@ public class SoSimulatorJaxRs {
}
private String makeImmediateComplete() {
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.immediate.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.immediate.success.json");
return response.replace(REPLACE_ME, UUID.randomUUID().toString());
}
private String makeComplete(String requestId) {
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.complete.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.complete.success.json");
return response.replace(REPLACE_ME, requestId);
}
private String makeStillRunning(String requestId) {
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.still.running.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.still.running.json");
return response.replace(REPLACE_ME, requestId);
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
index d9fb52bd9..51f2f9d46 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.simulators;
import java.io.IOException;
-import java.util.Properties;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
@@ -81,7 +80,7 @@ public class Util {
* @throws IOException if an I/O error occurs
*/
public static CdsSimulator buildCdsSim() throws InterruptedException, IOException {
- final CdsSimulator testServer = new CdsSimulator(LOCALHOST, CDSSIM_SERVER_PORT);
+ final var testServer = new CdsSimulator(LOCALHOST, CDSSIM_SERVER_PORT);
testServer.start();
waitForServerToListen(testServer.getPort());
return testServer;
@@ -155,7 +154,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
*/
public static HttpServletServer buildDmaapSim() throws InterruptedException {
- String json = ResourceUtils.getResourceAsString("org/onap/policy/simulators/dmaap/DmaapParameters.json");
+ var json = ResourceUtils.getResourceAsString("org/onap/policy/simulators/dmaap/DmaapParameters.json");
DmaapSimParameterGroup params = null;
try {
params = new StandardCoder().decode(json, DmaapSimParameterGroup.class);
@@ -166,7 +165,7 @@ public class Util {
DmaapSimProvider.setInstance(new DmaapSimProvider(params));
- Properties props = DmaapSimRestServer.getServerProperties(params.getRestServerParameters());
+ var props = DmaapSimRestServer.getServerProperties(params.getRestServerParameters());
final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
+ params.getRestServerParameters().getName();
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
index cf21c7bab..3702fdd6d 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * 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,7 +30,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Path("/api/nslcm/v1")
@@ -53,7 +52,7 @@ public class VfcSimulatorJaxRs {
try {
response.flushBuffer();
} catch (Exception e) {
- final Logger logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
+ final var logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
logger.error("flushBuffer threw: ", e);
return "";
}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java
index 4485defaa..7c9f79b77 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java
@@ -53,7 +53,7 @@ public class DmaapSimParameterHandler {
// Read the parameters
try {
// Read the parameters from JSON
- File file = new File(arguments.getFullConfigurationFilePath());
+ var file = new File(arguments.getFullConfigurationFilePath());
dmaapSimParameterGroup = coder.decode(file, DmaapSimParameterGroup.class);
} catch (final CoderException e) {
final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath()
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/ConsumerGroupData.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/ConsumerGroupData.java
index 737151339..3acaf0888 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/ConsumerGroupData.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/ConsumerGroupData.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -146,7 +146,7 @@ public class ConsumerGroupData {
lst.add(obj);
// perform NON-blocking read of subsequent messages
- for (int x = 1; x < maxRead2; ++x) {
+ for (var x = 1; x < maxRead2; ++x) {
if ((obj = messageQueue.poll()) == null) {
break;
}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/TopicData.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/TopicData.java
index 5da2adca0..8e5cf24cc 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/TopicData.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/TopicData.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -153,7 +153,7 @@ public class TopicData {
List<String> list = new ArrayList<>(messages.size());
for (Object msg : messages) {
- String str = convertMessageToString(msg, coder);
+ var str = convertMessageToString(msg, coder);
if (str != null) {
list.add(str);
}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java
index b468e34c3..64ea29dca 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -65,8 +65,7 @@ public class CambriaMessageBodyHandler implements MessageBodyReader<Object> {
public List<Object> readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException {
- try (BufferedReader bufferedReader =
- new BufferedReader(new InputStreamReader(entityStream, StandardCharsets.UTF_8))) {
+ try (var bufferedReader = new BufferedReader(new InputStreamReader(entityStream, StandardCharsets.UTF_8))) {
List<Object> messages = new LinkedList<>();
String msg;
while ((msg = readMessage(bufferedReader)) != null) {
@@ -137,10 +136,10 @@ public class CambriaMessageBodyHandler implements MessageBodyReader<Object> {
* @throws IOException if an error occurs
*/
private int readLength(Reader reader) throws IOException {
- StringBuilder bldr = new StringBuilder(MAX_DIGITS);
+ var bldr = new StringBuilder(MAX_DIGITS);
int chr;
- for (int x = 0; x < MAX_DIGITS; ++x) {
+ for (var x = 0; x < MAX_DIGITS; ++x) {
if ((chr = reader.read()) < 0) {
throw new EOFException("missing '.' in 'length' field");
}
@@ -169,7 +168,7 @@ public class CambriaMessageBodyHandler implements MessageBodyReader<Object> {
* @throws IOException if an error occurs
*/
private String readString(Reader reader, int len) throws IOException {
- char[] buf = new char[len];
+ var buf = new char[len];
IOUtils.readFully(reader, buf);
return new String(buf);
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java
index b05a0fe1a..acac1439b 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 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.
@@ -59,7 +59,7 @@ public class DmaapSimRestServer extends ServiceManagerContainer {
* @return a set of properties representing the given parameters
*/
public static Properties getServerProperties(RestServerParameters restServerParameters) {
- final Properties props = new Properties();
+ final var props = new Properties();
props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, restServerParameters.getName());
final String svcpfx =
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java
index 3c903c82b..c72b7482a 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 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.
@@ -52,8 +52,7 @@ public class TextMessageBodyHandler implements MessageBodyReader<Object> {
public List<Object> readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException {
- try (BufferedReader bufferedReader =
- new BufferedReader(new InputStreamReader(entityStream, StandardCharsets.UTF_8))) {
+ try (var bufferedReader = new BufferedReader(new InputStreamReader(entityStream, StandardCharsets.UTF_8))) {
List<Object> messages = new LinkedList<>();
String msg;
while ((msg = bufferedReader.readLine()) != null) {
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java
index b9e0efaaf..3d4e1c66c 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 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.
@@ -39,11 +39,11 @@ public class DmaapSimActivator extends ServiceManagerContainer {
public DmaapSimActivator(final DmaapSimParameterGroup dmaapSimParameterGroup) {
super("DMaaP Simulator");
- DmaapSimProvider provider = new DmaapSimProvider(dmaapSimParameterGroup);
+ var provider = new DmaapSimProvider(dmaapSimParameterGroup);
DmaapSimProvider.setInstance(provider);
addAction("Sim Provider", provider::start, provider::stop);
- DmaapSimRestServer restServer = new DmaapSimRestServer(dmaapSimParameterGroup.getRestServerParameters());
+ var restServer = new DmaapSimRestServer(dmaapSimParameterGroup.getRestServerParameters());
addAction("REST server", restServer::start, restServer::stop);
}
}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
index 2c6c54063..e136509c9 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 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.
@@ -46,11 +46,11 @@ public class Main {
* @param args the command line arguments
*/
public Main(final String[] args) {
- final String argumentString = Arrays.toString(args);
+ final var argumentString = Arrays.toString(args);
LOGGER.info("Starting DMaaP simulator service with arguments - {}", argumentString);
// Check the arguments
- final DmaapSimCommandLineArguments arguments = new DmaapSimCommandLineArguments();
+ final var arguments = new DmaapSimCommandLineArguments();
try {
// The arguments return a string if there is a message to print and we should exit
final String argumentMessage = arguments.parse(args);
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java
index 430b89637..1bc2ff72d 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-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.
@@ -89,7 +89,7 @@ public class PdpSimulatorActivator {
topicSources = TopicEndpointManager.getManager()
.addTopicSources(pdpSimulatorParameterGroup.getTopicParameterGroup().getTopicSources());
- final int random = RANDOM.nextInt();
+ final var random = RANDOM.nextInt();
final String instanceId = "pdp_" + random;
LOGGER.debug("PdpSimulatorActivator initializing with instance id: {}", instanceId);
try {
@@ -99,8 +99,8 @@ public class PdpSimulatorActivator {
throw new PdpSimulatorRunTimeException(e);
}
- final PdpUpdateListener pdpUpdateListener = new PdpUpdateListener();
- final PdpStateChangeListener pdpStateChangeListener = new PdpStateChangeListener();
+ final var pdpUpdateListener = new PdpUpdateListener();
+ final var pdpStateChangeListener = new PdpStateChangeListener();
// @formatter:off
this.manager = new ServiceManager()
.addAction("topics",
@@ -139,7 +139,7 @@ public class PdpSimulatorActivator {
* Method to stop and unregister the pdp status publisher.
*/
private void stopAndRemovePdpStatusPublisher() {
- final PdpStatusPublisher pdpStatusPublisher =
+ final var pdpStatusPublisher =
Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
pdpStatusPublisher.terminate();
Registry.unregister(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER);
@@ -175,7 +175,7 @@ public class PdpSimulatorActivator {
throw new IllegalStateException("activator is not running");
}
try {
- final PdpStatusPublisher pdpStatusPublisher =
+ final var pdpStatusPublisher =
Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
// send a final heartbeat with terminated status
pdpStatusPublisher.send(new PdpMessageHandler().getTerminatedPdpStatus());
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
index 0d92aee8d..57fc8a146 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-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.
@@ -56,7 +56,7 @@ public class PdpSimulatorMain {
}
// Check the arguments
- final PdpSimulatorCommandLineArguments arguments = new PdpSimulatorCommandLineArguments();
+ final var arguments = new PdpSimulatorCommandLineArguments();
try {
// The arguments return a string if there is a message to print and we should exit
final String argumentMessage = arguments.parse(args);
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java
index b64967fa9..e490fe76a 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 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.
@@ -58,7 +59,7 @@ public class PdpStatusPublisher extends TimerTask {
@Override
public void run() {
- final PdpStatus pdpStatus = new PdpMessageHandler().createPdpStatusFromContext();
+ final var pdpStatus = new PdpMessageHandler().createPdpStatusFromContext();
topicSinkClient.send(pdpStatus);
LOGGER.debug("Sent heartbeat to PAP - {}", pdpStatus);
}
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java
index 6e628cc62..ae028dd32 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 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.
@@ -51,7 +51,7 @@ public class PdpMessageHandler {
*/
public PdpStatus createPdpStatusFromParameters(final String instanceId,
final PdpStatusParameters pdpStatusParameters) {
- final PdpStatus pdpStatus = new PdpStatus();
+ final var pdpStatus = new PdpStatus();
pdpStatus.setPdpGroup(pdpStatusParameters.getPdpGroup());
pdpStatus.setPdpType(pdpStatusParameters.getPdpType());
pdpStatus.setState(PdpState.PASSIVE);
@@ -67,8 +67,8 @@ public class PdpMessageHandler {
* @return PdpStatus the pdp status message
*/
public PdpStatus createPdpStatusFromContext() {
- final PdpStatus pdpStatusContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
- final PdpStatus pdpStatus = new PdpStatus();
+ final var pdpStatusContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
+ final var pdpStatus = new PdpStatus();
pdpStatus.setName(pdpStatusContext.getName());
pdpStatus.setPdpType(pdpStatusContext.getPdpType());
pdpStatus.setState(pdpStatusContext.getState());
@@ -86,7 +86,7 @@ public class PdpMessageHandler {
* @return PdpStatus the pdp status message
*/
public PdpStatus getTerminatedPdpStatus() {
- final PdpStatus pdpStatusInContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
+ final var pdpStatusInContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
pdpStatusInContext.setState(PdpState.TERMINATED);
pdpStatusInContext.setDescription("Pdp Simulator shutting down.");
return createPdpStatusFromContext();
@@ -103,7 +103,7 @@ public class PdpMessageHandler {
*/
public PdpResponseDetails createPdpResonseDetails(final String requestId, final PdpResponseStatus status,
final String responseMessage) {
- final PdpResponseDetails pdpResponseDetails = new PdpResponseDetails();
+ final var pdpResponseDetails = new PdpResponseDetails();
pdpResponseDetails.setResponseTo(requestId);
pdpResponseDetails.setResponseStatus(status);
pdpResponseDetails.setResponseMessage(responseMessage);
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java
index 9df1aa103..4f9804f7e 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 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.
@@ -45,9 +45,10 @@ public class PdpStateChangeMessageHandler {
* @param pdpStateChangeMsg pdp state change message
*/
public void handlePdpStateChangeEvent(final PdpStateChange pdpStateChangeMsg) {
- final PdpStatus pdpStatusContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
- final PdpStatusPublisher pdpStatusPublisher = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER);
- final PdpMessageHandler pdpMessageHandler = new PdpMessageHandler();
+ final var pdpStatusContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
+ final var pdpStatusPublisher =
+ Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
+ final var pdpMessageHandler = new PdpMessageHandler();
PdpResponseDetails pdpResponseDetails = null;
if (pdpStateChangeMsg.appliesTo(pdpStatusContext.getName(), pdpStatusContext.getPdpGroup(),
pdpStatusContext.getPdpSubgroup())) {
@@ -61,7 +62,7 @@ public class PdpStateChangeMessageHandler {
default:
break;
}
- final PdpStatus pdpStatus = pdpMessageHandler.createPdpStatusFromContext();
+ final var pdpStatus = pdpMessageHandler.createPdpStatusFromContext();
pdpStatus.setResponse(pdpResponseDetails);
pdpStatus.setDescription("Pdp status response message for PdpStateChange");
pdpStatusPublisher.send(pdpStatus);
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java
index 5b77f4704..2262ee938 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 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.
@@ -45,12 +45,13 @@ public class PdpUpdateMessageHandler {
* @param pdpUpdateMsg pdp update message
*/
public void handlePdpUpdateEvent(final PdpUpdate pdpUpdateMsg) {
- final PdpMessageHandler pdpMessageHandler = new PdpMessageHandler();
- final PdpStatus pdpStatusContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
+ final var pdpMessageHandler = new PdpMessageHandler();
+ final var pdpStatusContext = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
PdpResponseDetails pdpResponseDetails = null;
if (pdpUpdateMsg.appliesTo(pdpStatusContext.getName(), pdpStatusContext.getPdpGroup(),
- pdpStatusContext.getPdpSubgroup())) {
- final PdpStatusPublisher pdpStatusPublisher = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER);
+ pdpStatusContext.getPdpSubgroup())) {
+ final var pdpStatusPublisher =
+ Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
if (checkIfAlreadyHandled(pdpUpdateMsg, pdpStatusContext)) {
pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(),
PdpResponseStatus.SUCCESS, "Pdp already updated");
@@ -73,9 +74,9 @@ public class PdpUpdateMessageHandler {
PdpResponseStatus.SUCCESS, "Pdp update successful.");
}
}
- final PdpStatusPublisher pdpStatusPublisherTemp =
- Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER);
- final PdpStatus pdpStatus = pdpMessageHandler.createPdpStatusFromContext();
+ final var pdpStatusPublisherTemp =
+ Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
+ final var pdpStatus = pdpMessageHandler.createPdpStatusFromContext();
pdpStatus.setResponse(pdpResponseDetails);
pdpStatus.setDescription("Pdp status response message for PdpUpdate");
pdpStatusPublisherTemp.send(pdpStatus);
@@ -111,7 +112,8 @@ public class PdpUpdateMessageHandler {
* @param interval time interval received in the pdp update message from pap
*/
public void updateInterval(final long interval) {
- final PdpStatusPublisher pdpStatusPublisher = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER);
+ final var pdpStatusPublisher =
+ Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
pdpStatusPublisher.terminate();
final List<TopicSink> topicSinks = Registry.get(PdpSimulatorConstants.REG_PDP_TOPIC_SINKS);
Registry.registerOrReplace(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER,
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterHandler.java
index bf514f2e9..d86e0b424 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterHandler.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterHandler.java
@@ -55,7 +55,7 @@ public class PdpSimulatorParameterHandler {
// Read the parameters
try {
// Read the parameters from JSON
- final File file = new File(arguments.getFullConfigurationFilePath());
+ final var file = new File(arguments.getFullConfigurationFilePath());
pdpSimulatorParameterGroup = CODER.decode(file, PdpSimulatorParameterGroup.class);
} catch (final CoderException e) {
final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath()
diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java
index f82423c11..4c299914b 100644
--- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java
+++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -165,7 +165,7 @@ public class Main extends ServiceManagerContainer {
private SimulatorParameters readParameters(String paramFile) {
try {
- String paramsJson = getResourceAsString(paramFile);
+ var paramsJson = getResourceAsString(paramFile);
if (paramsJson == null) {
throw new IllegalArgumentException(new FileNotFoundException(paramFile));
}
@@ -183,14 +183,14 @@ public class Main extends ServiceManagerContainer {
}
private DmaapSimProvider buildDmaapProvider(DmaapSimParameterGroup params) {
- DmaapSimProvider prov = new DmaapSimProvider(params);
+ var prov = new DmaapSimProvider(params);
DmaapSimProvider.setInstance(prov);
prov.start();
return prov;
}
private CdsSimulator buildCdsSimulator(CdsServerParameters params) throws IOException {
- CdsSimulator cdsSimulator = new CdsSimulator(params.getHost(), params.getPort(), params.getResourceLocation(),
+ var cdsSimulator = new CdsSimulator(params.getHost(), params.getPort(), params.getResourceLocation(),
params.getSuccessRepeatCount(), params.getRequestedResponseDelayMs());
cdsSimulator.start();
return cdsSimulator;
@@ -211,7 +211,7 @@ public class Main extends ServiceManagerContainer {
private HttpServletServer buildRestServer(String dmaapName, ClassRestServerParameters params) {
try {
- Properties props = getServerProperties(dmaapName, params);
+ var props = getServerProperties(dmaapName, params);
HttpServletServer testServer = makeServer(props);
testServer.waitedStart(5000);
@@ -263,7 +263,7 @@ public class Main extends ServiceManagerContainer {
* @return a set of properties representing the given parameters
*/
private static Properties getServerProperties(String dmaapName, ClassRestServerParameters params) {
- final Properties props = new Properties();
+ final var props = new Properties();
props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, params.getName());
final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + params.getName();
diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java
index 491585e9c..28c4f42d2 100644
--- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java
+++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java
@@ -80,7 +80,7 @@ public class SimulatorParameters {
if (dmaapProvider != null) {
// do not want full validation of the provider, so validate the relevant
// fields ourselves
- BeanValidationResult subResult = new BeanValidationResult("dmaapProvider", dmaapProvider);
+ var subResult = new BeanValidationResult("dmaapProvider", dmaapProvider);
subResult.validateNotNull("name", dmaapProvider.getName());
if (dmaapProvider.getTopicSweepSec() < 1) {
subResult.addResult("topicSweepSec", dmaapProvider.getTopicSweepSec(),