aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2020-10-05 13:30:22 +0200
committerPatrikBuhr <patrik.buhr@est.tech>2020-10-05 13:31:34 +0200
commitf8e927828c4cc948091557671de2d4e52de32bc7 (patch)
treea349a9672e3b0965a63ba9067d82a9e333cbdc7e /a1-policy-management/src
parentda01a12526a65a32e66ad3787d2dfd93f0c8caf9 (diff)
Generated api/api_generated.json
Change-Id: I22142f7752dd3876a689742af17caaf74c13f349 Issue-ID: CCSDK-2502 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Diffstat (limited to 'a1-policy-management/src')
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java29
1 files changed, 23 insertions, 6 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 87589f22..100e841c 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
@@ -30,6 +30,9 @@ import static org.mockito.Mockito.doReturn;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
@@ -37,6 +40,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.json.JSONObject;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -202,6 +206,18 @@ class ApplicationTest {
}
@Test
+
+ void createApiDoc() throws FileNotFoundException {
+ String url = "https://localhost:" + this.port + "/v2/api-docs";
+ ResponseEntity<String> resp = restClient("", false).getForEntity(url).block();
+ assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
+ String indented = (new JSONObject(resp.getBody())).toString(4);
+ try (PrintStream out = new PrintStream(new FileOutputStream("api/api_generated.json"))) {
+ out.print(indented);
+ }
+ }
+
+ @Test
void testGetRics() throws Exception {
addRic("ric1");
this.addPolicyType("type1", "ric1");
@@ -729,10 +745,6 @@ class ApplicationTest {
}
}
- private String baseUrl() {
- return "https://localhost:" + port + Consts.V2_API_ROOT;
- }
-
private String jsonString() {
return "{\"servingCellNrcgi\":\"1\"}";
}
@@ -766,7 +778,7 @@ class ApplicationTest {
logger.info("Concurrency test took " + Duration.between(startTime, Instant.now()));
}
- private AsyncRestClient restClient(boolean useTrustValidation) {
+ private AsyncRestClient restClient(String baseUrl, boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
config = ImmutableWebClientConfig.builder() //
.keyStoreType(config.keyStoreType()) //
@@ -778,7 +790,12 @@ class ApplicationTest {
.trustStorePassword(config.trustStorePassword()) //
.build();
- return new AsyncRestClient(baseUrl(), config);
+ return new AsyncRestClient(baseUrl, config);
+ }
+
+ private AsyncRestClient restClient(boolean useTrustValidation) {
+ String baseUrl = "https://localhost:" + port + Consts.V2_API_ROOT;
+ return restClient(baseUrl, useTrustValidation);
}
private AsyncRestClient restClient() {