diff options
author | halil.cakal <halil.cakal@est.tech> | 2023-02-02 12:25:13 +0000 |
---|---|---|
committer | halil.cakal <halil.cakal@est.tech> | 2023-02-02 13:52:13 +0000 |
commit | 40ce8294900aa028c6065796db38a681620cacaf (patch) | |
tree | c85cc0efbf55a1266cb1194de370dd8fbfac41bc /a1-policy-management/src/test | |
parent | 8235ab685e0f2033eab13892530525acb45b85f0 (diff) |
surefire-report summary generation including JUnit DisplayName
Issue-ID: CCSDK-3844
Change-Id: I696b0ff3001eb6170787ebdbd249507cc761c12a
Signed-off-by: halil.cakal <halil.cakal@est.tech>
Diffstat (limited to 'a1-policy-management/src/test')
20 files changed, 162 insertions, 0 deletions
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java index dbfc7d90..f8882440 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java @@ -32,6 +32,7 @@ import ch.qos.logback.core.read.ListAppender; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.reflect.MethodSignature; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -51,6 +52,7 @@ class LogAspectTest { LoggingUtils utils; @Test + @DisplayName("test Executetime Time should Log Time") void testExecutetimeTime_shouldLogTime() throws Throwable { when(proceedingJoinPoint.getSignature()).thenReturn(methodSignature); when(methodSignature.getDeclaringType()).thenReturn(this.getClass()); @@ -67,6 +69,7 @@ class LogAspectTest { } @Test + @DisplayName("test Entry Log should Log Entry") void testEntryLog_shouldLogEntry() throws Throwable { when(proceedingJoinPoint.getSignature()).thenReturn(methodSignature); String signature = "signature"; @@ -80,6 +83,7 @@ class LogAspectTest { } @Test + @DisplayName("test Exit Log should Log Exit") void testExitLog_shouldLogExit() throws Throwable { when(proceedingJoinPoint.getSignature()).thenReturn(methodSignature); String signature = "signature"; diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java index 424668fc..a715191b 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java @@ -29,6 +29,7 @@ import static org.mockito.Mockito.when; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -87,6 +88,7 @@ class A1ClientFactoryTest { } @Test + @DisplayName("test get Protocol Version ok") void getProtocolVersion_ok() throws ServiceException { whenGetProtocolVersionThrowException(clientMock1); whenGetProtocolVersionReturn(clientMock2, A1ProtocolType.STD_V1_1); @@ -99,6 +101,7 @@ class A1ClientFactoryTest { } @Test + @DisplayName("test get Protocol Version ok Last") void getProtocolVersion_ok_Last() throws ServiceException { whenGetProtocolVersionThrowException(clientMock1, clientMock2, clientMock3); whenGetProtocolVersionReturn(clientMock4, A1ProtocolType.STD_V1_1); @@ -118,6 +121,7 @@ class A1ClientFactoryTest { } @Test + @DisplayName("test Custom Adapter Creation") void testCustomAdapterCreation() { Ric ric = new Ric(ricConfig("", CustomA1AdapterFactory.class.getName())); @@ -143,6 +147,7 @@ class A1ClientFactoryTest { } @Test + @DisplayName("test get Protocol Version error") void getProtocolVersion_error() throws ServiceException { whenGetProtocolVersionThrowException(clientMock1, clientMock2, clientMock3, clientMock4); doReturn(clientMock1, clientMock2, clientMock3, clientMock4).when(factoryUnderTest).createClient(any(), any()); @@ -160,12 +165,14 @@ class A1ClientFactoryTest { } @Test + @DisplayName("tes create check types") void create_check_types() throws ServiceException { assertTrue(createClient(A1ProtocolType.STD_V1_1) instanceof StdA1ClientVersion1); assertTrue(createClient(A1ProtocolType.OSC_V1) instanceof OscA1Client); } @Test + @DisplayName("test create check types controllers") void create_check_types_controllers() throws ServiceException { this.ric = new Ric(ricConfig("anythingButEmpty")); whenGetGetControllerConfigReturn(); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java index 69a74b67..96769427 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java @@ -30,6 +30,7 @@ import okhttp3.mockwebserver.MockWebServer; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -68,6 +69,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Get No Error") void testGetNoError() { mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) // .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) // @@ -78,6 +80,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Get Error") void testGetError() { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); @@ -87,6 +90,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Put No Error") void testPutNoError() { mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) // .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) // @@ -97,6 +101,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Put Error") void testPutError() { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); @@ -106,6 +111,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Delete No Error") void testDeleteNoError() { mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE)); @@ -114,6 +120,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Delete Error") void testDeleteError() { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); @@ -123,6 +130,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Post No Error") void testPostNoError() { mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) // .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) // @@ -133,6 +141,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Post Error") void testPostError() { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); @@ -142,6 +151,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Post With Auth Header No Error") void testPostWithAuthHeaderNoError() { mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) // .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) // @@ -152,6 +162,7 @@ class AsyncRestClientTest { } @Test + @DisplayName("test Post With Auth Header Error") void testPostWithAuthHeaderError() { mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE)); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java index 15e4983c..b2fc84a6 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java @@ -36,6 +36,7 @@ import java.nio.file.Files; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -80,6 +81,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test create Client With Wrong Protocol then Error Is Thrown") void createClientWithWrongProtocol_thenErrorIsThrown() { AsyncRestClient asyncRestClient = new AsyncRestClient("", null, null, new SecurityContext("")); assertThrows(IllegalArgumentException.class, () -> { @@ -88,6 +90,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test get Policy Type Identities STD V1") void getPolicyTypeIdentities_STD_V1() { clientUnderTest = new CcsdkA1AdapterClient(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1, // A1ClientHelper.createRic(RIC_1_URL).getConfig(), // @@ -118,16 +121,19 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test get Policy Type Identities OSC") void getPolicyTypeIdentities_OSC() { testGetPolicyTypeIdentities(A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1, RIC_1_URL + "/a1-p/policytypes"); } @Test + @DisplayName("test get Policy Type Identities STD V2") void getPolicyTypeIdentities_STD_V2() { testGetPolicyTypeIdentities(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0, RIC_1_URL + "/A1-P/v2/policytypes"); } @Test + @DisplayName("test get Type Schema STD V1") void getTypeSchema_STD_V1() { clientUnderTest = new CcsdkA1AdapterClient(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1, // @@ -165,6 +171,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test get Type Schema OSC") void getTypeSchema_OSC() throws IOException { String expUrl = RIC_1_URL + "/a1-p/policytypes/policyTypeId"; testGetTypeSchema(A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1, expUrl, "policyTypeId", @@ -172,6 +179,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test get Type Schema STD V2") void getTypeSchema_STD_V2() throws IOException { String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/policyTypeId"; testGetTypeSchema(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0, expUrl, "policyTypeId", @@ -179,6 +187,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test parse Json Array Of String") void parseJsonArrayOfString() { // One integer and one string String inputString = "[1, \"1\" ]"; @@ -209,12 +218,14 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test get Policy Identities STD V1") void getPolicyIdentities_STD_V1() { String expUrl = RIC_1_URL + "/A1-P/v1/policies"; getPolicyIdentities(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1, expUrl); } @Test + @DisplayName("test get Policy Identities STD V2") void getPolicyIdentities_STD_V2() { String expUrlPolicies = RIC_1_URL + "/A1-P/v2/policytypes"; String expUrlInstances = RIC_1_URL + "/A1-P/v2/policytypes/xxx/policies"; @@ -222,6 +233,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test get Policy Identities OSC") void getPolicyIdentities_OSC() { String expUrlTypes = RIC_1_URL + "/a1-p/policytypes"; String expUrlInstances = RIC_1_URL + "/a1-p/policytypes/xxx/policies"; @@ -248,18 +260,21 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test put Policy OSC") void putPolicy_OSC() { String expUrl = RIC_1_URL + "/a1-p/policytypes/type1/policies/policy1"; putPolicy(A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1, expUrl); } @Test + @DisplayName("test put Policy STD V1") void putPolicy_STD_V1() { String expUrl = RIC_1_URL + "/A1-P/v1/policies/policy1"; putPolicy(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1, expUrl); } @Test + @DisplayName("test put Policy STD V2") void putPolicy_STD_V2() { String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/type1/policies/policy1?notificationDestination=https://test.com"; @@ -267,6 +282,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test post Rejected") void postRejected() { clientUnderTest = new CcsdkA1AdapterClient(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1, // A1ClientHelper.createRic(RIC_1_URL).getConfig(), // @@ -307,24 +323,28 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test delete All Policies STD V2") void deleteAllPolicies_STD_V2() { String expUrl1 = RIC_1_URL + "/A1-P/v2/policytypes/xxx/policies/xxx"; deleteAllPolicies(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0, expUrl1); } @Test + @DisplayName("test delete All Policies STD V1") void deleteAllPolicies_STD_V1() { String expUrl1 = RIC_1_URL + "/A1-P/v1/policies/xxx"; deleteAllPolicies(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1, expUrl1); } @Test + @DisplayName("test delete All Policies OSC") void deleteAllPolicies_OSC() { String expUrl1 = RIC_1_URL + "/a1-p/policytypes/xxx/policies/xxx"; deleteAllPolicies(A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1, expUrl1); } @Test + @DisplayName("test get Version OSC") void getVersion_OSC() { clientUnderTest = new CcsdkA1AdapterClient(A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1, // Version irrelevant here A1ClientHelper.createRic(RIC_1_URL).getConfig(), // @@ -338,6 +358,7 @@ class CcsdkA1AdapterClientTest { } @Test + @DisplayName("test Get Status") void testGetStatus() { clientUnderTest = new CcsdkA1AdapterClient(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0, // A1ClientHelper.createRic(RIC_1_URL).getConfig(), // diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java index 2ff07f15..731c83a4 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java @@ -31,6 +31,7 @@ import java.util.List; import org.json.JSONException; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -73,6 +74,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Get Policy Type Identities") void testGetPolicyTypeIdentities() { List<String> policyTypeIds = Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID); Mono<String> policyTypeIdsResp = Mono.just(policyTypeIds.toString()); @@ -84,6 +86,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Get Policy Identities") void testGetPolicyIdentities() { Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString()); Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString()); @@ -100,6 +103,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Get Valid PolicyType") void testGetValidPolicyType() { String policyType = "{\"create_schema\": " + POLICY_TYPE_SCHEMA_VALID + "}"; Mono<String> policyTypeResp = Mono.just(policyType); @@ -113,6 +117,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Get In Valid Policy Type Json") void testGetInValidPolicyTypeJson() { String policyType = "{\"create_schema\": " + POLICY_TYPE_SCHEMA_INVALID + "}"; Mono<String> policyTypeResp = Mono.just(policyType); @@ -125,6 +130,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Get Policy Type Without CreateS chema") void testGetPolicyTypeWithoutCreateSchema() { Mono<String> policyTypeResp = Mono.just(POLICY_TYPE_SCHEMA_VALID); @@ -136,6 +142,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Put Policy") void testPutPolicy() { when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.empty()); @@ -147,6 +154,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Delete Policy") void testDeletePolicy() { when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty()); @@ -157,6 +165,7 @@ class OscA1ClientTest { } @Test + @DisplayName("test Delete All Policies") void testDeleteAllPolicies() { Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString()); Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString()); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java index db4c79cd..1e83511e 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java @@ -30,6 +30,7 @@ import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -72,6 +73,7 @@ class StdA1ClientTest { } @Test + @DisplayName("test Get Policy Type Identities") void testGetPolicyTypeIdentities() { List<String> policyTypeIds = clientUnderTest.getPolicyTypeIdentities().block(); assertEquals(1, policyTypeIds.size(), "should hardcoded to one"); @@ -79,6 +81,7 @@ class StdA1ClientTest { } @Test + @DisplayName("test Get Policy Identities") void testGetPolicyIdentities() { doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString()); @@ -91,12 +94,14 @@ class StdA1ClientTest { } @Test + @DisplayName("test Get Valid Policy Type") void testGetValidPolicyType() { String policyType = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_NAME).block(); assertEquals("{}", policyType, ""); } @Test + @DisplayName("test Put Policy Valid Response") void testPutPolicyValidResponse() { doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.just(POLICY_JSON)); @@ -109,6 +114,7 @@ class StdA1ClientTest { } @Test + @DisplayName("test Delete Policy") void testDeletePolicy() { doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); final String url = policiesBaseUrl() + POLICY_1_ID; @@ -121,6 +127,7 @@ class StdA1ClientTest { } @Test + @DisplayName("test Delete All Policies") void testDeleteAllPolicies() { doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString()); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java index 95c20426..0af8a17c 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java @@ -33,6 +33,7 @@ import java.util.List; import org.json.JSONException; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; @@ -76,6 +77,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Get Policy Type Identities") void testGetPolicyTypeIdentities() { List<String> policyTypeIds = Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID); Mono<String> policyTypeIdsResp = Mono.just(policyTypeIds.toString()); @@ -87,6 +89,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Get Policy Identities") void testGetPolicyIdentities() { Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString()); Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString()); @@ -103,6 +106,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Get Valid Policy Type") void testGetValidPolicyType() { String policyType = "{\"policySchema\": " + POLICY_TYPE_SCHEMA_VALID + "}"; Mono<String> policyTypeResp = Mono.just(policyType); @@ -115,6 +119,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Get In Valid PolicyType Json") void testGetInValidPolicyTypeJson() { String policyType = "{\"policySchema\": " + POLICY_TYPE_SCHEMA_INVALID + "}"; Mono<String> policyTypeResp = Mono.just(policyType); @@ -127,6 +132,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Get Policy Type Without Create Schema") void testGetPolicyTypeWithoutCreateSchema() { Mono<String> policyTypeResp = Mono.just(POLICY_TYPE_SCHEMA_VALID); @@ -138,6 +144,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Put Policy") void testPutPolicy() { when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.empty()); @@ -152,6 +159,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Delete Policy") void testDeletePolicy() { when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty()); @@ -162,6 +170,7 @@ class StdA1ClientV2Test { } @Test + @DisplayName("test Delete All Policies") void testDeleteAllPolicies() { Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString()); Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString()); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java index 8e3e3a5d..61543c0b 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java @@ -42,6 +42,7 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.Map; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; @@ -51,6 +52,7 @@ class ApplicationConfigParserTest { ApplicationConfigParser parserUnderTest = new ApplicationConfigParser(applicationConfigMock); @Test + @DisplayName("test when Correct Config") void whenCorrectConfig() throws Exception { JsonObject jsonRootObject = getJsonRootObject(); @@ -95,6 +97,7 @@ class ApplicationConfigParserTest { } @Test + @DisplayName("test when Dmaap Config Has Several Streams Publishing") void whenDmaapConfigHasSeveralStreamsPublishing() throws Exception { JsonObject jsonRootObject = getJsonRootObject(); JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_publishes"); @@ -123,6 +126,7 @@ class ApplicationConfigParserTest { } @Test + @DisplayName("test when Dmaap Config Has Several Streams Subscribing") void whenDmaapConfigHasSeveralStreamsSubscribing() throws Exception { JsonObject jsonRootObject = getJsonRootObject(); JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_subscribes"); @@ -151,6 +155,7 @@ class ApplicationConfigParserTest { } @Test + @DisplayName("test when Wrong Member Name In Object") void whenWrongMemberNameInObject() throws Exception { JsonObject jsonRootObject = getJsonRootObject(); JsonObject json = jsonRootObject.getAsJsonObject("config"); @@ -163,6 +168,7 @@ class ApplicationConfigParserTest { } @Test + @DisplayName("test schema Validation Error") void schemaValidationError() throws Exception { when(applicationConfigMock.getConfigurationFileSchemaPath()) .thenReturn("application_configuration_schema.json"); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java index abf91f20..39a8aa89 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -61,6 +62,7 @@ class ApplicationConfigTest { } @Test + @DisplayName("test add Rics") void addRics() throws Exception { ApplicationConfig appConfigUnderTest = new ApplicationConfig(); @@ -84,6 +86,7 @@ class ApplicationConfigTest { } @Test + @DisplayName("test changed Ric") void changedRic() throws Exception { ApplicationConfig appConfigUnderTest = new ApplicationConfig(); @@ -106,6 +109,7 @@ class ApplicationConfigTest { } @Test + @DisplayName("test removed Ric") void removedRic() { ApplicationConfig appConfigUnderTest = new ApplicationConfig(); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java index 27a72489..7875cfb5 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java @@ -37,6 +37,7 @@ import java.io.IOException; import java.nio.file.Files; import java.util.Optional; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; @@ -53,6 +54,7 @@ class ConfigurationFileTest { public File temporaryFolder; @Test + @DisplayName("test write File With Error should Throw Exception") void writeFileWithError_shouldThrowException() throws Exception { File tempJsonFile = new File(temporaryFolder, "config.json"); String filePath = tempJsonFile.getAbsolutePath(); @@ -70,6 +72,7 @@ class ConfigurationFileTest { } @Test + @DisplayName("test write And Read File should Be Ok") void writeAndReadFile_shouldBeOk() throws Exception { File tempJsonFile = new File(temporaryFolder, "config.json"); String filePath = tempJsonFile.getAbsolutePath(); @@ -88,6 +91,7 @@ class ConfigurationFileTest { } @Test + @DisplayName("test read When File Missing should Return Empty") void readWhenFileMissing_shouldReturnEmpty() { ConfigurationFile configFileUnderTest = new ConfigurationFile(applicationConfigMock); @@ -100,6 +104,7 @@ class ConfigurationFileTest { } @Test + @DisplayName("test read When File With Io Error should Return Empty And Log Error") void readWhenFileWithIoError_shouldReturnEmptyAndLogError() throws Exception { File tempJsonFile = new File(temporaryFolder, "config.json"); String filePath = tempJsonFile.getAbsolutePath(); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/MetersTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/MetersTest.java index 5ab3d5a3..459eb801 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/MetersTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/MetersTest.java @@ -30,6 +30,7 @@ import java.util.Arrays; import java.util.Vector; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -80,6 +81,7 @@ public class MetersTest { } @Test + @DisplayName("test Counters when Neither Changed Policies Nor Policy Types") void testCounters_whenNeitherChangedPoliciesNorPolicyTypes() { RIC_1.setState(Ric.RicState.AVAILABLE); RIC_1.addSupportedPolicyType(POLICY_TYPE_1); @@ -97,6 +99,7 @@ public class MetersTest { } @Test + @DisplayName("test Counters when Changed Policies And No Changed Policy Types") void testCounters_whenChangedPoliciesAndNoChangedPolicyTypes() { RIC_1.setState(Ric.RicState.AVAILABLE); RIC_1.addSupportedPolicyType(POLICY_TYPE_1); @@ -126,6 +129,7 @@ public class MetersTest { } @Test + @DisplayName("test Counters when No Changed Policies And Changed Policy Types") void testCounters_whenNoChangedPoliciesAndChangedPolicyTypes() { RIC_1.setState(Ric.RicState.AVAILABLE); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java index ec65e4c1..52a850bc 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java @@ -46,6 +46,7 @@ import java.util.List; import org.json.JSONObject; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; @@ -206,6 +207,7 @@ class ApplicationTest { @Test @SuppressWarnings("squid:S2925") // "Thread.sleep" should not be used in tests. + @DisplayName("test ZZ Actuator") void testZZActuator() throws Exception { // The test must be run last, hence the "ZZ" in the name. All succeeding tests // will fail. @@ -232,6 +234,7 @@ class ApplicationTest { } @Test + @DisplayName("test generate Api Doc") void generateApiDoc() throws Exception { String url = "https://localhost:" + this.port + "/v3/api-docs"; ResponseEntity<String> resp = restClient("", false).getForEntity(url).block(); @@ -248,6 +251,7 @@ class ApplicationTest { } @Test + @DisplayName("test Persistency Policies") void testPersistencyPolicies() throws Exception { Ric ric = this.addRic("ric1"); PolicyType type = this.addPolicyType("type1", ric.id()); @@ -273,6 +277,7 @@ class ApplicationTest { } @Test + @DisplayName("test Persistency Policy Types") void testPersistencyPolicyTypes() throws Exception { Ric ric = this.addRic("ric1"); this.addPolicyType("type1", ric.id()); @@ -291,6 +296,7 @@ class ApplicationTest { } @Test + @DisplayName("test Persistency Service") void testPersistencyService() throws Exception { final String SERVICE = "serviceName"; putService(SERVICE, 1234, HttpStatus.CREATED); @@ -312,6 +318,7 @@ class ApplicationTest { } @Test + @DisplayName("test Adding Ric From Configuration") void testAddingRicFromConfiguration() throws Exception { // Test adding the RIC from configuration @@ -342,6 +349,7 @@ class ApplicationTest { } @Test + @DisplayName("test Adding Ric From Configuration non Responding Ric") void testAddingRicFromConfiguration_nonRespondingRic() throws Exception { putService("service"); @@ -368,6 +376,7 @@ class ApplicationTest { } @Test + @DisplayName("test Trust Validation") void testTrustValidation() { addRic("ric1"); @@ -377,6 +386,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Rics") void testGetRics() throws Exception { addRic("ric1"); this.addPolicyType("type1", "ric1"); @@ -404,6 +414,7 @@ class ApplicationTest { } @Test + @DisplayName("test Synchronization") void testSynchronization() throws Exception { // Two polictypes will be put in the NearRT RICs PolicyTypes nearRtRicPolicyTypes = new PolicyTypes(this.applicationConfig); @@ -441,6 +452,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Ric") void testGetRic() throws Exception { String ricId = "ric1"; String managedElementId = "kista_1"; @@ -485,6 +497,7 @@ class ApplicationTest { } @Test + @DisplayName("test Put Policy") void testPutPolicy() throws Exception { String serviceName = "service.1"; String ricId = "ric.1"; @@ -538,6 +551,7 @@ class ApplicationTest { } @Test + @DisplayName("test Put Policy No Service No Status Uri") void testPutPolicy_NoServiceNoStatusUri() throws Exception { String ricId = "ric.1"; String policyTypeName = "type1_1.2.3"; @@ -565,6 +579,7 @@ class ApplicationTest { * * @throws ServiceException */ + @DisplayName("test Error From Ric") void testErrorFromRic() throws ServiceException { putService("service1"); addPolicyType("type1", "ric1"); @@ -591,6 +606,7 @@ class ApplicationTest { } @Test + @DisplayName("test Put Typeless Policy") void testPutTypelessPolicy() throws Exception { putService("service1"); addPolicyType("", "ric1"); @@ -606,6 +622,7 @@ class ApplicationTest { } @Test + @DisplayName("test Update Service") void testUpdateService() throws Exception { this.addRic("ric1"); this.addPolicy("p", "type1", "", "ric1"); @@ -625,6 +642,7 @@ class ApplicationTest { } @Test + @DisplayName("test Refuse To Update Policy") void testRefuseToUpdatePolicy() throws Exception { // Test that only the json can be changed for a already created policy // In this case service is attempted to be changed @@ -639,6 +657,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy") void testGetPolicy() throws Exception { String url = "/policies/id"; Policy policy = addPolicy("id", "typeName", "service1", "ric1"); @@ -655,6 +674,7 @@ class ApplicationTest { } @Test + @DisplayName("test Delete Policy") void testDeletePolicy() throws Exception { String policyId = "id.1"; addPolicy(policyId, "typeName", "service1", "ric1"); @@ -671,6 +691,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy Type") void testGetPolicyType() throws Exception { String typeId = "AC.D"; addPolicyType(typeId, "ric1"); @@ -697,6 +718,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy Types") void testGetPolicyTypes() throws Exception { String TYPE_ID_1 = "A_type1_1.9.0"; String TYPE_ID_2 = "A_type1_2.0.0"; @@ -745,6 +767,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy Instances") void testGetPolicyInstances() throws Exception { addPolicy("id1", "type1", "service1"); @@ -761,6 +784,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy Instances Filter") void testGetPolicyInstancesFilter() throws Exception { addPolicy("id1", "type1", "service1"); addPolicy("id2", "type1", "service2"); @@ -798,6 +822,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy Ids Filter") void testGetPolicyIdsFilter() throws Exception { addPolicy("id1", "type1", "service1", "ric1"); addPolicy("id2", "type1", "service2", "ric1"); @@ -833,6 +858,7 @@ class ApplicationTest { } @Test + @DisplayName("test Put And Get Service") void testPutAndGetService() throws Exception { // PUT String serviceName = "ac.dc"; @@ -881,6 +907,7 @@ class ApplicationTest { } @Test + @DisplayName("test Service Supervision") void testServiceSupervision() throws Exception { putService("service1", 1, HttpStatus.CREATED); addPolicyType("type1", "ric1"); @@ -897,6 +924,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Policy Status") void testGetPolicyStatus() throws Exception { addPolicy("id", "typeName", "service1", "ric1"); assertThat(policies.size()).isEqualTo(1); @@ -921,6 +949,7 @@ class ApplicationTest { } @Test + @DisplayName("test Get Service Status") void testGetServiceStatus() throws Exception { String url = "/status"; String rsp = restClient().get(url).block(); @@ -931,6 +960,7 @@ class ApplicationTest { } @Test + @DisplayName("test Service Notification") void testServiceNotification() throws Exception { final String AUTH_TOKEN = "testToken"; @@ -1010,6 +1040,7 @@ class ApplicationTest { } @Test + @DisplayName("test Concurrency") void testConcurrency() throws Exception { logger.info("Concurrency test starting"); final Instant startTime = Instant.now(); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java index 51a68389..3c5b1d9e 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java @@ -29,6 +29,7 @@ import java.time.Duration; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient; @@ -111,6 +112,7 @@ class ConfigurationControllerTest { private int port; @Test + @DisplayName("put Valid Configuration With New Ric should Update Repository") void putValidConfigurationWithNewRic_shouldUpdateRepository() throws Exception { String url = "a1-policy/v2/configuration"; @@ -125,6 +127,7 @@ class ConfigurationControllerTest { } @Test + @DisplayName("get No File Exists") void getNoFileExists() { String url = "a1-policy/v2/configuration"; testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "File does not exist"); @@ -137,6 +140,7 @@ class ConfigurationControllerTest { } @Test + @DisplayName("put Invalid Configuration should Return Error 400") void putInvalidConfiguration_shouldReturnError400() throws Exception { String url = "a1-policy/v2/configuration"; diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java index 08491207..7abc5db8 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java @@ -38,6 +38,7 @@ import java.util.ArrayList; import org.junit.Assert; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -84,6 +85,7 @@ class DmaapMessageConsumerTest { } @Test + @DisplayName("successful Case dmaap Not Configured then Sleep And Retry Until Config") void successfulCase_dmaapNotConfigured_thenSleepAndRetryUntilConfig() throws Exception { messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext(""))); @@ -104,6 +106,7 @@ class DmaapMessageConsumerTest { } @Test + @DisplayName("return Error From Dmapp then Sleep And Retry") void returnErrorFromDmapp_thenSleepAndRetry() throws Exception { messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext(""))); @@ -129,6 +132,7 @@ class DmaapMessageConsumerTest { } @Test + @DisplayName("unParsable Message then Send Response And Continue") void unParsableMessage_thenSendResponseAndContinue() throws Exception { messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext(""))); setTaskNumberOfLoops(2); @@ -157,6 +161,7 @@ class DmaapMessageConsumerTest { } @Test + @DisplayName("test Message Parsing") void testMessageParsing() throws ServiceException { messageConsumerUnderTest = new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")); String json = gson.toJson(dmaapRequestMessage()); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java index 285f3c4a..2ec3664c 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java @@ -40,6 +40,7 @@ import java.io.IOException; import java.nio.charset.Charset; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient; @@ -100,6 +101,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test successful Delete") void successfulDelete() throws IOException { doReturn(okResponse()).when(pmsClient).deleteForEntity(anyString()); doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString()); @@ -121,6 +123,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test successful Get") void successfulGet() throws IOException { doReturn(okResponse()).when(pmsClient).getForEntity(anyString()); doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString()); @@ -140,6 +143,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test exception From Pms When Get then Post Error") void exceptionFromPmsWhenGet_thenPostError() throws IOException { String errorBody = "Unavailable"; WebClientResponseException webClientResponseException = new WebClientResponseException( @@ -161,6 +165,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test successful Put") void successfulPut() throws IOException { doReturn(okResponse()).when(pmsClient).putForEntity(anyString(), anyString()); doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString()); @@ -180,6 +185,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test successful Post") void successfulPost() throws IOException { doReturn(okResponse()).when(pmsClient).postForEntity(anyString(), anyString()); doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString()); @@ -199,6 +205,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test exception When Calling Pms then Error Response") void exceptionWhenCallingPms_thenErrorResponse() throws IOException { doReturn(notOkResponse()).when(pmsClient).putForEntity(anyString(), anyString()); @@ -220,6 +227,7 @@ class DmaapMessageHandlerTest { } @Test + @DisplayName("test put Without Payload then Not Found Response With Warning") void putWithoutPayload_thenNotFoundResponseWithWarning() throws Exception { DmaapRequestMessage message = DmaapRequestMessage.builder() // .apiVersion("apiVersion") // diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/LockTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/LockTest.java index 3ea0fe53..e4d78599 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/LockTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/LockTest.java @@ -26,6 +26,7 @@ import static org.awaitility.Awaitility.await; import java.io.IOException; import java.lang.invoke.MethodHandles; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -64,6 +65,7 @@ class LockTest { } @Test + @DisplayName("test Lock") void testLock() throws IOException, ServiceException { Lock lock = new Lock("l1"); Lock.Grant grant = lock.lockBlocking(LockType.SHARED, "test"); @@ -80,6 +82,7 @@ class LockTest { } @Test + @DisplayName("test Reactive Lock") void testReactiveLock() { Lock lock = new Lock("l1"); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java index 45f2bcbc..a2d20ac2 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java @@ -42,6 +42,7 @@ import java.util.Optional; import java.util.Properties; import java.util.Vector; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -99,6 +100,7 @@ class RefreshConfigTaskTest { } @Test + @DisplayName("test when The Configuration Fits then Configured Rics Are Put In Repository") void whenTheConfigurationFits_thenConfiguredRicsArePutInRepository() throws Exception { refreshTaskUnderTest = this.createTestObject(true); refreshTaskUnderTest.systemEnvironment = new Properties(); @@ -125,6 +127,7 @@ class RefreshConfigTaskTest { } @Test + @DisplayName("test when File Exists But Json Is Incorrect then No Rics Are Put In Repository") void whenFileExistsButJsonIsIncorrect_thenNoRicsArePutInRepository() throws Exception { refreshTaskUnderTest = this.createTestObject(true); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java index b2bf58e4..7b5e9768 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java @@ -37,6 +37,7 @@ import java.util.Vector; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -130,6 +131,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And No Changed Policies Or PolicyTypes then No Synchronization") void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.AVAILABLE); @@ -153,6 +155,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Undefined then Synchronization") void whenRicUndefined_thenSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.UNAVAILABLE); @@ -167,6 +170,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Synchronizing then No Synchronization") void whenRicSynchronizing_thenNoSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.SYNCHRONIZING); @@ -182,6 +186,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And Error Getting Policy Identities then No Synchronization") void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.AVAILABLE); @@ -200,6 +205,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And Not Same Amount Of Policies then Synchronization") void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.AVAILABLE); @@ -223,6 +229,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And Same Amount Of Policies But Not Same Policies then Synchronization") void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.AVAILABLE); @@ -246,6 +253,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And Error Getting Policy Types then No Synchronization") void whenRicIdleAndErrorGettingPolicyTypes_thenNoSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.AVAILABLE); @@ -265,6 +273,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And Not Same Amount Of PolicyTypes then Synchronization") void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); RIC_1.setState(RicState.AVAILABLE); @@ -289,6 +298,7 @@ class RicSupervisionTest { } @Test + @DisplayName("test when Ric Idle And Same Amount Of Policy Types But Not Same Types then Synchronization") void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() { doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class)); PolicyType policyType2 = PolicyType.builder() // diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java index b17cc98b..1f933cde 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java @@ -36,6 +36,7 @@ import java.util.Arrays; import java.util.Collections; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -131,6 +132,7 @@ class RicSynchronizationTaskTest { }; @Test + @DisplayName("test ric Idle And Error Deleting Policies then Synchronization With Failed Recovery") void ricIdleAndErrorDeletingPoliciesAllTheTime_thenSynchronizationWithFailedRecovery() { setUpCreationOfA1Client(); simulateRicWithNoPolicyTypes(); @@ -145,6 +147,7 @@ class RicSynchronizationTaskTest { } @Test + @DisplayName("test Connection Error") void testConnectionError() { setUpCreationOfA1Client(); simulateRicWithNoPolicyTypes(); @@ -158,6 +161,7 @@ class RicSynchronizationTaskTest { } @Test + @DisplayName("test ric Idle then Synchronization With Reuse Of Type From Repo And Correct Service Notified") void ricIdlePolicyTypeInRepo_thenSynchronizationWithReuseOfTypeFromRepoAndCorrectServiceNotified() { rics.put(ric1); ric1.setState(RicState.AVAILABLE); @@ -184,6 +188,7 @@ class RicSynchronizationTaskTest { } @Test + @DisplayName("test ric Idle then Synchronization With Type From Ric") void ricIdlePolicyTypeNotInRepo_thenSynchronizationWithTypeFromRic() throws Exception { ric1.setState(RicState.AVAILABLE); rics.put(ric1); @@ -207,6 +212,7 @@ class RicSynchronizationTaskTest { } @Test + @DisplayName("test ric Idle then Synchronization With Recreation Of Policies") void ricIdleAndHavePolicies_thenSynchronizationWithRecreationOfPolicies() { ric1.setState(RicState.AVAILABLE); rics.put(ric1); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java index c8c7c723..e8f28195 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java @@ -36,6 +36,7 @@ import java.time.Duration; import java.time.Instant; import org.awaitility.Durations; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -89,6 +90,7 @@ class ServiceSupervisionTest { .build(); @Test + @DisplayName("test service Expired policy And Service Are Deleted In Repo And Policy Is Deleted In Ric") void serviceExpired_policyAndServiceAreDeletedInRepoAndPolicyIsDeletedInRic() { setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2)); @@ -110,6 +112,7 @@ class ServiceSupervisionTest { } @Test + @DisplayName("test service Expired But Delete In Ric Fails policy And Service Are Deleted In Repo And Error Logged For Ric") void serviceExpiredButDeleteInRicFails_policyAndServiceAreDeletedInRepoAndErrorLoggedForRic() { setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2)); @@ -137,6 +140,7 @@ class ServiceSupervisionTest { } @Test + @DisplayName("test service Not Expired should Not Be Checked") void serviceNotExpired_shouldNotBeChecked() { setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2)); @@ -153,6 +157,7 @@ class ServiceSupervisionTest { } @Test + @DisplayName("test service Without Keep Alive Interval should Not Be Checked") void serviceWithoutKeepAliveInterval_shouldNotBeChecked() { setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(0)); |