From c2556dd48738b43e91e27a57df60c3ec347c5ac0 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 29 Sep 2022 15:52:33 -0400 Subject: Update third party versions in ccsdk/apps Upgrade to latest springboot 2.6 release and updated gson version Change-Id: Ie12921daa905424bee3e5423371f951d3156e803 Issue-ID: CCSDK-3771 Signed-off-by: Dan Timoney --- .../gen/NameGeneratorDependencyEarlierTest.java | 12 +++++----- .../core/gen/NameGeneratorDependencyLaterTest.java | 12 +++++----- .../gen/NameGeneratorDependencyOnUnnamedTest.java | 14 ++++++------ .../core/gen/NameGeneratorExcMissingDataTest.java | 12 +++++----- .../neng/core/gen/NameGeneratorNoSequenceTest.java | 8 +++---- .../core/gen/NameGeneratorSeqGenErrorsTest.java | 26 +++++++++++----------- .../core/gen/NameGeneratorSequenceMultiTest.java | 24 ++++++++++---------- .../neng/core/gen/NameGeneratorSequenceTest.java | 12 +++++----- .../neng/core/policy/PolicyParametersImplTest.java | 2 +- .../ms/neng/core/policy/PolicySequenceTest.java | 2 +- .../ms/neng/core/policy/PropertyOperatorTest.java | 2 +- .../apps/ms/neng/core/policy/RecipeParserTest.java | 2 +- .../AaiAuthorizationInterceptorTest.java | 2 +- .../PolicyManagerAuthorizationInterceptorTest.java | 2 +- .../ms/neng/core/seq/SequenceGeneratorTest.java | 2 +- .../ms/neng/core/service/SpringServiceIntTest.java | 12 +++++----- .../ms/neng/core/service/SpringServiceTest.java | 6 ++--- .../neng/core/validator/AaiNameValidatorTest.java | 6 ++--- .../core/validator/ExternalKeyValidatorTest.java | 2 +- .../extinf/impl/PolicyFinderServiceImplTest.java | 16 ++++++------- 20 files changed, 88 insertions(+), 88 deletions(-) (limited to 'ms/neng/src') diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyEarlierTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyEarlierTest.java index 29251794..cdddadad 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyEarlierTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyEarlierTest.java @@ -21,8 +21,8 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder; @@ -103,9 +103,9 @@ public class NameGeneratorDependencyEarlierTest { Map policy = new FilePolicyReader("vnf_and_vm_policy.json").getPolicy(); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), anyInt())).thenReturn(1L); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), anyInt())).thenReturn(1L); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement1, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyLaterTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyLaterTest.java index 0463c6b2..1a863ce9 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyLaterTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyLaterTest.java @@ -21,8 +21,8 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder; @@ -102,9 +102,9 @@ public class NameGeneratorDependencyLaterTest { Map policy = new FilePolicyReader("vnf_and_vm_policy.json").getPolicy(); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), anyInt())).thenReturn(1L); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), anyInt())).thenReturn(1L); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement1, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyOnUnnamedTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyOnUnnamedTest.java index b9b781b7..b1c74412 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyOnUnnamedTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorDependencyOnUnnamedTest.java @@ -21,8 +21,8 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -37,7 +37,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; @@ -94,9 +94,9 @@ public class NameGeneratorDependencyOnUnnamedTest { Map policy = new FilePolicyReader("vnf_and_vm_policy.json").getPolicy(); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), anyInt())).thenReturn(1L); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), anyInt())).thenReturn(1L); final List savedNames = new ArrayList<>(); doAnswer(new Answer() { @@ -105,7 +105,7 @@ public class NameGeneratorDependencyOnUnnamedTest { savedNames.add(invocation.getArguments()[0]); return null; } - }).when(namePresister).persist(anyObject()); + }).when(namePresister).persist(any()); NameGenerator gen2 = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement2, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java index a28d364b..76fb3298 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java @@ -22,8 +22,8 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder; @@ -169,9 +169,9 @@ public class NameGeneratorExcMissingDataTest { Map policy = new FilePolicyReader("bad_policy_missing_recipe.json").getPolicy(); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), anyInt())).thenReturn(1L); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), anyInt())).thenReturn(1L); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorNoSequenceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorNoSequenceTest.java index aa2d96cf..bc3e6c81 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorNoSequenceTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorNoSequenceTest.java @@ -21,7 +21,7 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -33,7 +33,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder; @@ -79,8 +79,8 @@ public class NameGeneratorNoSequenceTest { Map policy = new FilePolicyReader("vnf_policy_no_seq.json").getPolicy(); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSeqGenErrorsTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSeqGenErrorsTest.java index bf8e9b35..d5ba85b2 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSeqGenErrorsTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSeqGenErrorsTest.java @@ -22,7 +22,7 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; @@ -38,7 +38,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; @@ -108,13 +108,13 @@ public class NameGeneratorSeqGenErrorsTest { Mockito.lenient().when(policyParams.getMaxGenAttempt()).thenReturn(100); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(aaiValidator.validate(eq("VNF"), anyObject())).thenReturn(true); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(aaiValidator.validate(eq("VNF"), any())).thenReturn(true); Mockito.lenient().when(aaiValidator.validate(eq("VNF"), eq("abcde001ve1"))).thenReturn(false); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(1))).thenReturn(1L); - Mockito.lenient().when(sequenceGenerator.generate(eq("abcde"), anyObject(), anyObject(), anyObject(), eq(2))).thenReturn(2L); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(1))).thenReturn(1L); + Mockito.lenient().when(sequenceGenerator.generate(eq("abcde"), any(), any(), any(), eq(2))).thenReturn(2L); final List savedNames = new ArrayList<>(); doAnswer(new Answer() { @@ -123,7 +123,7 @@ public class NameGeneratorSeqGenErrorsTest { savedNames.add(invocation.getArguments()[0]); return null; } - }).when(namePresister).persist(anyObject()); + }).when(namePresister).persist(any()); NameGenerator gen2 = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement2, allElements, earlierNames, policyCache, new ArrayList<>()); @@ -180,10 +180,10 @@ public class NameGeneratorSeqGenErrorsTest { Map policy = new FilePolicyReader("vnf_and_vm_policy.json").getPolicy(); Mockito.lenient().when(policyParams.getMaxGenAttempt()).thenReturn(3); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(false); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(1))).thenReturn(1L); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(2))).thenReturn(2L); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(3))).thenReturn(3L); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(false); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(1))).thenReturn(1L); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(2))).thenReturn(2L); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(3))).thenReturn(3L); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement2, allElements, earlierNames, policyCache, new ArrayList<>()); @@ -210,7 +210,7 @@ public class NameGeneratorSeqGenErrorsTest { Map policy = new FilePolicyReader("vnf_policy_no_seq.json").getPolicy(); Mockito.lenient().when(policyParams.getMaxGenAttempt()).thenReturn(3); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(false); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(false); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement2, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceMultiTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceMultiTest.java index 18e85e51..96157372 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceMultiTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceMultiTest.java @@ -21,7 +21,7 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder; @@ -92,16 +92,16 @@ public class NameGeneratorSequenceMultiTest { Map policy = new FilePolicyReader("vnf_policy_seq.json").getPolicy(); Mockito.lenient().when(policyParams.getMaxGenAttempt()).thenReturn(100); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), eq("abcde001ve1"))).thenReturn(false); - Mockito.lenient().when(dbValidator.validate(anyObject(), eq("abcde002ve1"))).thenReturn(false); - Mockito.lenient().when(dbValidator.validate(anyObject(), eq("abcde003ve1"))).thenReturn(false); - Mockito.lenient().when(dbValidator.validate(anyObject(), eq("abcde004ve1"))).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(1))).thenReturn(1L); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(2))).thenReturn(2L); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(3))).thenReturn(3L); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), eq(4))).thenReturn(4L); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), eq("abcde001ve1"))).thenReturn(false); + Mockito.lenient().when(dbValidator.validate(any(), eq("abcde002ve1"))).thenReturn(false); + Mockito.lenient().when(dbValidator.validate(any(), eq("abcde003ve1"))).thenReturn(false); + Mockito.lenient().when(dbValidator.validate(any(), eq("abcde004ve1"))).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(1))).thenReturn(1L); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(2))).thenReturn(2L); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(3))).thenReturn(3L); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), eq(4))).thenReturn(4L); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceTest.java index 0f38d3fa..ce990b73 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorSequenceTest.java @@ -21,8 +21,8 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.policy.FilePolicyReader; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder; @@ -91,9 +91,9 @@ public class NameGeneratorSequenceTest { Map policy = new FilePolicyReader("vnf_policy_seq.json").getPolicy(); Mockito.lenient().when(policyFinder.findPolicy(policyName)).thenReturn(policy); - Mockito.lenient().when(aaiValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(dbValidator.validate(anyObject(), anyObject())).thenReturn(true); - Mockito.lenient().when(sequenceGenerator.generate(anyObject(), anyObject(), anyObject(), anyObject(), anyInt())).thenReturn(1L); + Mockito.lenient().when(aaiValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(dbValidator.validate(any(), any())).thenReturn(true); + Mockito.lenient().when(sequenceGenerator.generate(any(), any(), any(), any(), anyInt())).thenReturn(1L); NameGenerator gen = new NameGenerator(policyFinder, policyParams, sequenceGenerator, dbValidator, aaiValidator, namePresister, requestElement, allElements, earlierNames, policyCache, new ArrayList<>()); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyParametersImplTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyParametersImplTest.java index e31a8868..be029122 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyParametersImplTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyParametersImplTest.java @@ -27,7 +27,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.persistence.entity.IdentifierMap; import org.onap.ccsdk.apps.ms.neng.persistence.entity.ServiceParameter; import org.onap.ccsdk.apps.ms.neng.persistence.repository.IdentifierMapRespository; diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java index 9a0bbbd3..1df6d36b 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PolicySequenceTest { diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperatorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperatorTest.java index 07d8c7af..f4e7824e 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperatorTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperatorTest.java @@ -33,7 +33,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PropertyOperatorTest { diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParserTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParserTest.java index 744d967d..b00641bf 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParserTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParserTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.mock; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class RecipeParserTest { diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/AaiAuthorizationInterceptorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/AaiAuthorizationInterceptorTest.java index 40e507ea..75a3e78e 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/AaiAuthorizationInterceptorTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/AaiAuthorizationInterceptorTest.java @@ -32,7 +32,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigRequest; import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigResponse; import org.onap.ccsdk.apps.ms.neng.extinf.props.AaiProps; diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/PolicyManagerAuthorizationInterceptorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/PolicyManagerAuthorizationInterceptorTest.java index d814c253..3898e7b4 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/PolicyManagerAuthorizationInterceptorTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/rs/interceptors/PolicyManagerAuthorizationInterceptorTest.java @@ -32,7 +32,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigRequest; import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigResponse; import org.onap.ccsdk.apps.ms.neng.extinf.props.PolicyManagerProps; diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java index 9aa4e3b7..51483472 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java @@ -28,7 +28,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicySequence; import org.onap.ccsdk.apps.ms.neng.persistence.entity.ServiceParameter; import org.onap.ccsdk.apps.ms.neng.persistence.repository.GeneratedNameRespository; diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java index 61d68115..7882a221 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java @@ -39,7 +39,7 @@ import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.onap.ccsdk.apps.ms.neng.core.exceptions.NengException; @@ -129,8 +129,8 @@ public class SpringServiceIntTest { public void testGenName_1() throws Exception { ResponseEntity resp = new ResponseEntity( getConfigResponse("JQINSRIOV.Config_MS_SriovBigJson.1.xml"), HttpStatus.OK); - Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(resp); - Mockito.lenient().when(aaiServiceImpl.validate(Matchers.anyString(), Matchers.anyString())).thenReturn(true); + Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenReturn(resp); + Mockito.lenient().when(aaiServiceImpl.validate(ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(true); NameGenRequest request = nameGenRequest_1(); NameGenResponse genresp = springService.genNetworkElementName(request); assertTrue("vnf-name".equals(genresp.getElements().get(0).get("resource-name"))); @@ -180,8 +180,8 @@ public class SpringServiceIntTest { NameGenRequest request = nameGenRequest_1(); ResponseEntity resp = new ResponseEntity( getConfigResponse("JQINSRIOV.Config_MS_SriovBigJson.1.xml"), HttpStatus.OK); - Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(resp); - Mockito.lenient().when(aaiServiceImpl.validate(Matchers.anyString(), Matchers.anyString())).thenReturn(true); + Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenReturn(resp); + Mockito.lenient().when(aaiServiceImpl.validate(ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(true); restServiceImpl.generateNetworkElementName(request); } @@ -262,7 +262,7 @@ public class SpringServiceIntTest { reqMap.put("resource-name", "vnf-name"); reqMap.put("resource-value", "DG001ESP1"); - Mockito.lenient().when(aaiServiceImpl.validate(Matchers.anyString(), Matchers.anyString())).thenReturn(true); + Mockito.lenient().when(aaiServiceImpl.validate(ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(true); List> elList = new ArrayList<>(); elList.add(reqMap); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java index 1e7e3baa..7a177a32 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java @@ -30,10 +30,10 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.exceptions.NengException; import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister; import org.onap.ccsdk.apps.ms.neng.core.resource.model.HelloWorld; @@ -192,7 +192,7 @@ public class SpringServiceTest { List generatedNameList = new ArrayList<>(); generatedNameList.add(gn); Mockito.lenient().when(namePersister.findByExternalIdAndElementType(req.get("external-key"), "VNF")).thenReturn(gn); - Mockito.lenient().when(aaiNameValidator.validate(Matchers.anyString(), Matchers.anyString())).thenReturn(true); + Mockito.lenient().when(aaiNameValidator.validate(ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(true); Assert.assertNotNull(springserviceImpl.updateNetworkElementName(request)); Mockito.verify(namePersister, Mockito.times(1)).persist(gn); } diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/AaiNameValidatorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/AaiNameValidatorTest.java index 628156d6..c180b285 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/AaiNameValidatorTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/AaiNameValidatorTest.java @@ -26,10 +26,10 @@ import static org.mockito.Mockito.when; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.persistence.repository.ExternalInterfaceRespository; import org.onap.ccsdk.apps.ms.neng.service.extinf.impl.AaiServiceImpl; @@ -46,7 +46,7 @@ public class AaiNameValidatorTest { @Test public void testValidate() throws Exception { - Mockito.lenient().when(dbStuff.getUriByNameType(Matchers.anyString())).thenReturn(null); + Mockito.lenient().when(dbStuff.getUriByNameType(ArgumentMatchers.anyString())).thenReturn(null); assertTrue(nameValidator.validate("VNF", "xyz112uyv")); } } diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java index 7c6c95f3..46576bc7 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.persistence.repository.GeneratedNameRespository; @RunWith(MockitoJUnitRunner.class) diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java index e31c0987..8831118e 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java @@ -37,11 +37,11 @@ import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.ccsdk.apps.ms.neng.core.exceptions.NengException; import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigRequest; import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigResponse; @@ -72,14 +72,14 @@ public class PolicyFinderServiceImplTest { @Test public void testConfig() throws Exception { doReturn(new GetConfigResponse()).when(policyFinder).makeOutboundCall( - Matchers.any(), Matchers.any(), Matchers.any()); + ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any()); assertNotNull(policyFinder.getConfig("policy")); } @Test public void testFindPolicy() throws Exception { doReturn(new GetConfigResponse()).when(policyFinder).makeOutboundCall( - Matchers.any(), Matchers.any(), Matchers.any()); + ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any()); assertNull(policyFinder.findPolicy("policy")); } @@ -96,7 +96,7 @@ public class PolicyFinderServiceImplTest { Map configMap = buildPolicyResponse(); Object resp = Arrays.asList(new Object[] {configMap}); ResponseEntity respEn = new ResponseEntity<>(resp, HttpStatus.OK); - Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn); + Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenReturn(respEn); policManProps.setUrl("http://policyManager.onap.org"); @@ -112,7 +112,7 @@ public class PolicyFinderServiceImplTest { Map configMap = buildPolicyResponse(); Object resp = Arrays.asList(new Object[] {configMap}); ResponseEntity respEn = new ResponseEntity<>(resp, HttpStatus.INTERNAL_SERVER_ERROR); - Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn); + Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenReturn(respEn); policManProps.setUrl("http://policyManager.onap.org"); @@ -224,7 +224,7 @@ public class PolicyFinderServiceImplTest { @Test(expected = NengException.class) public void testmakeOutboundCall_500_statusExp() throws Exception { HttpClientErrorException exp = new HttpClientErrorException(HttpStatus.METHOD_NOT_ALLOWED, "{error}"); - Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp); + Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenThrow(exp); policManProps.setUrl("http://policyManager.onap.org"); GetConfigRequest request = new GetConfigRequest(); request.setPolicyName("policy"); @@ -235,7 +235,7 @@ public class PolicyFinderServiceImplTest { @Test(expected = NengException.class) public void testmakeOutboundCall_500_statusExp_notFound() throws Exception { HttpClientErrorException exp = new HttpClientErrorException(HttpStatus.NOT_FOUND, "{error}"); - Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp); + Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenThrow(exp); policManProps.setUrl("http://policyManager.onap.org"); GetConfigRequest request = new GetConfigRequest(); request.setPolicyName("policy"); -- cgit 1.2.3-korg