From b7804abcf865dc58a01bed3f2be4756e731d9288 Mon Sep 17 00:00:00 2001 From: waynedunican Date: Tue, 23 Jul 2024 09:23:51 +0100 Subject: Improve code coverage and sonar fixes Increased code coverage to 90% SONAR - Removed TODO comments SONAR - Added NOSONAR where appropriate SONAR - Replaced stream.Collect() with stream.toList() where applicable SONAR - Made variables serializable or transient to comply with sonar rules Issue-ID: POLICY-5069 Change-Id: Ife256eaf4e6f427fe40b138bacc6f112dc5bcea4 Signed-off-by: waynedunican --- .../policy/controlloop/actor/a1p/A1pOperationTest.java | 2 +- .../controlloop/actor/a1p/BasicA1pOperation.java | 2 +- .../actor/aai/AaiCustomQueryOperationTest.java | 8 ++++---- .../controlloop/actor/aai/AaiGetOperationTest.java | 4 ++-- .../controlloop/actor/aai/AaiGetPnfOperationTest.java | 6 +++--- .../actor/aai/AaiGetTenantOperationTest.java | 4 ++-- .../controlloop/actor/appc/AppcOperationTest.java | 2 +- .../controlloop/actor/appc/BasicAppcOperation.java | 2 +- .../actor/appc/ModifyConfigOperationTest.java | 4 +--- .../actor/appclcm/AppcLcmOperationTest.java | 4 +--- .../actor/cds/GrpcActorServiceManagerTest.java | 6 +++--- .../actor/sdnc/BandwidthOnDemandOperationTest.java | 6 +++--- .../controlloop/actor/sdnc/BasicSdncOperation.java | 2 +- .../controlloop/actor/sdnr/BasicSdnrOperation.java | 4 ++-- .../controlloop/actor/sdnr/SdnrOperationTest.java | 4 +--- .../controlloop/actor/so/RestManagerResponse.java | 1 - .../policy/controlloop/actor/so/VfModuleDelete.java | 9 +-------- .../policy/controlloop/actor/so/ModifyCllTest.java | 2 +- .../policy/controlloop/actor/so/ModifyNssiTest.java | 2 +- .../policy/controlloop/actor/so/SoOperationTest.java | 4 ++-- .../controlloop/actor/so/VfModuleCreateTest.java | 2 +- .../controlloop/actor/so/VfModuleDeleteTest.java | 6 +++--- .../policy/controlloop/actor/test/BasicOperation.java | 3 ++- .../test/BasicBidirectionalTopicOperationTest.java | 3 +-- .../controlloop/actor/test/BasicHttpOperationTest.java | 6 +++--- .../controlloop/actor/test/BasicOperationTest.java | 8 ++++---- .../policy/controlloop/actor/vfc/VfcOperationTest.java | 1 - .../controlloop/actor/xacml/DecisionOperationTest.java | 2 +- .../controlloop/actor/xacml/GuardOperationTest.java | 3 +-- .../policy/controlloop/actor/xacml/XacmlActorTest.java | 1 - .../impl/BidirectionalTopicOperation.java | 1 - .../impl/BidirectionalTopicActorTest.java | 10 +++++----- .../impl/BidirectionalTopicOperationTest.java | 8 ++++---- .../actorserviceprovider/impl/HttpOperationTest.java | 4 ++-- .../impl/HttpPollingOperationTest.java | 2 +- .../impl/HttpPollingOperatorTest.java | 1 - .../impl/OperationPartialTest.java | 10 +++++----- .../pipeline/PipelineControllerFutureTest.java | 18 +++++++++--------- .../actorserviceprovider/topic/ForwarderTest.java | 1 - 39 files changed, 74 insertions(+), 94 deletions(-) (limited to 'models-interactions/model-actors') diff --git a/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/A1pOperationTest.java b/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/A1pOperationTest.java index 930888da2..7ab5d475d 100644 --- a/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/A1pOperationTest.java +++ b/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/A1pOperationTest.java @@ -59,7 +59,7 @@ import org.onap.policy.sdnr.util.StatusCodeEnum; */ @BeforeEach @Override - void setUp() throws Exception { + void setUp() { super.setUp(); operation = new A1pOperation(params, config); diff --git a/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java b/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java index 3620b0cef..6a254a4f1 100644 --- a/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java +++ b/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java @@ -69,7 +69,7 @@ public abstract class BasicA1pOperation extends BasicBidirectionalTopicOperation /** * Initializes mocks and sets up. */ - void setUp() throws Exception { + void setUp() { super.setUpBasic(); response = new PciMessage(); diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java index 8768aec7b..7a101cb8d 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023, 2024 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ class AaiCustomQueryOperationTest extends BasicAaiOperation { * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { super.setUpBasic(); oper = new AaiCustomQueryOperation(params, config); @@ -166,7 +166,7 @@ class AaiCustomQueryOperationTest extends BasicAaiOperation { } @Test - void testGetVserverLink() throws Exception { + void testGetVserverLink() { oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK); assertEquals(MY_LINK, oper.getVserverLink()); } @@ -194,7 +194,7 @@ class AaiCustomQueryOperationTest extends BasicAaiOperation { private OperationResult getResult(CompletableFuture future2) - throws InterruptedException, ExecutionException, TimeoutException { + throws InterruptedException, ExecutionException { executor.runAll(100); assertTrue(future2.isDone()); diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java index e9890b748..831edcc70 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023, 2024 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ class AaiGetOperationTest extends BasicAaiOperation { * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { super.setUpBasic(); oper = new AaiGetOperation(params, config); } diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java index cf2bb1b62..bed847a10 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023, 2024 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ class AaiGetPnfOperationTest extends BasicAaiOperation { * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { super.setUpBasic(); oper = new AaiGetPnfOperation(params, config); oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY); @@ -174,7 +174,7 @@ class AaiGetPnfOperationTest extends BasicAaiOperation { * Tests startOperationAsync() when a property is missing. */ @Test - void testStartOperationAsyncMissingProperty() throws Exception { + void testStartOperationAsyncMissingProperty() { oper = new AaiGetPnfOperation(params, config); oper.generateSubRequestId(1); diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java index 65d3fe831..e3beb52ac 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java @@ -75,7 +75,7 @@ class AaiGetTenantOperationTest extends BasicAaiOperation { * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { super.setUpBasic(); oper = new AaiGetTenantOperation(params, config); oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY); @@ -174,7 +174,7 @@ class AaiGetTenantOperationTest extends BasicAaiOperation { * Tests startOperationAsync() when a property is missing. */ @Test - void testStartOperationAsyncMissingProperty() throws Exception { + void testStartOperationAsyncMissingProperty() { oper = new AaiGetTenantOperation(params, config); oper.generateSubRequestId(1); diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java index caa190f71..94efe0af3 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java @@ -66,7 +66,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp */ @BeforeEach @Override - void setUp() throws Exception { + void setUp() { super.setUp(); oper = new MyOper(params, config); diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java index b934d8659..45d64db34 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java @@ -86,7 +86,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio /** * Initializes mocks and sets up. */ - void setUp() throws Exception { + void setUp() { super.setUpBasic(); response = new Response(); diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java index fad504434..2e0926e12 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java @@ -62,7 +62,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.Bidirectional @BeforeEach @Override - void setUp() throws Exception { + void setUp() { super.setUp(); oper = new ModifyConfigOperation(params, config); @@ -90,8 +90,6 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.Bidirectional oper.setProperty(OperationProperties.AAI_RESOURCE_VNF, genvnf); outcome = oper.start().get(); - // assertEquals(OperationResult.SUCCESS, outcome.getResult()); - // assertTrue(outcome.getResponse() instanceof Response); assertNotNull(outcome); } diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java index 8fa165f6f..53677c766 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java @@ -126,8 +126,6 @@ import org.onap.policy.simulators.TopicServer; oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY); outcome = oper.start().get(); - // assertEquals(OperationResult.SUCCESS, outcome.getResult()); - // assertTrue(outcome.getResponse() instanceof AppcLcmMessageWrapper); assertNotNull(outcome); } @@ -167,7 +165,7 @@ import org.onap.policy.simulators.TopicServer; * Tests makeRequest() when a property is missing. */ @Test - void testMakeRequestMissingProperty() throws Exception { + void testMakeRequestMissingProperty() { oper = new AppcLcmOperation(params, config); oper.generateSubRequestId(1); diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java index dc7fcf447..e3ad6bea4 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java @@ -51,7 +51,7 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationResult; * Sets up the fields. */ @BeforeEach - void setUp() throws Exception { + void setUp() { future = new CompletableFuture<>(); manager = new CdsActorServiceManager(new OperationOutcome(), future); } @@ -68,7 +68,7 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationResult; } @Test - void testOnMessageProcessing() throws InterruptedException, ExecutionException, TimeoutException { + void testOnMessageProcessing() { Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_PROCESSING).build(); output = ExecutionServiceOutput.newBuilder().setStatus(status).build(); @@ -89,7 +89,7 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationResult; } @Test - void testOnError() throws InterruptedException, ExecutionException, TimeoutException { + void testOnError() { Exception exception = new Exception("something failed"); manager.onError(exception); diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java index 3510c4a67..09ca68434 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java @@ -129,7 +129,7 @@ class BandwidthOnDemandOperationTest extends BasicSdncOperation { */ @Test - void testMakeRequestMissingBandwidth() throws Exception { + void testMakeRequestMissingBandwidth() { oper = new BandwidthOnDemandOperation(params, config); oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE); oper.setProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME, MY_CHANGE_TIME); @@ -143,7 +143,7 @@ class BandwidthOnDemandOperationTest extends BasicSdncOperation { } @Test - void testMakeRequestMissingBandwidthChangeTime() throws Exception { + void testMakeRequestMissingBandwidthChangeTime() { oper = new BandwidthOnDemandOperation(params, config); oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE); oper.setProperty(OperationProperties.ENRICHMENT_BANDWIDTH, MY_BANDWIDTH); @@ -157,7 +157,7 @@ class BandwidthOnDemandOperationTest extends BasicSdncOperation { } @Test - void testMakeRequestMissingVnfId() throws Exception { + void testMakeRequestMissingVnfId() { oper = new BandwidthOnDemandOperation(params, config); oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE); oper.setProperty(OperationProperties.ENRICHMENT_BANDWIDTH, MY_BANDWIDTH); diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java index cfdec987d..5dee02fcb 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java @@ -112,7 +112,7 @@ abstract class BasicSdncOperation extends BasicHttpOperation { * @return the request that was posted */ protected SdncRequest verifyOperation(SdncOperation operation) - throws InterruptedException, ExecutionException, TimeoutException, CoderException { + throws InterruptedException, ExecutionException, CoderException { CompletableFuture future2 = operation.start(); executor.runAll(100); diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java index ee9a3a1f2..bd67f7fec 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java @@ -70,7 +70,7 @@ abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperation future2 = operation.start(); executor.runAll(100); diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java index e16ad1177..f7dd9b935 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java @@ -66,7 +66,7 @@ import org.onap.policy.sdnr.util.StatusCodeEnum; */ @BeforeEach @Override - void setUp() throws Exception { + void setUp() { super.setUp(); operation = new SdnrOperation(params, config); @@ -148,8 +148,6 @@ import org.onap.policy.sdnr.util.StatusCodeEnum; operation.setProperty(OperationProperties.EVENT_PAYLOAD, "my payload"); outcome = operation.start().get(); - // assertEquals(OperationResult.SUCCESS, outcome.getResult()); - // assertTrue(outcome.getResponse() instanceof PciMessage); assertNotNull(outcome); } diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java index 129305d99..57c3f7ee2 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java @@ -46,7 +46,6 @@ import org.onap.policy.common.utils.coder.CoderException; */ @AllArgsConstructor public class RestManagerResponse extends Response { - // TODO move to actorServices @Getter private final int status; 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 8076fbcb9..4ef0a7ba9 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 @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Wipro Limited. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,7 +121,6 @@ public class VfModuleDelete extends SoOperation { */ protected CompletableFuture delete(String uri, Map headers, String contentType, String request, InvocationCallback callback) { - // TODO move to HttpOperation final String url = getClient().getBaseUrl() + uri; @@ -163,7 +162,6 @@ public class VfModuleDelete extends SoOperation { * @return the builder */ protected Builder addAuthHeader(Builder builder) { - // TODO move to HttpOperation final HttpClient client = getClient(); String username = client.getUserName(); if (StringUtils.isBlank(username)) { @@ -229,11 +227,6 @@ public class VfModuleDelete extends SoOperation { // requestInfo details.setRequestInfo(constructRequestInfo()); - /* - * TODO the legacy SO code always passes null for the last argument, though it - * should be passing the vfModuleInstanceId - */ - // compute the path String svcId = getRequiredText("service instance ID", vnfServiceItem.getServiceInstanceId()); String path = PATH_PREFIX + svcId + "/vnfs/" + vnfItem.getVnfId() + "/vfModules/null"; diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyCllTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyCllTest.java index ff1a93b85..0edc7d374 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyCllTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyCllTest.java @@ -110,7 +110,7 @@ class ModifyCllTest extends BasicSoOperation { * Tests makeRequest() when a property is missing. */ @Test - void testMakeRequestMissingProperty() throws Exception { + void testMakeRequestMissingProperty() { oper = new ModifyCll(params, config); assertThatIllegalStateException().isThrownBy(() -> oper.makeRequest()) diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java index c5c183275..4db3ca308 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java @@ -110,7 +110,7 @@ class ModifyNssiTest extends BasicSoOperation { * Tests makeRequest() when a property is missing. */ @Test - void testMakeRequestMissingProperty() throws Exception { + void testMakeRequestMissingProperty() { oper = new ModifyNssi(params, config); assertThatIllegalStateException().isThrownBy(() -> oper.makeRequest()) diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java index fe88a2371..f04708210 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java @@ -212,7 +212,7 @@ import org.onap.policy.so.SoResponse; } @Test - void testConstructCloudConfiguration() throws Exception { + void testConstructCloudConfiguration() { Tenant tenantItem = new Tenant(); tenantItem.setTenantId("my-tenant-id"); @@ -235,7 +235,7 @@ import org.onap.policy.so.SoResponse; } @Test - void testGetRequiredText() throws Exception { + void testGetRequiredText() { assertThatCode(() -> oper.getRequiredText("some value", "my value")).doesNotThrowAnyException(); diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java index 721cb6a6d..d1b2c0747 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java @@ -221,7 +221,7 @@ class VfModuleCreateTest extends BasicSoOperation { * Tests makeRequest() when a property is missing. */ @Test - void testMakeRequestMissingProperty() throws Exception { + void testMakeRequestMissingProperty() { loadProperties(); ServiceInstance instance = new ServiceInstance(); diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java index 5ece1968d..208db3f57 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java @@ -277,7 +277,7 @@ class VfModuleDeleteTest extends BasicSoOperation { */ @Test @SuppressWarnings("unchecked") - void testDeleteException() throws Exception { + void testDeleteException() { Throwable thrown = new IllegalStateException(EXPECTED_EXCEPTION); // need a new future, with an exception @@ -360,7 +360,7 @@ class VfModuleDeleteTest extends BasicSoOperation { * Tests makeRequest() when a property is missing. */ @Test - void testMakeRequestMissingProperty() throws Exception { + void testMakeRequestMissingProperty() { loadProperties(); ServiceInstance instance = new ServiceInstance(); @@ -381,7 +381,7 @@ class VfModuleDeleteTest extends BasicSoOperation { } @SuppressWarnings("unchecked") - private void configureResponse(String responseText) throws CoderException { + private void configureResponse(String responseText) { // indicate that the response was completed lenient().when(javaResp.statusCode()).thenReturn(200); lenient().when(javaResp.body()).thenReturn(responseText); 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 48ee9dcfc..4727de010 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 @@ -24,6 +24,7 @@ package org.onap.policy.controlloop.actor.test; import static org.junit.jupiter.api.Assertions.assertEquals; import jakarta.ws.rs.core.Response; +import java.util.Collections; import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -122,7 +123,7 @@ public class BasicOperation { * @return payload data */ protected Map makePayload() { - return null; + return Collections.emptyMap(); } /** diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java index c795f9cc5..0d04e5894 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java @@ -37,7 +37,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.onap.policy.common.endpoints.event.comm.TopicSink; @@ -71,7 +70,7 @@ class BasicBidirectionalTopicOperationTest { * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { oper.setUpBasic(); } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java index 58392b96e..907802963 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java @@ -43,7 +43,7 @@ class BasicHttpOperationTest { @BeforeEach - void setUp() throws Exception { + void setUp() { oper = new BasicHttpOperation(ACTOR, OPERATION); oper.setUpBasic(); } @@ -62,7 +62,7 @@ class BasicHttpOperationTest { } @Test - void testSetUp() throws Exception { + void testSetUp() { assertNotNull(oper.client); assertSame(oper.client, oper.factory.get(BasicHttpOperation.MY_CLIENT)); assertEquals(200, oper.rawResponse.getStatus()); @@ -73,7 +73,7 @@ class BasicHttpOperationTest { } @Test - void testInitOperator() throws Exception { + void testInitOperator() { oper.initConfig(); assertSame(oper.client, oper.config.getClient()); diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java index b2afce2c3..cf61e191b 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java @@ -23,9 +23,9 @@ package org.onap.policy.controlloop.actor.test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; +import java.util.Collections; import java.util.Map; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -44,7 +44,7 @@ import org.onap.policy.controlloop.actorserviceprovider.Util; @BeforeEach - void setUp() throws Exception { + void setUp() { oper = new BasicHttpOperation(ACTOR, OPERATION); oper.setUpBasic(); } @@ -63,7 +63,7 @@ import org.onap.policy.controlloop.actorserviceprovider.Util; } @Test - void testSetUp() throws Exception { + void testSetUp() { assertNotNull(oper.future); assertNotNull(oper.outcome); assertNotNull(oper.executor); @@ -82,7 +82,7 @@ import org.onap.policy.controlloop.actorserviceprovider.Util; @Test void testMakePayload() { - assertNull(oper.makePayload()); + assertEquals(Collections.emptyMap(), oper.makePayload()); } @Test diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java index 920e79984..e0fd18b08 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java @@ -76,7 +76,6 @@ import org.onap.policy.vfc.VfcResponseDescriptor; VfcResponseDescriptor mockDescriptor = Mockito.mock(VfcResponseDescriptor.class); Mockito.when(mockResponse.getResponseDescriptor()).thenReturn(mockDescriptor); - // TODO use actual request state value Mockito.when(mockDescriptor.getStatus()).thenReturn("COMPLETE"); assertNotNull(oper.getRequestState(mockResponse)); } diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java index ee9d28c57..fa81836f3 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java @@ -94,7 +94,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { super.setUpBasic(); guardConfig = mock(DecisionConfig.class); diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java index a4187b523..f8b53e8f8 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java @@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.util.Map; import java.util.TreeMap; @@ -86,7 +85,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { super.setUpBasic(); guardConfig = mock(DecisionConfig.class); diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/XacmlActorTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/XacmlActorTest.java index 3f0e52860..81c946419 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/XacmlActorTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/XacmlActorTest.java @@ -23,7 +23,6 @@ package org.onap.policy.controlloop.actor.xacml; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.stream.Collectors; 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 5765f35ba..8f2199f05 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 @@ -95,7 +95,6 @@ public abstract class BidirectionalTopicOperation extends OperationPartial */ @Override protected long getTimeoutMs(Integer timeoutSec) { - // TODO move this method to the superclass return (timeoutSec == null || timeoutSec == 0 ? getTimeoutMs() : super.getTimeoutMs(timeoutSec)); } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java index 5ecebd668..7e4543eca 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java @@ -98,7 +98,7 @@ class BidirectionalTopicActorTest { } @Test - void testDoStart() throws BidirectionalTopicClientException { + void testDoStart() { // allocate some handlers actor.getTopicHandler(MY_SINK, MY_SOURCE1); actor.getTopicHandler(MY_SINK, MY_SOURCE2); @@ -117,7 +117,7 @@ class BidirectionalTopicActorTest { } @Test - void testDoStop() throws BidirectionalTopicClientException { + void testDoStop() { // allocate some handlers actor.getTopicHandler(MY_SINK, MY_SOURCE1); actor.getTopicHandler(MY_SINK, MY_SOURCE2); @@ -136,7 +136,7 @@ class BidirectionalTopicActorTest { } @Test - void testDoShutdown() throws BidirectionalTopicClientException { + void testDoShutdown() { // allocate some handlers actor.getTopicHandler(MY_SINK, MY_SOURCE1); @@ -187,7 +187,7 @@ class BidirectionalTopicActorTest { } @Test - void testGetTopicHandler() throws BidirectionalTopicClientException { + void testGetTopicHandler() { assertSame(handler1, actor.getTopicHandler(MY_SINK, MY_SOURCE1)); assertSame(handler2, actor.getTopicHandler(MY_SINK, MY_SOURCE2)); @@ -195,7 +195,7 @@ class BidirectionalTopicActorTest { } @Test - void testMakeTopicHandler() throws BidirectionalTopicClientException { + void testMakeTopicHandler() { // use a real actor actor = new BidirectionalTopicActor<>(ACTOR, BidirectionalTopicActorParams.class); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java index 1fc8cc18e..67283f5d4 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java @@ -174,7 +174,7 @@ class BidirectionalTopicOperationTest { * Tests startOperationAsync() when processResponse() throws an exception. */ @Test - void testStartOperationAsyncProcException() throws Exception { + void testStartOperationAsyncProcException() { oper = new MyOperation(params, config) { @Override protected OperationOutcome processResponse(OperationOutcome outcome, String rawResponse, @@ -202,7 +202,7 @@ class BidirectionalTopicOperationTest { * Tests startOperationAsync() when the publisher throws an exception. */ @Test - void testStartOperationAsyncPubException() throws Exception { + void testStartOperationAsyncPubException() { // indicate that nothing was published when(handler.send(any())).thenReturn(false); @@ -302,7 +302,7 @@ class BidirectionalTopicOperationTest { * Tests processResponse() when the decoder succeeds. */ @Test - void testProcessResponseDecodeOk() throws CoderException { + void testProcessResponseDecodeOk() { assertSame(outcome, oper.processResponse(outcome, responseText, stdResponse)); assertEquals(OperationResult.SUCCESS, outcome.getResult()); assertEquals(response, outcome.getResponse()); @@ -312,7 +312,7 @@ class BidirectionalTopicOperationTest { * Tests processResponse() when the decoder throws an exception. */ @Test - void testProcessResponseDecodeExcept() throws CoderException { + void testProcessResponseDecodeExcept() { assertThatIllegalArgumentException().isThrownBy( () -> oper.processResponse(outcome, "{invalid json", stdResponse)); } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java index 9813d1b7a..8e1a8783a 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java @@ -260,7 +260,7 @@ class HttpOperationTest { * Tests handleResponse() when it fails. */ @Test - void testHandleResponseFailed() throws Exception { + void testHandleResponseFailed() { CompletableFuture future2 = oper.handleResponse(outcome, PATH, cb -> { callback.set(cb); return future; @@ -322,7 +322,7 @@ class HttpOperationTest { * Tests processResponse() when the decoder throws an exception. */ @Test - void testProcessResponseDecodeExcept() throws CoderException { + void testProcessResponseDecodeExcept() { MyGetOperation oper2 = new MyGetOperation<>(Integer.class); assertThatIllegalArgumentException().isThrownBy(() -> oper2.processResponse(outcome, PATH, response)); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java index 0850bb358..78f465ea8 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java @@ -89,7 +89,7 @@ class HttpPollingOperationTest { * Sets up. */ @BeforeEach - void setUp() throws Exception { + void setUp() { Mockito.lenient().when(client.getBaseUrl()).thenReturn(BASE_URI); Mockito.lenient().when(config.getClient()).thenReturn(client); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java index ca81e2eb3..13a16bfc2 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java @@ -29,7 +29,6 @@ import static org.mockito.Mockito.when; import java.util.Collections; import java.util.Map; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java index 27b841a91..d2ca7dbc6 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java @@ -137,7 +137,7 @@ class OperationPartialTest { * Attaches the appender to the logger. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() { /* * Attach appender to the logger. */ @@ -565,7 +565,7 @@ class OperationPartialTest { */ @Test @SuppressWarnings("unchecked") - void testAnyOfEdge() throws Exception { + void testAnyOfEdge() { List>> tasks = new LinkedList<>(); // zero items: check both using a list and using an array @@ -651,7 +651,7 @@ class OperationPartialTest { */ @Test @SuppressWarnings("unchecked") - void testAllOfEdge() throws Exception { + void testAllOfEdge() { List>> tasks = new LinkedList<>(); // zero items: check both using a list and using an array @@ -667,7 +667,7 @@ class OperationPartialTest { } @Test - void testAttachFutures() throws Exception { + void testAttachFutures() { List>> tasks = new LinkedList<>(); // third task throws an exception during construction @@ -770,7 +770,7 @@ class OperationPartialTest { */ @Test @SuppressWarnings("unchecked") - void testSequenceEdge() throws Exception { + void testSequenceEdge() { List>> tasks = new LinkedList<>(); // zero items: check both using a list and using an array diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineControllerFutureTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineControllerFutureTest.java index c0d3a0df8..2c8275986 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineControllerFutureTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineControllerFutureTest.java @@ -157,7 +157,7 @@ class PipelineControllerFutureTest { * Tests completeAsync(executor) when canceled before execution. */ @Test - void testCompleteAsyncSupplierOfQextendsTExecutorCanceled() throws Exception { + void testCompleteAsyncSupplierOfQextendsTExecutorCanceled() { CompletableFuture future = controller.completeAsync(() -> TEXT, executor); assertTrue(future.cancel(false)); @@ -181,7 +181,7 @@ class PipelineControllerFutureTest { * Tests completeAsync() when canceled. */ @Test - void testCompleteAsyncSupplierOfQextendsTCanceled() throws Exception { + void testCompleteAsyncSupplierOfQextendsTCanceled() { CountDownLatch canceled = new CountDownLatch(1); // run async, but await until canceled @@ -210,7 +210,7 @@ class PipelineControllerFutureTest { @Test void testCompleteOnTimeoutTLongTimeUnit() throws Exception { CountDownLatch stopped = new CountDownLatch(1); - controller.add(() -> stopped.countDown()); + controller.add(stopped::countDown); CompletableFuture future = controller.completeOnTimeout(TEXT, 1, TimeUnit.MILLISECONDS); @@ -288,7 +288,7 @@ class PipelineControllerFutureTest { * Tests delayedComplete() when an exception is generated. */ @Test - void testDelayedCompleteWithException() throws Exception { + void testDelayedCompleteWithException() { controller.add(runnable1); BiConsumer stopper = controller.delayedComplete(); @@ -314,7 +314,7 @@ class PipelineControllerFutureTest { } @Test - void testDelayedRemoveFutureOfF() throws Exception { + void testDelayedRemoveFutureOfF() { BiConsumer remover = controller.delayedRemove(future1); remover.accept(TEXT, EXPECTED_EXCEPTION); @@ -331,7 +331,7 @@ class PipelineControllerFutureTest { } @Test - void testDelayedRemoveRunnable() throws Exception { + void testDelayedRemoveRunnable() { BiConsumer remover = controller.delayedRemove(runnable1); remover.accept(TEXT, EXPECTED_EXCEPTION); @@ -380,7 +380,7 @@ class PipelineControllerFutureTest { * Tests wrap(), when the controller is not running. */ @Test - void testWrapNotRunning() throws Exception { + void testWrapNotRunning() { controller.cancel(false); controller = spy(controller); @@ -395,7 +395,7 @@ class PipelineControllerFutureTest { * Tests wrap(), when the future throws an exception. */ @Test - void testWrapException() throws Exception { + void testWrapException() { controller = spy(controller); CompletableFuture future = controller.wrap(compFuture); @@ -428,7 +428,7 @@ class PipelineControllerFutureTest { * Tests wrap(Function) when the controller is canceled after the future is added. */ @Test - void testWrapFunctionCancel() throws Exception { + void testWrapFunctionCancel() { Function> func = controller.wrap(input -> compFuture); CompletableFuture future = func.apply(TEXT); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/ForwarderTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/ForwarderTest.java index e050416f5..f27eb6ae5 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/ForwarderTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/ForwarderTest.java @@ -31,7 +31,6 @@ import static org.mockito.Mockito.verify; import java.util.Arrays; import java.util.Map; import java.util.function.BiConsumer; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; -- cgit 1.2.3-korg