From 82579d41d0faeefd97df376045ab6727ceaf6afb Mon Sep 17 00:00:00 2001 From: "k.kedron" Date: Mon, 19 Jul 2021 18:05:52 +0200 Subject: [PATCH] Upgrade CDS dependency - New CDS client libraries. - Update code to use new CDS BlueprintProcessingService Change-Id: I00fb044908774a48755ff8d9ebb32e055a74c819 Issue-ID: POLICY-3507 Signed-off-by: Krystian Kedron Signed-off-by: Ram Krishna Verma --- models-interactions/model-impl/cds/pom.xml | 2 +- .../java/org/onap/policy/cds/client/CdsProcessorHandler.java | 10 +++++----- .../cds/client/BasicAuthClientHeaderInterceptorTest.java | 12 ++++++------ .../onap/policy/cds/client/CdsProcessorGrpcClientTest.java | 6 +++--- .../main/java/org/onap/policy/simulators/CdsSimulator.java | 6 +++--- .../java/org/onap/policy/simulators/CdsSimulatorTest.java | 6 +++--- pom.xml | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/models-interactions/model-impl/cds/pom.xml b/models-interactions/model-impl/cds/pom.xml index 6167666fa..f8e4ab193 100644 --- a/models-interactions/model-impl/cds/pom.xml +++ b/models-interactions/model-impl/cds/pom.xml @@ -39,7 +39,7 @@ - org.onap.ccsdk.cds.blueprintsprocessor + org.onap.ccsdk.cds.blueprintsprocessor.modules blueprint-proto 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..aa992e6fa 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 @@ -23,8 +23,8 @@ 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.BlueprintProcessingServiceGrpc; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceStub; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; import org.onap.policy.cds.api.CdsProcessorListener; @@ -51,9 +51,9 @@ public class CdsProcessorHandler { LOGGER.info("Processing blueprint({}:{}) for action({})", header.getBlueprintVersion(), header.getBlueprintName(), header.getBlueprintVersion()); - final CountDownLatch finishLatch = new CountDownLatch(1); - final BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel); - final StreamObserver responseObserver = new StreamObserver() { + final var finishLatch = new CountDownLatch(1); + final BlueprintProcessingServiceStub asyncStub = BlueprintProcessingServiceGrpc.newStub(channel); + final StreamObserver 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/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java index 3192520ae..aa28664d8 100644 --- a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java +++ b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Bell Canada. + * Copyright (C) 2019,2021 Bell Canada. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,9 +45,9 @@ import org.junit.Rule; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; -import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc; -import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase; -import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceStub; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; import org.onap.policy.cds.properties.CdsServerProperties; @@ -83,7 +83,7 @@ public class BasicAuthClientHeaderInterceptorTest { props.setTimeout(60); // Implement the test gRPC server - BluePrintProcessingServiceImplBase testCdsBlueprintServerImpl = new BluePrintProcessingServiceImplBase() {}; + BlueprintProcessingServiceImplBase testCdsBlueprintServerImpl = new BlueprintProcessingServiceImplBase() {}; // Create a server, add service, start, and register for automatic graceful shutdown. grpcCleanup.register(InProcessServerBuilder.forName(SERVER_NAME).directExecutor() @@ -96,7 +96,7 @@ public class BasicAuthClientHeaderInterceptorTest { @Test public void testIfBasicAuthHeaderIsDeliveredToCdsServer() { - BluePrintProcessingServiceStub bpProcessingSvcStub = BluePrintProcessingServiceGrpc + BlueprintProcessingServiceStub bpProcessingSvcStub = BlueprintProcessingServiceGrpc .newStub(ClientInterceptors.intercept(channel, new BasicAuthClientHeaderInterceptor(props))); ArgumentCaptor metadataCaptor = ArgumentCaptor.forClass(Metadata.class); bpProcessingSvcStub.process(new StreamObserver() { diff --git a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java index 0922fc4cb..e7b3c195a 100644 --- a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java +++ b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Bell Canada. + * Copyright (C) 2019,2021 Bell Canada. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,7 +44,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; -import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; import org.onap.policy.cds.api.CdsProcessorListener; @@ -95,7 +95,7 @@ public class CdsProcessorGrpcClientTest { client = new CdsProcessorGrpcClient(channel, new CdsProcessorHandler(listener, "gRPC://localhost:1234/")); // Implement the test gRPC server - BluePrintProcessingServiceImplBase testCdsBlueprintServerImpl = new BluePrintProcessingServiceImplBase() { + BlueprintProcessingServiceImplBase testCdsBlueprintServerImpl = new BlueprintProcessingServiceImplBase() { @Override public StreamObserver process( final StreamObserver responseObserver) { 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..011aacc81 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2020-2021 Bell Canada. 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. @@ -37,7 +37,7 @@ 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; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput.Builder; @@ -81,7 +81,7 @@ public class CdsSimulator implements Runnable { this.port = port; this.resourceLocation = resourceLocation; - BluePrintProcessingServiceImplBase testCdsBlueprintServerImpl = new BluePrintProcessingServiceImplBase() { + BlueprintProcessingServiceImplBase testCdsBlueprintServerImpl = new BlueprintProcessingServiceImplBase() { @Override public StreamObserver process( diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java index 21d766f09..46c56a1e6 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java @@ -38,8 +38,8 @@ import org.json.simple.parser.ParseException; import org.junit.After; import org.junit.Before; import org.junit.Test; -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.BlueprintProcessingServiceGrpc; +import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceStub; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput.Builder; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; @@ -81,7 +81,7 @@ public class CdsSimulatorTest { final CompletableFuture future = new CompletableFuture<>(); final CountDownLatch completed = new CountDownLatch(1); - BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel); + BlueprintProcessingServiceStub asyncStub = BlueprintProcessingServiceGrpc.newStub(channel); StreamObserver responseObserver = new StreamObserver() { @Override diff --git a/pom.xml b/pom.xml index 620089d31..63e328ac8 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.onap.policy.parent integration - 3.3.1 + 3.3.2-SNAPSHOT @@ -42,7 +42,7 @@ 10.13.1.1 2.1.1 - 1.8.1 + 1.8.2-SNAPSHOT -- 2.16.6