summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-kubernetes/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-12-01 15:24:57 +0000
committerliamfallon <liam.fallon@est.tech>2022-12-06 12:53:44 +0000
commitcf5af3fd2e67b0aef402114a0f3ae263fdfc7efe (patch)
tree844e1f34ffe75187e1a76ebbfe724874f2dba188 /participant/participant-impl/participant-impl-kubernetes/src/test
parent7af90cd8fdabdd1c3ae79d3551980016d6b24f7e (diff)
Replace SpringFox with SpringDoc in CLAMP
This commit: - Remove springfox from CLAMP - updates the commissioning, AC Element, and K8S particiapnt to use the generated interface rather than the hard coded one - removes swagger annotations from handwritten code - implements SpringDoc for the <base_path>/v3/api-docs on endpoints Issue-ID: POLICY-4404 Change-Id: I49f48bc7828cb49dab854ef9ed16a9aa377983e1 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java14
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java7
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml1
3 files changed, 16 insertions, 6 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
index 997a227cb..3a97b8c6e 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
@@ -44,6 +44,7 @@ class ActuatorControllerTest extends CommonActuatorController {
private static final String HEALTH_ENDPOINT = "health";
private static final String METRICS_ENDPOINT = "metrics";
private static final String PROMETHEUS_ENDPOINT = "prometheus";
+ private static final String SWAGGER_ENDPOINT = "v3/api-docs";
@LocalServerPort
private int randomServerPort;
@@ -69,6 +70,11 @@ class ActuatorControllerTest extends CommonActuatorController {
}
@Test
+ void testGetSwagger_Unauthorized() {
+ assertUnauthorizedActGet(SWAGGER_ENDPOINT);
+ }
+
+ @Test
void testGetHealth() {
Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
Response rawresp = invocationBuilder.buildGet().invoke();
@@ -83,10 +89,16 @@ class ActuatorControllerTest extends CommonActuatorController {
}
@Test
- void testGePrometheus() {
+ void testGetPrometheus() {
Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
+ @Test
+ void testGetSwagger() {
+ Invocation.Builder invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT);
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ }
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
index e1cf3cf08..a6d6f315a 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
@@ -64,7 +64,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
-
@ExtendWith(SpringExtension.class)
@WebMvcTest(value = ChartController.class, properties = "chart.api.enabled=true")
@Import({MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class})
@@ -182,13 +181,13 @@ class ChartControllerTest {
@Test
void onboardChart() throws Exception {
RequestBuilder requestBuilder;
- MockMultipartFile chartFile = new MockMultipartFile("chart", "hello.tgz",
+ MockMultipartFile chartFile = new MockMultipartFile("file", "hello.tgz",
MediaType.TEXT_PLAIN_VALUE, "Dummy data".getBytes());
- MockMultipartFile overrideFile = new MockMultipartFile("values", "values.yaml",
+ MockMultipartFile overrideFile = new MockMultipartFile("file", "values.yaml",
MediaType.TEXT_PLAIN_VALUE, "Dummy data".getBytes());
- //Mocking successful scenario for void uninstall method
+ // Mocking successful scenario for void uninstall method
when(chartService.saveChart(charts.get(0), chartFile, null)).thenReturn(charts.get(0));
requestBuilder = MockMvcRequestBuilders.multipart(ONBOARD_CHART_URL)
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml
index c54996e79..cd36f61e7 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml
@@ -29,4 +29,3 @@ participant:
- localhost
topicCommInfrastructure: dmaap
name: AutomationComposition Topics
-