Fix configuration for Prometheus metrics 83/129583/1
authoradheli.tavares <adheli.tavares@est.tech>
Thu, 9 Jun 2022 09:03:13 +0000 (10:03 +0100)
committeradheli.tavares <adheli.tavares@est.tech>
Thu, 9 Jun 2022 09:05:15 +0000 (10:05 +0100)
JVM related metrics were not being exposed due to spring boot bug
when loading beans configuration.

Issue-ID: POLICY-4146
Change-Id: I334c60b0c0d087c63b28bf44704aa3e909eca646
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java [new file with mode: 0644]
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java
runtime-acm/src/main/resources/application.yaml
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/monitoring/rest/MonitoringQueryControllerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java
runtime-acm/src/test/resources/application-test.yaml

index f514972..6776e59 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation.
+ *  Copyright (C) 2021-2022 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
 
 package org.onap.policy.clamp.acm.runtime.config;
 
-import java.util.Arrays;
 import java.util.List;
 import org.onap.policy.clamp.common.acm.rest.CoderHttpMesageConverter;
 import org.springframework.context.annotation.Configuration;
@@ -38,7 +37,7 @@ public class ConverterConfiguration implements WebMvcConfigurer {
         converters.add(new CoderHttpMesageConverter<>("json"));
 
         StringHttpMessageConverter converter = new StringHttpMessageConverter();
-        converter.setSupportedMediaTypes(Arrays.asList(MediaType.TEXT_PLAIN));
+        converter.setSupportedMediaTypes(List.of(MediaType.TEXT_PLAIN));
         converters.add(converter);
     }
 }
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java
new file mode 100644 (file)
index 0000000..dca31cd
--- /dev/null
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2022 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.config;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class MetricsConfiguration {
+
+    /**
+     * Load up the metrics registry.
+     */
+    @Bean
+    InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor,
+                                                  MeterRegistry registry) {
+        return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, "");
+    }
+}
index 7907de7..107de58 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,7 +34,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
  * Common superclass to provide REST endpoints for the participant simulator.
  */
 // @formatter:off
-@RequestMapping(value = "/v2", produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML})
+@RequestMapping(value = "/onap/policy/clamp/acm/v2",
+    produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML})
 @Api(value = "Automation Composition Commissioning API")
 @SwaggerDefinition(
         info = @Info(description =
index 0a5bb8b..21c754c 100644 (file)
@@ -32,8 +32,6 @@ security:
 
 server:
   port: 6969
-  servlet:
-    context-path: /onap/policy/clamp/acm
   error:
     path: /error
 
@@ -62,5 +60,6 @@ runtime:
 management:
   endpoints:
     web:
+      base-path: /
       exposure:
         include: health, metrics, prometheus
index a0f1a75..cd68232 100644 (file)
@@ -90,42 +90,42 @@ class CommissioningControllerTest extends CommonRestController {
     }
 
     @Test
-    void testSwagger() throws Exception {
+    void testSwagger() {
         super.testSwagger(COMMISSIONING_ENDPOINT);
     }
 
     @Test
-    void testUnauthorizedCreate() throws Exception {
+    void testUnauthorizedCreate() {
         assertUnauthorizedPost(COMMISSIONING_ENDPOINT, Entity.json(serviceTemplate));
     }
 
     @Test
-    void testUnauthorizedQuery() throws Exception {
+    void testUnauthorizedQuery() {
         assertUnauthorizedGet(COMMISSIONING_ENDPOINT);
     }
 
     @Test
-    void testUnauthorizedQueryElements() throws Exception {
+    void testUnauthorizedQueryElements() {
         assertUnauthorizedGet(COMMISSIONING_ENDPOINT + "/elements");
     }
 
     @Test
-    void testUnauthorizedDelete() throws Exception {
+    void testUnauthorizedDelete() {
         assertUnauthorizedDelete(COMMISSIONING_ENDPOINT);
     }
 
     @Test
-    void testUnauthorizedQueryToscaServiceTemplate() throws Exception {
+    void testUnauthorizedQueryToscaServiceTemplate() {
         assertUnauthorizedGet(COMMISSIONING_ENDPOINT + "/toscaservicetemplate");
     }
 
     @Test
-    void testUnauthorizedQueryToscaServiceTemplateSchema() throws Exception {
+    void testUnauthorizedQueryToscaServiceTemplateSchema() {
         assertUnauthorizedGet(COMMISSIONING_ENDPOINT + "/toscaServiceTemplateSchema");
     }
 
     @Test
-    void testUnauthorizedQueryToscaServiceCommonOrInstanceProperties() throws Exception {
+    void testUnauthorizedQueryToscaServiceCommonOrInstanceProperties() {
         assertUnauthorizedGet(COMMISSIONING_ENDPOINT + "/getCommonOrInstanceProperties");
     }
 
@@ -170,7 +170,7 @@ class CommissioningControllerTest extends CommonRestController {
     }
 
     @Test
-    void testCreateBadRequest() throws Exception {
+    void testCreateBadRequest() {
         Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT);
         Response resp = invocationBuilder.post(Entity.json("NotToscaServiceTempalte"));
 
@@ -181,7 +181,7 @@ class CommissioningControllerTest extends CommonRestController {
     }
 
     @Test
-    void testCreate() throws Exception {
+    void testCreate() {
         Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT);
         Response resp = invocationBuilder.post(Entity.json(serviceTemplate));
         assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
index 49ed40e..b035911 100644 (file)
@@ -91,8 +91,8 @@ public class InstantiationUtils {
         AutomationCompositions automationCompositions) {
         assertThat(response).isNotNull();
         assertThat(response.getErrorDetails()).isNull();
-        assertThat(response.getAffectedAutomationCompositions().size())
-            .isEqualTo(automationCompositions.getAutomationCompositionList().size());
+        assertThat(response.getAffectedAutomationCompositions())
+            .hasSameSizeAs(automationCompositions.getAutomationCompositionList());
         for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) {
             assertTrue(response.getAffectedAutomationCompositions().stream()
                 .anyMatch(ac -> ac.equals(automationComposition.getKey().asIdentifier())));
index df21d3f..35a3094 100644 (file)
@@ -125,7 +125,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testSwagger() throws Exception {
+    void testSwagger() {
         super.testSwagger(INSTANTIATION_ENDPOINT);
     }
 
@@ -138,7 +138,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testQuery_Unauthorized() throws Exception {
+    void testQuery_Unauthorized() {
         assertUnauthorizedGet(INSTANTIATION_ENDPOINT);
     }
 
@@ -151,7 +151,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testDelete_Unauthorized() throws Exception {
+    void testDelete_Unauthorized() {
         assertUnauthorizedDelete(INSTANTIATION_ENDPOINT);
     }
 
@@ -214,7 +214,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testQuery_NoResultWithThisName() throws Exception {
+    void testQuery_NoResultWithThisName() {
         Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName");
         Response rawresp = invocationBuilder.buildGet().invoke();
         assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
@@ -273,7 +273,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testDelete_NoResultWithThisName() throws Exception {
+    void testDelete_NoResultWithThisName() {
         Invocation.Builder invocationBuilder =
             super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName&version=1.0.1");
         Response resp = invocationBuilder.delete();
@@ -325,7 +325,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testCreateInstanceProperties() throws Exception {
+    void testCreateInstanceProperties() {
         Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_PROPERTIES);
         Response resp = invocationBuilder.post(Entity.json(serviceTemplate));
         assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
@@ -358,7 +358,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testDeleteInstancePropertiesBadRequest() throws Exception {
+    void testDeleteInstancePropertiesBadRequest() {
         Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_PROPERTIES);
         Response resp = invocationBuilder.post(Entity.json(serviceTemplate));
         assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
@@ -408,7 +408,7 @@ class InstantiationControllerTest extends CommonRestController {
     }
 
     @Test
-    void testCommand_NotFound1() throws Exception {
+    void testCommand_NotFound1() {
         Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
         Response resp = invocationBuilder.put(Entity.json(new InstantiationCommand()));
         assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
index 0f9490d..6a2b102 100644 (file)
@@ -54,36 +54,36 @@ class ActuatorControllerTest extends CommonRestController {
     }
 
     @Test
-    void testGetHealth_Unauthorized() throws Exception {
+    void testGetHealth_Unauthorized() {
         assertUnauthorizedActGet(HEALTH_ENDPOINT);
     }
 
     @Test
-    void testGetMetrics_Unauthorized() throws Exception {
+    void testGetMetrics_Unauthorized() {
         assertUnauthorizedActGet(METRICS_ENDPOINT);
     }
 
     @Test
-    void testGetPrometheus_Unauthorized() throws Exception {
+    void testGetPrometheus_Unauthorized() {
         assertUnauthorizedActGet(PROMETHEUS_ENDPOINT);
     }
 
     @Test
-    void testGetHealth() throws Exception {
+    void testGetHealth() {
         Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
         Response rawresp = invocationBuilder.buildGet().invoke();
         assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
     }
 
     @Test
-    void testGetMetrics() throws Exception {
+    void testGetMetrics() {
         Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT);
         Response rawresp = invocationBuilder.buildGet().invoke();
         assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
     }
 
     @Test
-    void testGePrometheus() throws Exception {
+    void testGetPrometheus() {
         Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
         Response rawresp = invocationBuilder.buildGet().invoke();
         assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
index 6a53f6c..e8a8ad0 100644 (file)
@@ -100,27 +100,27 @@ class MonitoringQueryControllerTest extends CommonRestController {
     }
 
     @Test
-    void testQuery_Unauthorized_for_AcElementStats() throws Exception {
+    void testQuery_Unauthorized_for_AcElementStats() {
         assertUnauthorizedGet(AC_ELEMENT_STATS_ENDPOINT);
     }
 
     @Test
-    void testQuery_Unauthorized_for_AcParticipantStats() throws Exception {
+    void testQuery_Unauthorized_for_AcParticipantStats() {
         assertUnauthorizedGet(PARTICIPANT_STATS_ENDPOINT);
     }
 
     @Test
-    void testQuery_Unauthorized_for_ParticipantStatsPerAc() throws Exception {
+    void testQuery_Unauthorized_for_ParticipantStatsPerAc() {
         assertUnauthorizedGet(PARTICIPANT_STATS_PER_AC_ENDPOINT);
     }
 
     @Test
-    void testQuery_Unauthorized_for_AcElementStatsPerAc() throws Exception {
+    void testQuery_Unauthorized_for_AcElementStatsPerAc() {
         assertUnauthorizedGet(AC_ELEMENT_STATS_PER_AC_ENDPOINT);
     }
 
     @Test
-    void testSwagger_AcStats() throws Exception {
+    void testSwagger_AcStats() {
         super.testSwagger(AC_ELEMENT_STATS_ENDPOINT);
         super.testSwagger(PARTICIPANT_STATS_ENDPOINT);
         super.testSwagger(AC_ELEMENT_STATS_PER_AC_ENDPOINT);
@@ -128,7 +128,7 @@ class MonitoringQueryControllerTest extends CommonRestController {
     }
 
     @Test
-    void testAcElementStatisticsEndpoint() throws Exception {
+    void testAcElementStatisticsEndpoint() {
         // Filter statistics only based on participant Id and UUID
         Invocation.Builder invokeRequest1 = super.sendRequest(AC_ELEMENT_STATS_ENDPOINT + "?name="
                 + acElementStatisticsList.getAcElementStatistics().get(0).getParticipantId().getName() + "&version="
@@ -164,14 +164,14 @@ class MonitoringQueryControllerTest extends CommonRestController {
     }
 
     @Test
-    void testAcElementStats_BadRequest() throws Exception {
+    void testAcElementStats_BadRequest() {
         Invocation.Builder invokeRequest1 = super.sendRequest(AC_ELEMENT_STATS_ENDPOINT + "?version=1.0.0");
         Response response1 = invokeRequest1.buildGet().invoke();
         assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
     }
 
     @Test
-    void testParticipantStatisticsEndpoint() throws Exception {
+    void testParticipantStatisticsEndpoint() {
 
         // Filter statistics only based on participant Id
         Invocation.Builder invokeRequest1 = super.sendRequest(PARTICIPANT_STATS_ENDPOINT + "?name="
@@ -200,14 +200,14 @@ class MonitoringQueryControllerTest extends CommonRestController {
     }
 
     @Test
-    void testParticipantStats_BadRequest() throws Exception {
+    void testParticipantStats_BadRequest() {
         Invocation.Builder invokeRequest1 = super.sendRequest(PARTICIPANT_STATS_ENDPOINT + "?version=0.0");
         Response response1 = invokeRequest1.buildGet().invoke();
         assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
     }
 
     @Test
-    void testParticipantStatsPerAcEndpoint() throws Exception {
+    void testParticipantStatsPerAcEndpoint() {
         Invocation.Builder invokeRequest1 =
                 super.sendRequest(PARTICIPANT_STATS_PER_AC_ENDPOINT + "?name=dummyName&version=1.001");
         Response response1 = invokeRequest1.buildGet().invoke();
@@ -217,14 +217,14 @@ class MonitoringQueryControllerTest extends CommonRestController {
     }
 
     @Test
-    void testParticipantStatsPerAc_BadRequest() throws Exception {
+    void testParticipantStatsPerAc_BadRequest() {
         Invocation.Builder invokeRequest1 = super.sendRequest(PARTICIPANT_STATS_PER_AC_ENDPOINT);
         Response response1 = invokeRequest1.buildGet().invoke();
         assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
     }
 
     @Test
-    void testAcElementStatisticsPerAcEndpoint() throws Exception {
+    void testAcElementStatisticsPerAcEndpoint() {
         Invocation.Builder invokeRequest1 =
                 super.sendRequest(AC_ELEMENT_STATS_PER_AC_ENDPOINT + "?name=dummyName&version=1.001");
         Response response1 = invokeRequest1.buildGet().invoke();
@@ -234,7 +234,7 @@ class MonitoringQueryControllerTest extends CommonRestController {
     }
 
     @Test
-    void testAcElementStatsPerAc_BadRequest() throws Exception {
+    void testAcElementStatsPerAc_BadRequest() {
         Invocation.Builder invokeRequest1 = super.sendRequest(AC_ELEMENT_STATS_PER_AC_ENDPOINT);
         Response response1 = invokeRequest1.buildGet().invoke();
         assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response1.getStatus());
index 0fc0a6e..89d956a 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation.
+ *  Copyright (C) 2021-2022 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,9 +42,8 @@ import org.onap.policy.common.utils.network.NetworkUtil;
 public class CommonRestController {
 
     public static final String SELF = NetworkUtil.getHostname();
-    public static final String CONTEXT_PATH = "onap/automationcomposition";
+    public static final String CONTEXT_PATH = "onap/policy/clamp/acm";
     public static final String ENDPOINT_PREFIX = CONTEXT_PATH + "/v2/";
-    public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
 
     private static String httpPrefix;
 
@@ -52,10 +51,9 @@ public class CommonRestController {
      * Verifies that an endpoint appears within the swagger response.
      *
      * @param endpoint the endpoint of interest
-     * @throws Exception if an error occurs
      */
-    protected void testSwagger(final String endpoint) throws Exception {
-        final Invocation.Builder invocationBuilder = sendRequest("api-docs");
+    protected void testSwagger(final String endpoint) {
+        final Invocation.Builder invocationBuilder = sendActRequest("v2/api-docs");
         final String resp = invocationBuilder.get(String.class);
 
         assertThat(resp).contains(endpoint);
@@ -66,9 +64,8 @@ public class CommonRestController {
      *
      * @param endpoint the target endpoint
      * @return a request builder
-     * @throws Exception if an error occurs
      */
-    protected Invocation.Builder sendRequest(final String endpoint) throws Exception {
+    protected Invocation.Builder sendRequest(final String endpoint) {
         return sendFqeRequest(httpPrefix + ENDPOINT_PREFIX + endpoint, true);
     }
 
@@ -77,10 +74,9 @@ public class CommonRestController {
      *
      * @param endpoint the target endpoint
      * @return a request builder
-     * @throws Exception if an error occurs
      */
-    protected Invocation.Builder sendActRequest(final String endpoint) throws Exception {
-        return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, true);
+    protected Invocation.Builder sendActRequest(final String endpoint) {
+        return sendFqeRequest(httpPrefix + endpoint, true);
     }
 
     /**
@@ -88,9 +84,8 @@ public class CommonRestController {
      *
      * @param endpoint the target endpoint
      * @return a request builder
-     * @throws Exception if an error occurs
      */
-    protected Invocation.Builder sendNoAuthRequest(final String endpoint) throws Exception {
+    protected Invocation.Builder sendNoAuthRequest(final String endpoint) {
         return sendFqeRequest(httpPrefix + ENDPOINT_PREFIX + endpoint, false);
     }
 
@@ -99,10 +94,9 @@ public class CommonRestController {
      *
      * @param endpoint the target endpoint
      * @return a request builder
-     * @throws Exception if an error occurs
      */
-    protected Invocation.Builder sendNoAuthActRequest(final String endpoint) throws Exception {
-        return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, false);
+    protected Invocation.Builder sendNoAuthActRequest(final String endpoint) {
+        return sendFqeRequest(httpPrefix + endpoint, false);
     }
 
     /**
@@ -111,10 +105,8 @@ public class CommonRestController {
      * @param fullyQualifiedEndpoint the fully qualified target endpoint
      * @param includeAuth if authorization header should be included
      * @return a request builder
-     * @throws Exception if an error occurs
      */
-    protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint, boolean includeAuth)
-            throws Exception {
+    protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint, boolean includeAuth) {
         final Client client = ClientBuilder.newBuilder().build();
 
         client.property(ClientProperties.METAINF_SERVICES_LOOKUP_DISABLE, "true");
@@ -134,9 +126,8 @@ public class CommonRestController {
      *
      * @param endPoint the endpoint
      * @param entity the entity ofthe body
-     * @throws Exception if an error occurs
      */
-    protected void assertUnauthorizedPost(final String endPoint, final Entity<?> entity) throws Exception {
+    protected void assertUnauthorizedPost(final String endPoint, final Entity<?> entity) {
         Response rawresp = sendNoAuthRequest(endPoint).post(entity);
         assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
     }
@@ -146,9 +137,8 @@ public class CommonRestController {
      *
      * @param endPoint the endpoint
      * @param entity the entity ofthe body
-     * @throws Exception if an error occurs
      */
-    protected void assertUnauthorizedPut(final String endPoint, final Entity<?> entity) throws Exception {
+    protected void assertUnauthorizedPut(final String endPoint, final Entity<?> entity) {
         Response rawresp = sendNoAuthRequest(endPoint).put(entity);
         assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
     }
@@ -157,9 +147,8 @@ public class CommonRestController {
      * Assert that GET call is Unauthorized.
      *
      * @param endPoint the endpoint
-     * @throws Exception if an error occurs
      */
-    protected void assertUnauthorizedGet(final String endPoint) throws Exception {
+    protected void assertUnauthorizedGet(final String endPoint) {
         Response rawresp = sendNoAuthRequest(endPoint).buildGet().invoke();
         assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
     }
@@ -168,9 +157,8 @@ public class CommonRestController {
      * Assert that GET call to actuator endpoint is Unauthorized.
      *
      * @param endPoint the endpoint
-     * @throws Exception if an error occurs
      */
-    protected void assertUnauthorizedActGet(final String endPoint) throws Exception {
+    protected void assertUnauthorizedActGet(final String endPoint) {
         Response rawresp = sendNoAuthActRequest(endPoint).buildGet().invoke();
         assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
     }
@@ -179,9 +167,8 @@ public class CommonRestController {
      * Assert that DELETE call is Unauthorized.
      *
      * @param endPoint the endpoint
-     * @throws Exception if an error occurs
      */
-    protected void assertUnauthorizedDelete(final String endPoint) throws Exception {
+    protected void assertUnauthorizedDelete(final String endPoint) {
         Response rawresp = sendNoAuthRequest(endPoint).delete();
         assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
     }
index 60a4d76..9d0754a 100644 (file)
@@ -12,10 +12,6 @@ spring:
       hibernate:
         dialect: org.hibernate.dialect.HSQLDialect
 
-server:
-  servlet:
-    context-path: /onap/automationcomposition
-
 runtime:
   participantParameters:
     updateParameters: