summaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/test/java
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2021-02-02 14:06:44 +0100
committerKAPIL SINGAL <ks220y@att.com>2021-02-02 22:39:57 +0000
commitfee9955e585a00155b93f6de279a36217a8857bd (patch)
treeec0b5ea7cb400b0f68d6ee4899ff31973db36ce8 /a1-policy-management/src/test/java
parentb369f78cc4c558b94d1192f8774ce5bb044f2cf0 (diff)
Improved API documentation
Using swagger3 and improving the API documatation. Change-Id: I31f7783e0a6e6fd7698c68e5df6f2d306bce6816 Issue-ID: CCSDK-3127 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Diffstat (limited to 'a1-policy-management/src/test/java')
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java15
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java20
2 files changed, 18 insertions, 17 deletions
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 14843eb2..68255953 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
@@ -98,7 +98,7 @@ import reactor.util.annotation.Nullable;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = { //
"server.ssl.key-store=./config/keystore.jks", //
- "app.webclient.trust-store=./config/truststore.jks" })
+ "app.webclient.trust-store=./config/truststore.jks"})
class ApplicationTest {
private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
@@ -213,15 +213,12 @@ class ApplicationTest {
}
@Test
- void createApiDoc() throws IOException {
- String url = "https://localhost:" + this.port + "/v2/api-docs";
+ void generateApiDoc() throws IOException {
+ String url = "https://localhost:" + this.port + "/v3/api-docs";
ResponseEntity<String> resp = restClient("", false).getForEntity(url).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
JSONObject jsonObj = new JSONObject(resp.getBody());
- jsonObj.remove("host");
- assertThat(jsonObj.getJSONObject("definitions").remove("Mono«ResponseEntity«object»»")).isNotNull();
- assertThat(jsonObj.getJSONObject("definitions").remove("void")).isNotNull();
- assertThat(jsonObj.getJSONObject("definitions").remove("Mono«ResponseEntity«string»»")).isNotNull();
+ assertThat(jsonObj.remove("servers")).isNotNull();
String indented = (jsonObj).toString(4);
String docDir = "api/";
@@ -773,8 +770,8 @@ class ApplicationTest {
for (int i = 0; i < 10; ++i) {
AsyncRestClient restClient = restClient();
- ConcurrencyTestRunnable test = new ConcurrencyTestRunnable(restClient, supervision, a1ClientFactory, rics,
- policyTypes);
+ ConcurrencyTestRunnable test =
+ new ConcurrencyTestRunnable(restClient, supervision, a1ClientFactory, rics, policyTypes);
Thread thread = new Thread(test, "TestThread_" + i);
thread.start();
threads.add(thread);
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
index 0a679201..83a2d784 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
@@ -23,10 +23,12 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.util.Vector;
@@ -45,11 +47,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController("RappCallbacksController")
-@Api(tags = {"R-App Callbacks"})
+@Tag(name = Consts.V2_API_SERVICE_CALLBACKS_NAME)
public class RappSimulatorController {
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- public static final String SERVICE_CALLBACK_URL = "/r-app/pms-callback";
+ public static final String SERVICE_CALLBACK_URL = "/r-app/near-rt-ric-status";
private static Gson gson = new GsonBuilder().create();
public static class TestResults {
@@ -67,10 +69,12 @@ public class RappSimulatorController {
private static final String CALLBACK_DESCRIPTION = "The URL to this call is registerred at Service registration.";
@PostMapping(path = SERVICE_CALLBACK_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for Near-RT RIC status", notes = CALLBACK_DESCRIPTION)
+ @Operation(summary = "Callback for Near-RT RIC status", description = CALLBACK_DESCRIPTION)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)} //
+ @ApiResponse(responseCode = "200", description = "OK",
+ content = @Content(schema = @Schema(implementation = VoidResponse.class)))} //
)
+
public ResponseEntity<Object> jobStatusCallback( //
@RequestBody ServiceCallbackInfo body) {
logger.info("R-App callback body: {}", gson.toJson(body));