From 6372b62fcd8813d7d49fb279b933ffe2e4637048 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 10 May 2021 09:53:23 -0400 Subject: Fix sonars in policy-models impls & simulators Fixed: - use "var" Issue-ID: POLICY-3094 Change-Id: I65da54cae5a58966f21f981c6cea1259bfdf4239 Signed-off-by: Jim Hahn simulators Change-Id: I1144568485e62e0c72194caaf21ebf1ba88a6fef Signed-off-by: Jim Hahn --- .../java/org/onap/policy/cds/client/CdsProcessorGrpcClient.java | 8 +------- .../java/org/onap/policy/cds/client/CdsProcessorHandler.java | 9 ++++----- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'models-interactions/model-impl/cds') 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 responseObserver = new StreamObserver() { + final StreamObserver responseObserver = new StreamObserver<>() { @Override public void onNext(ExecutionServiceOutput output) { NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, output.toString()); -- cgit 1.2.3-korg