diff options
author | Bogumil Zebek <bogumil.zebek@nokia.com> | 2020-05-18 09:35:21 +0200 |
---|---|---|
committer | Zebek Bogumil <bogumil.zebek@nokia.com> | 2020-06-01 07:35:38 +0200 |
commit | a0f2e231b6a4c6b002eb64b86b124400d9d048ae (patch) | |
tree | 775b4e4068c1a476dddff0e6901b36a158236a66 /src/main/java | |
parent | d5c7cf6980a4e017324dde4cd041ba9496d67bf8 (diff) |
Add unit test to few classes
Increase code coverage:
- HeaderUtil
- EnvProps
- WebMvcConfig
Change-Id: I880a4ff02d436cf153d41c795d8e95dfc67fd61b
Issue-ID: DCAEGEN2-2245
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/dcae/restapi/WebMvcConfig.java | 29 |
1 files changed, 19 insertions, 10 deletions
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; } } |