diff options
author | waynedunican <wayne.dunican@est.tech> | 2024-06-13 09:19:14 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2024-06-20 12:24:23 +0100 |
commit | 9e8684c88435734cb2e142208436cec647cde887 (patch) | |
tree | b06334cdf8309d36ceba948797ff071d14a2e82d /models-interactions/model-actors/actor.cds | |
parent | 8236c8bab1a27bd721586550f8ba879abcba3239 (diff) |
Convert models to JUnit 5
Review for models-actors
Issue-ID: POLICY-5042
Change-Id: Ica07b9fbda1eca24a8a432d57a2d9af52c84625d
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'models-interactions/model-actors/actor.cds')
9 files changed, 100 insertions, 92 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorTest.java index 1d84e1c60..a3dfcaf50 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Bell Canada. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020, 2024 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,24 +20,24 @@ package org.onap.policy.controlloop.actor.cds; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actor.test.BasicActor; import org.onap.policy.controlloop.actorserviceprovider.Operator; -public class CdsActorTest extends BasicActor { +class CdsActorTest extends BasicActor { @Test - public void testActorService() { + void testActorService() { // verify that it all plugs into the ActorService verifyActorService(CdsActorConstants.CDS_ACTOR, "service.yaml"); } @Test - public void testGetOperator() { + void testGetOperator() { CdsActor sp = new CdsActor(); // should always return the same operator regardless of the name 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 456b10fdf..dc7fcf447 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 @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Bell Canada. All rights reserved. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -20,27 +21,27 @@ package org.onap.policy.controlloop.actor.cds; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; 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.ExecutionServiceOutput; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -@RunWith(MockitoJUnitRunner.class) -public class GrpcActorServiceManagerTest { +@ExtendWith(MockitoExtension.class) + class GrpcActorServiceManagerTest { CdsActorServiceManager manager; CompletableFuture<OperationOutcome> future; @@ -49,14 +50,14 @@ public class GrpcActorServiceManagerTest { /** * Sets up the fields. */ - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { future = new CompletableFuture<>(); manager = new CdsActorServiceManager(new OperationOutcome(), future); } @Test - public void testOnMessageSuccess() throws InterruptedException, ExecutionException, TimeoutException { + void testOnMessageSuccess() throws InterruptedException, ExecutionException, TimeoutException { Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_EXECUTED).build(); output = ExecutionServiceOutput.newBuilder().setStatus(status).build(); @@ -67,7 +68,7 @@ public class GrpcActorServiceManagerTest { } @Test - public void testOnMessageProcessing() throws InterruptedException, ExecutionException, TimeoutException { + void testOnMessageProcessing() throws InterruptedException, ExecutionException, TimeoutException { Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_PROCESSING).build(); output = ExecutionServiceOutput.newBuilder().setStatus(status).build(); @@ -77,7 +78,7 @@ public class GrpcActorServiceManagerTest { } @Test - public void testOnMessageFailure() throws InterruptedException, ExecutionException, TimeoutException { + void testOnMessageFailure() throws InterruptedException, ExecutionException, TimeoutException { Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_FAILURE).build(); output = ExecutionServiceOutput.newBuilder().setStatus(status).build(); @@ -88,7 +89,7 @@ public class GrpcActorServiceManagerTest { } @Test - public void testOnError() throws InterruptedException, ExecutionException, TimeoutException { + void testOnError() throws InterruptedException, ExecutionException, TimeoutException { Exception exception = new Exception("something failed"); manager.onError(exception); diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java index cae048b17..c5a20d9f2 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Bell Canada. All rights reserved. * Modifications Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -22,9 +23,9 @@ package org.onap.policy.controlloop.actor.cds; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.Collections; import java.util.HashMap; @@ -33,13 +34,13 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; @@ -60,8 +61,8 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp import org.onap.policy.simulators.CdsSimulator; import org.onap.policy.simulators.Util; -@RunWith(MockitoJUnitRunner.class) -public class GrpcOperationTest { +@ExtendWith(MockitoExtension.class) + class GrpcOperationTest { private static final String MY_VNF = "my-vnf"; private static final String MY_SVC_ID = "my-service-instance-id"; private static final String RESOURCE_ID = "my-resource-id"; @@ -86,21 +87,21 @@ public class GrpcOperationTest { private GrpcConfig config; private GrpcOperation operation; - @BeforeClass - public static void setUpBeforeClass() throws Exception { + @BeforeAll + static void setUpBeforeClass() throws Exception { sim = Util.buildCdsSim(); } - @AfterClass - public static void tearDownAfterClass() { + @AfterAll + static void tearDownAfterClass() { sim.stop(); } /** * Sets up the fields. */ - @Before - public void setUp() { + @BeforeEach + void setUp() { // Setup the CDS properties cdsProps = new CdsServerProperties(); cdsProps.setHost("10.10.10.10"); @@ -124,7 +125,7 @@ public class GrpcOperationTest { * Tests "success" case with simulator. */ @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { Map<String, Object> payload = Map.of("artifact_name", "my_artifact", "artifact_version", "1.0"); params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation("subscribe") @@ -145,11 +146,11 @@ public class GrpcOperationTest { OperationOutcome outcome = operation.start().get(); assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof ExecutionServiceOutput); + assertInstanceOf(ExecutionServiceOutput.class, outcome.getResponse()); } @Test - public void testGetPropertyNames() { + void testGetPropertyNames() { /* * check VNF case with target entities */ @@ -195,7 +196,7 @@ public class GrpcOperationTest { } @Test - public void testGetServiceInstanceId() { + void testGetServiceInstanceId() { params = params.toBuilder().targetType(TargetType.VNF).targetEntityIds(targetEntityIds).build(); operation = new GrpcOperation(params, config); loadVnfData(); @@ -206,7 +207,7 @@ public class GrpcOperationTest { } @Test - public void testGetVnfId() { + void testGetVnfId() { params = params.toBuilder().targetType(TargetType.VNF).targetEntityIds(targetEntityIds).build(); operation = new GrpcOperation(params, config); loadVnfData(); @@ -231,7 +232,7 @@ public class GrpcOperationTest { } @Test - public void testStartOperationAsync() { + void testStartOperationAsync() { ControlLoopOperationParams clop = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR) .operation(GrpcOperation.NAME) @@ -248,7 +249,7 @@ public class GrpcOperationTest { * Tests startOperationAsync() when the target type is PNF. */ @Test - public void testStartOperationAsyncPnf() { + void testStartOperationAsyncPnf() { ControlLoopOperationParams clop = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR) .operation(GrpcOperation.NAME) @@ -261,7 +262,7 @@ public class GrpcOperationTest { } @Test - public void testStartOperationAsyncError() { + void testStartOperationAsyncError() { operation = new GrpcOperation(params, config); assertThatIllegalArgumentException() .isThrownBy(() -> operation.startOperationAsync(1, params.makeOutcome())); diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java index aa11d7efd..cd81dc7a5 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Bell Canada. All rights reserved. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -22,14 +23,14 @@ package org.onap.policy.controlloop.actor.cds; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Map; import java.util.UUID; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.policy.cds.properties.CdsServerProperties; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actorserviceprovider.Operation; @@ -37,8 +38,8 @@ import org.onap.policy.controlloop.actorserviceprovider.Util; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.ParameterValidationRuntimeException; -@RunWith(MockitoJUnitRunner.class) -public class GrpcOperatorTest { +@ExtendWith(MockitoExtension.class) + class GrpcOperatorTest { GrpcOperator operation; Map<String, Object> paramMap; @@ -47,8 +48,8 @@ public class GrpcOperatorTest { /** * Initializes fields, including {@link #operation}. */ - @Before - public void setUp() { + @BeforeEach + void setUp() { operation = new GrpcOperator(CdsActorConstants.CDS_ACTOR, GrpcOperation.NAME, GrpcOperation::new); CdsServerProperties props = new CdsServerProperties(); @@ -64,7 +65,7 @@ public class GrpcOperatorTest { } @Test - public void testGrpcOperator() { + void testGrpcOperator() { assertEquals(CdsActorConstants.CDS_ACTOR, operation.getActorName()); assertEquals(GrpcOperation.NAME, operation.getName()); assertEquals(CdsActorConstants.CDS_ACTOR + "." + GrpcOperation.NAME, operation.getFullName()); @@ -72,7 +73,7 @@ public class GrpcOperatorTest { @Test - public void testDoConfigure() { + void testDoConfigure() { operation.doConfigure(paramMap); assertEquals(30000, operation.getCurrentConfig().getTimeoutMs()); @@ -83,7 +84,7 @@ public class GrpcOperatorTest { } @Test - public void testBuildOperation() { + void testBuildOperation() { ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR) .operation(GrpcOperation.NAME).requestId(UUID.randomUUID()).build(); diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrcpOperationResourceVnfPropertiesTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrcpOperationResourceVnfPropertiesTest.java index 44ebc12c5..1b20ef2bb 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrcpOperationResourceVnfPropertiesTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrcpOperationResourceVnfPropertiesTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -19,12 +20,12 @@ package org.onap.policy.controlloop.actor.cds.properties; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.policy.cds.properties.CdsServerProperties; @@ -35,16 +36,16 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; -public class GrcpOperationResourceVnfPropertiesTest { +class GrcpOperationResourceVnfPropertiesTest { @Test - public void getPropertyNames() { + void getPropertyNames() { assertEquals(GrcpOperationResourceVnfProperties.VNF_PROPERTY_NAMES, new GrcpOperationResourceVnfProperties().getPropertyNames()); } @Test - public void convertToAaiProperties() { + void convertToAaiProperties() { ControlLoopOperationParams params = ControlLoopOperationParams.builder() .targetType(TargetType.VNF) diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPnfPropertiesTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPnfPropertiesTest.java index 828ededa9..db034001a 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPnfPropertiesTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPnfPropertiesTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -19,12 +20,12 @@ package org.onap.policy.controlloop.actor.cds.properties; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.cds.properties.CdsServerProperties; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; @@ -37,17 +38,17 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; -public class GrpcOperationPnfPropertiesTest { +class GrpcOperationPnfPropertiesTest { private static final Coder coder = new StandardCoder(); @Test - public void getPropertyNames() { + void getPropertyNames() { assertEquals(GrpcOperationPnfProperties.PNF_PROPERTY_NAMES, new GrpcOperationPnfProperties().getPropertyNames()); } @Test - public void convertToAaiProperties() throws CoderException { + void convertToAaiProperties() throws CoderException { ControlLoopOperationParams params = ControlLoopOperationParams.builder() .targetType(TargetType.PNF) diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPropertiesTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPropertiesTest.java index 514df4e2f..df848e6d8 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPropertiesTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationPropertiesTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -18,18 +19,18 @@ package org.onap.policy.controlloop.actor.cds.properties; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; -public class GrpcOperationPropertiesTest { +class GrpcOperationPropertiesTest { @Test - public void build() { + void build() { ControlLoopOperationParams params = ControlLoopOperationParams.builder().targetType(TargetType.VNF).build(); assertEquals(GrpcOperationTargetVnfProperties.VNF_PROPERTY_NAMES, GrpcOperationProperties.build(params).getPropertyNames()); diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationTargetVnfPropertiesTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationTargetVnfPropertiesTest.java index 798a96bed..dbc014203 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationTargetVnfPropertiesTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/properties/GrpcOperationTargetVnfPropertiesTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -19,12 +20,12 @@ package org.onap.policy.controlloop.actor.cds.properties; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.cds.properties.CdsServerProperties; import org.onap.policy.common.utils.time.PseudoExecutor; import org.onap.policy.controlloop.actor.cds.GrpcConfig; @@ -33,16 +34,16 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; -public class GrpcOperationTargetVnfPropertiesTest { +class GrpcOperationTargetVnfPropertiesTest { @Test - public void getPropertyNames() { + void getPropertyNames() { assertEquals(GrpcOperationTargetVnfProperties.VNF_PROPERTY_NAMES, new GrpcOperationTargetVnfProperties().getPropertyNames()); } @Test - public void convertToAaiProperties() { + void convertToAaiProperties() { ControlLoopOperationParams params = ControlLoopOperationParams.builder() .targetType(TargetType.VNF) diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java index 7266d0311..731d0d269 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Bell Canada. All rights reserved. + * Modifications Copyright (C) 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. @@ -18,18 +19,18 @@ package org.onap.policy.controlloop.actor.cds.request; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.common.collect.ImmutableMap; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; -public class CdsActionRequestTest { +class CdsActionRequestTest { private static final String TEST_ACTION_NAME = "vfw-modify-config"; private CdsActionRequest req = new CdsActionRequest(); @@ -37,8 +38,8 @@ public class CdsActionRequestTest { /** * Setup the CdsActionRequest object. */ - @Before - public void setUp() { + @BeforeEach + void setUp() { req.setActionName(TEST_ACTION_NAME); req.setResolutionKey("1234567890"); @@ -51,7 +52,7 @@ public class CdsActionRequestTest { } @Test - public void testGenerateCdsPayloadWhenPolicyPayloadIsNotValidJsonString() throws CoderException { + void testGenerateCdsPayloadWhenPolicyPayloadIsNotValidJsonString() throws CoderException { String payloadStr = "active-streams=5"; Map<String, String> payloadProps = ImmutableMap.of(CdsActorConstants.KEY_POLICY_PAYLOAD_DATA, payloadStr); req.setPolicyPayload(payloadProps); @@ -67,7 +68,7 @@ public class CdsActionRequestTest { } @Test - public void testGenerateCdsPayloadWhenPolicyPayloadIsValidJsonString() throws CoderException { + void testGenerateCdsPayloadWhenPolicyPayloadIsValidJsonString() throws CoderException { String payloadStr = "{\"active-streams\":\"5\"}"; Map<String, String> payloadProps = ImmutableMap.of(CdsActorConstants.KEY_POLICY_PAYLOAD_DATA, payloadStr); req.setPolicyPayload(payloadProps); @@ -83,7 +84,7 @@ public class CdsActionRequestTest { } @Test - public void testGenerateCdsPayloadWhenPolicyPayloadIsNull() throws CoderException { + void testGenerateCdsPayloadWhenPolicyPayloadIsNull() throws CoderException { Map<String, String> payloadProps = new HashMap<String, String>() { private static final long serialVersionUID = 1L; { |