diff options
author | Jerry Flood <jflood@att.com> | 2019-04-16 09:06:17 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-16 11:29:13 -0400 |
commit | b1ba8ef51edabee26acaf74e226eeb269297aec7 (patch) | |
tree | 54fcd741ae9b0f05ca1d438de1a4dbacf06cf1ac /cmso-ticketmgt/src/main/java/org | |
parent | 134ae90b8d8f5b19d9915adbc9b1a70d8c27540e (diff) |
More checkstyle changes for Dublin
Issue-ID: OPTFRA-466
Change-Id: Ied602196284bf3aed56ff491a749f14503395c88
Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-ticketmgt/src/main/java/org')
13 files changed, 55 insertions, 39 deletions
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java index f140aec..e968728 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java @@ -69,7 +69,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); static { supportedMajorVersions.put("v1", "0"); @@ -77,7 +77,7 @@ public class MessageHeaders { } /** The Constant supportedMajorMinorVersions. */ - public static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); static { supportedMajorMinorVersions.add("v1.0"); @@ -85,10 +85,10 @@ public class MessageHeaders { } /** The Constant latestVersion. */ - public static final String latestVersion = "2.0.0"; + private static final String latestVersion = "2.0.0"; /** The Constant patchVersion. */ - public static final String patchVersion = "0"; + private static final String patchVersion = "0"; /** * From string. @@ -156,4 +156,20 @@ public class MessageHeaders { } return true; } + + public static Map<String, String> getSupportedmajorversions() { + return supportedMajorVersions; + } + + public static Set<String> getSupportedmajorminorversions() { + return supportedMajorMinorVersions; + } + + public static String getLatestversion() { + return latestVersion; + } + + public static String getPatchversion() { + return patchVersion; + } } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java index eb9ddad..2426a5c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CmsoEnvironmentPostProcessor.java @@ -40,7 +40,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources; -public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor { +public class CmsoEnvironmentPostProcessor implements EnvironmentPostProcessor { // TODO tested in ONAP springboot and this is called before all of the properties files have been // loaded... // perhaps there is a post post processor? Until this works. DB password will be in the clear in the diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java index 4ba7d48..ba28a2d 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java @@ -36,16 +36,16 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; -public class CMSRequestError implements Serializable { +public class CmsoRequestError implements Serializable { private static final long serialVersionUID = 1L; @JsonProperty RequestError requestError; - public CMSRequestError(String messageId, String text, List<String> variables) { + public CmsoRequestError(String messageId, String text, List<String> variables) { requestError = new RequestError(messageId, text, variables); } - public CMSRequestError(String messageId, String text) { + public CmsoRequestError(String messageId, String text) { requestError = new RequestError(messageId, text, new ArrayList<String>()); } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java index e8b5e03..c80cd56 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CmsoException.java @@ -36,12 +36,12 @@ import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response.Status; import org.onap.observations.ObservationInterface; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; -public class CMSException extends Exception { +public class CmsoException extends Exception { private static final long serialVersionUID = 1L; - protected CMSRequestError requestError = null; + protected CmsoRequestError requestError = null; private List<String> variables = new ArrayList<String>(); protected ObservationInterface messageCode; protected Status status; @@ -53,14 +53,14 @@ public class CMSException extends Exception { * @param messageCode the message code * @param args the args */ - public CMSException(Status status, ObservationInterface messageCode, String... args) { + public CmsoException(Status status, ObservationInterface messageCode, String... args) { super(EELFResourceManager.format(messageCode, args)); this.status = status; this.messageCode = messageCode; for (String arg : args) { variables.add(arg); } - requestError = new CMSRequestError(messageCode.name(), getMessage(), variables); + requestError = new CmsoRequestError(messageCode.name(), getMessage(), variables); } public Status getStatus() { @@ -75,7 +75,7 @@ public class CMSException extends Exception { return variables.toArray(new String[variables.size()]); } - public CMSRequestError getRequestError() { + public CmsoRequestError getRequestError() { return requestError; } } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CmsoEnvironmentPostProcessor.java index d955e75..1230591 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CmsoEnvironmentPostProcessor.java @@ -40,7 +40,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources; -public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor { +public class CmsoEnvironmentPostProcessor implements EnvironmentPostProcessor { // TODO tested in ONAP springboot and this is called before all of the properties files have been // loaded... // perhaps there is a post post processor? Until this works. DB password will be in the clear in the diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java index c4fe51a..1cbf19c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java @@ -44,7 +44,7 @@ import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; -import org.onap.optf.ticketmgt.filters.CMSOContainerFilters; +import org.onap.optf.ticketmgt.filters.CmsoContainerFilters; import org.onap.optf.ticketmgt.service.rs.AdminToolImpl; import org.onap.optf.ticketmgt.service.rs.AvailabilityInterfaceImpl; import org.onap.optf.ticketmgt.service.rs.HealthCheckImpl; @@ -91,7 +91,7 @@ public class JerseyConfiguration extends ResourceConfig { // TODO: Examine which logging features to enable register(new LoggingFeature(log)); - register(CMSOContainerFilters.class); + register(CmsoContainerFilters.class); } /** diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java index ffbd94e..ea044a4 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java @@ -26,7 +26,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.ticketmgt.SpringProfiles; import org.onap.optf.ticketmgt.common.LogMessages; import org.springframework.beans.factory.annotation.Value; @@ -69,7 +69,7 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter { if (!request.isUserInRole(permission)) { Observation.report(LogMessages.UNAUTHORIZED); ResponseFormatter.errorResponse(request, response, - new CMSException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); + new CmsoException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, "")); } else { filterChain.doFilter(request, response); } diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java index c0c8106..1f27fee 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse; import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.observations.Observation; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; import org.onap.optf.ticketmgt.Application; import org.onap.optf.ticketmgt.SpringProfiles; import org.onap.optf.ticketmgt.common.LogMessages; @@ -67,7 +67,7 @@ public class AafFilter extends OrderedRequestContextFilter { cadiFilter.doFilter(request, response, filterChain); if (response.getStatus() >= 400 && response.getStatus() < 500) { Observation.report(LogMessages.UNAUTHENTICATED); - ResponseFormatter.errorResponse(request, response, new CMSException( + ResponseFormatter.errorResponse(request, response, new CmsoException( LogMessages.UNAUTHENTICATED.getStatus(), LogMessages.UNAUTHENTICATED, "")); } } else { diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java index b9b222c..156b3ce 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java @@ -23,12 +23,12 @@ package org.onap.optf.ticketmgt.aaf; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.onap.optf.cmso.common.exceptions.CMSException; +import org.onap.optf.cmso.common.exceptions.CmsoException; class ResponseFormatter { - static void errorResponse(HttpServletRequest request, HttpServletResponse response, CMSException error) + static void errorResponse(HttpServletRequest request, HttpServletResponse response, CmsoException error) throws IOException { response.setStatus(error.getStatus().getStatusCode()); response.getWriter().write(error.getRequestError().toString()); diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoClientFilters.java index 54b1b38..ac1569c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoClientFilters.java @@ -49,7 +49,7 @@ import org.springframework.stereotype.Component; // @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component -public class CMSOClientFilters implements ClientRequestFilter, ClientResponseFilter { +public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFilter { private static String appId = "cmso"; diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoContainerFilters.java index 4f6b8e7..5b73a85 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CmsoContainerFilters.java @@ -55,7 +55,7 @@ import org.springframework.stereotype.Component; @Priority(1) @Provider @Component -public class CMSOContainerFilters implements ContainerRequestFilter, ContainerResponseFilter { +public class CmsoContainerFilters implements ContainerRequestFilter, ContainerResponseFilter { @Context @@ -73,8 +73,8 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders(); String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString()); respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion); - respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestversion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchversion()); } catch (Exception e) { if (e instanceof WebApplicationException) { @@ -115,7 +115,7 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe } String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString()); if (minorVersion == null) { - minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion); + minorVersion = MessageHeaders.getSupportedmajorversions().get(majorVersion); headers.add(HeadersEnum.MinorVersion.toString(), minorVersion); } if (!MessageHeaders.validateMajorMinorVersion(majorVersion, minorVersion)) { diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java index 3360927..df23f7d 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java @@ -45,7 +45,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsRequest; import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsResponse; import org.springframework.web.bind.annotation.PathVariable; @@ -72,7 +72,7 @@ public interface AvailabilityInterface { + "optimizer will begin to poll the request until COMPLETED.", response = ActiveTicketsResponse.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response getActiveTickets( @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable( @@ -92,7 +92,7 @@ public interface AvailabilityInterface { + "receipt of the response.", response = ActiveTicketsResponse.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 404, message = "Not found.", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "Not found.", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response pollActiveTickets( @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable( @@ -111,7 +111,7 @@ public interface AvailabilityInterface { + " treat Not found reponse on as normal.", response = ActiveTicketsResponse.class) @ApiResponses(value = {@ApiResponse(code = 204, message = "OK"), - @ApiResponse(code = 404, message = "Not found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "Not found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response deleteActiveTicketsRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable( diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java index 16346bf..60a517b 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java @@ -47,7 +47,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.common.CmsoRequestError; import org.onap.optf.ticketmgt.service.rs.models.TicketData; @Api("Ticket Management") @@ -61,7 +61,7 @@ public interface TicketManagement { @ApiOperation(value = "Fetch Ticket", notes = "Returns ticket information for the provided ticket id.", response = TicketData.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No record found", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response fetchTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @ApiParam(value = "Unique ticket identifier") @PathParam("id") String id); @@ -74,7 +74,7 @@ public interface TicketManagement { @ApiResponses(value = { @ApiResponse(code = 200, message = "Ticket Created. Ticket Id returned.", response = TicketData.class), - @ApiResponse(code = 400, message = "Bad request.", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request.", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response createTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @ApiParam(value = "Data for creating a ticket") TicketData ticketData); @@ -85,7 +85,7 @@ public interface TicketManagement { @Produces({MediaType.APPLICATION_JSON}) @ApiOperation(value = "Update Ticket", notes = "Updates a ticket to the passed data") @ApiResponses(value = {@ApiResponse(code = 204, message = "Ticket Updated."), - @ApiResponse(code = 400, message = "Bad request.", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request.", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response updateTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @ApiParam(value = "Data for updating a ticket") TicketData ticketData); @@ -96,8 +96,8 @@ public interface TicketManagement { @Produces({MediaType.APPLICATION_JSON}) @ApiOperation(value = "Cancel the ticket", notes = "Cancels the ticket.") @ApiResponses(value = {@ApiResponse(code = 204, message = "Delete successful"), - @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class), - @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class), + @ApiResponse(code = 404, message = "No record found", response = CmsoRequestError.class), + @ApiResponse(code = 400, message = "Bad request", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response deleteScheduleRequest( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, @@ -113,7 +113,7 @@ public interface TicketManagement { @ApiOperation(value = "Search Tickets", notes = "Returns a list of based upon the filter criteria.", response = TicketData.class, responseContainer = "List") @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), - @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class), + @ApiResponse(code = 400, message = "Bad request", response = CmsoRequestError.class), @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) public Response searchTcikets( @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion, |