diff options
author | raviteja.karumuri <raviteja.karumuri@est.tech> | 2024-08-02 16:24:44 +0100 |
---|---|---|
committer | raviteja.karumuri <raviteja.karumuri@est.tech> | 2024-08-02 17:56:55 +0100 |
commit | 4a799420ad89fed0c7f09225de51d088ca57c9c3 (patch) | |
tree | 8fae998730d9861bfc82b0ecce9e413f570e15ea /a1-policy-management/src/test | |
parent | 56eef33f4a69febe5fcae15310895df3ab9ddf6f (diff) |
Improve tests/issues found in Sonar report - A1 Oslo
Issue-ID: CCSDK-4037
Change-Id: Ic8e13141f2e0dcb32c51134f96ce883bc05701ee
Signed-off-by: Raviteja Karumuri <raviteja.karumuri@est.tech>
Diffstat (limited to 'a1-policy-management/src/test')
-rw-r--r-- | a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3Test.java (renamed from a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerTestV3.java) | 3 | ||||
-rw-r--r-- | a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java (renamed from a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerTestV3.java) | 10 | ||||
-rw-r--r-- | a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3Test.java (renamed from a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerTestV3.java) | 9 | ||||
-rw-r--r-- | a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3Test.java (renamed from a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerTestV3.java) | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerTestV3.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3Test.java index c634ecc5..40990f62 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerTestV3.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3Test.java @@ -45,7 +45,6 @@ import java.util.Objects; import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.equalTo; -@TestMethodOrder(MethodOrderer.MethodName.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = { // "server.ssl.key-store=./config/keystore.jks", // @@ -53,7 +52,7 @@ import static org.hamcrest.CoreMatchers.equalTo; "app.vardata-directory=./target", // "app.config-file-schema-path=/application_configuration_schema.json" // }) -class ConfigurationControllerTestV3 { +class ConfigurationControllerV3Test { @Autowired ApplicationContext context; diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerTestV3.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java index a8c5fbae..e81a936d 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerTestV3.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java @@ -65,7 +65,7 @@ import static org.mockito.Mockito.when; "app.filepath=", // "app.s3.bucket=" // If this is set, S3 will be used to store data. }) -public class PolicyControllerTestV3 { +class PolicyControllerV3Test { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @Autowired @@ -146,7 +146,7 @@ public class PolicyControllerTestV3 { Mono<ResponseEntity<String>> responseMono = testHelper.restClientV3().postForEntity(url, policyBody); testHelper.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody -> responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}")); - testHelper.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1policymanagement/v1/policies/")); + testHelper.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/")); } @Test @@ -158,11 +158,11 @@ public class PolicyControllerTestV3 { testHelper.addPolicyType(policyTypeName, nonRtRicId); String policyBody = testHelper.postPolicyBody(nonRtRicId, policyTypeName, "1"); Mono<ResponseEntity<String>> responseMono = testHelper.restClientV3().postForEntity(url, policyBody); - testHelper.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1policymanagement/v1/policies/1")); + testHelper.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/1")); } @Test - @DisplayName("test Create Policy with exisitng policy id") + @DisplayName("test Create Policy with existing policy id") void testPostPolicyWithExistingPolicyID() throws Exception { String nonRtRicId = "ric.1"; String policyTypeName = "type1_1.2.3"; @@ -234,7 +234,7 @@ public class PolicyControllerTestV3 { String policyTypeName = "type1_1.2.3"; String nonRtRicId = "ricOne"; testHelper.addPolicyType(policyTypeName, nonRtRicId); - Mono<ResponseEntity<String>> responseMono = testHelper.restClientV3().getForEntity("/policytypes" + "?nearRtRicId=\"noRic\""); + Mono<ResponseEntity<String>> responseMono = testHelper.restClientV3().getForEntity("/policy-types" + "?nearRtRicId=\"noRic\""); testHelper.testErrorCode(responseMono, HttpStatus.NOT_FOUND, "Near-RT RIC not Found using ID:"); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerTestV3.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3Test.java index 576ae7f6..5f97df0e 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerTestV3.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3Test.java @@ -52,10 +52,9 @@ import java.lang.invoke.MethodHandles; "app.webclient.trust-store=./config/truststore.jks", // "app.webclient.trust-store-used=true", // "app.vardata-directory=/tmp/pmstestv3", //a - "app.filepath=", // "app.s3.bucket=" // If this is set, S3 will be used to store data. }) -public class RicRepositoryControllerTestV3 { +class RicRepositoryControllerV3Test { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -89,6 +88,7 @@ public class RicRepositoryControllerTestV3 { @BeforeEach void init() { testHelper.port = port; + rics.clear(); this.applicationConfig.setAuthProviderUrl(testHelper.baseUrl() + OpenPolicyAgentSimulatorController.ACCESS_CONTROL_URL); } @@ -116,8 +116,9 @@ public class RicRepositoryControllerTestV3 { testHelper.addPolicyType("2", "ricAddedTwo"); Mono<ResponseEntity<String>> responseEntityMono = testHelper.restClientV3().getForEntity("/rics"); testHelper.testSuccessResponse(responseEntityMono, HttpStatus.OK, responseBody -> responseBody - .contains("{\"rics\":[{\"ricId\":\"ricAddedTwo\",\"managedElementIds\":[],\"state\":\"AVAILABLE\"," + + .contains("{\"ricId\":\"ricAddedTwo\",\"managedElementIds\":[],\"state\":\"AVAILABLE\"," + "\"policyTypeIds\":[\"2\"]},{\"ricId\":\"ricAddedOne\",\"managedElementIds\":[]," + - "\"state\":\"AVAILABLE\",\"policyTypeIds\":[\"1\"]}]}")); + "\"state\":\"AVAILABLE\",\"policyTypeIds\":[\"1\"]")); } } + diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerTestV3.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3Test.java index 9eeaa3af..bfc0b683 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerTestV3.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3Test.java @@ -58,7 +58,7 @@ import java.time.Duration; "app.filepath=", // "app.s3.bucket=" // If this is set, S3 will be used to store data. }) -public class ServiceControllerTestV3 { +class ServiceControllerV3Test { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); |