diff options
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test')
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 - |