From a0f2e231b6a4c6b002eb64b86b124400d9d048ae Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Mon, 18 May 2020 09:35:21 +0200 Subject: Add unit test to few classes Increase code coverage: - HeaderUtil - EnvProps - WebMvcConfig Change-Id: I880a4ff02d436cf153d41c795d8e95dfc67fd61b Issue-ID: DCAEGEN2-2245 Signed-off-by: Zebek Bogumil --- .../java/org/onap/dcae/restapi/WebMvcConfig.java | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/main/java/org/onap/dcae/restapi/WebMvcConfig.java') diff --git a/src/main/java/org/onap/dcae/restapi/WebMvcConfig.java b/src/main/java/org/onap/dcae/restapi/WebMvcConfig.java index c8dd7ba4..cf180e71 100644 --- a/src/main/java/org/onap/dcae/restapi/WebMvcConfig.java +++ b/src/main/java/org/onap/dcae/restapi/WebMvcConfig.java @@ -1,9 +1,9 @@ /* * ============LICENSE_START======================================================= - * PROJECT + * org.onap.dcaegen2.collectors.ves * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2018 - 2019 Nokia. All rights reserved. + * Copyright (C) 2020 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,26 +28,35 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; public class WebMvcConfig extends WebMvcConfigurationSupport { + public static final String SWAGGER_PATH_PATTERN = "swagger-ui.html"; + public static final String SWAGGER_CLASSPATH_RESOURCES = "classpath:/META-INF/resources/"; + public static final String WEBJARS_PATH_PATTERN = "/webjars/**"; + public static final String WEBJARS_CLASSPATH_RESOURCES = "classpath:/META-INF/resources/webjars/"; + public static final String TEMPLATES_PATTERN = "**"; + public static final String TEMPLATES_CLASSPATH_RESOURCES = "classpath:/templates/"; + public static final String PREFIX = "/"; + public static final String SUFFIX = ".html"; + @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { registry - .addResourceHandler("swagger-ui.html") - .addResourceLocations("classpath:/META-INF/resources/"); + .addResourceHandler(SWAGGER_PATH_PATTERN) + .addResourceLocations(SWAGGER_CLASSPATH_RESOURCES); registry - .addResourceHandler("/webjars/**") - .addResourceLocations("classpath:/META-INF/resources/webjars/"); + .addResourceHandler(WEBJARS_PATH_PATTERN) + .addResourceLocations(WEBJARS_CLASSPATH_RESOURCES); registry - .addResourceHandler("**") - .addResourceLocations("classpath:/templates/"); + .addResourceHandler(TEMPLATES_PATTERN) + .addResourceLocations(TEMPLATES_CLASSPATH_RESOURCES); } @Bean public InternalResourceViewResolver jspViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); - resolver.setPrefix("/"); - resolver.setSuffix(".html"); + resolver.setPrefix(PREFIX); + resolver.setSuffix(SUFFIX); return resolver; } } -- cgit 1.2.3-korg