From a83fa219608559e1c9a82e4cfc5a345d6c3ec636 Mon Sep 17 00:00:00 2001 From: "Boslet, Cory" Date: Mon, 26 Aug 2019 10:09:09 -0400 Subject: Added default value for when ErrorCode is null in Added default value for when ErrorCode is null in mdc test to see if 404 log gets enhanced by change. Removed test id from class that was put to test via docker. Removed setting of partner name and tested with using try/catch Reverted change to request uri filter per comments Removed the request filter uri class that rerouted old uri orders Removed request filter from jersey config files Updated junit test that were pointing to the old uri to be failure test corrected formatting issues on ServiceInstancesTest Issue-ID: SO-2259 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Id8f9daef139a82ee9e934d4d37906ffb7a7aadff --- .../so/apihandler/filters/RequestUriFilter.java | 61 ---------------------- .../so/apihandlerinfra/JerseyConfiguration.java | 6 +-- 2 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java (limited to 'mso-api-handlers/mso-api-handler-infra/src/main') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java deleted file mode 100644 index a3ff1ab95d..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandler.filters; - -import java.io.IOException; -import java.net.URI; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.PreMatching; -import javax.ws.rs.core.UriInfo; -import org.onap.so.apihandlerinfra.Constants; - - -@PreMatching -public class RequestUriFilter implements ContainerRequestFilter { - - private String requestURI; - - @Override - public void filter(ContainerRequestContext context) throws IOException { - UriInfo uriInfo = context.getUriInfo(); - URI baseURI = uriInfo.getBaseUri(); - requestURI = uriInfo.getPath(); - - if (requestURI.contains("onap/so/infra/serviceInstances")) { - requestURI = requestURI.replaceFirst("serviceInstances", "serviceInstantiation"); - if (!requestURI.contains(Constants.SERVICE_INSTANCE_PATH)) { - // Adds /serviceInstances after the version provided in the URI - requestURI = new StringBuilder(requestURI) - .insert(requestURI.indexOf(Constants.SERVICE_INSTANTIATION_PATH) + 24, - Constants.SERVICE_INSTANCE_PATH) - .toString(); - } - requestURI = baseURI + requestURI; - URI uri = URI.create(requestURI); - context.setRequestUri(uri); - } - } - - public String getRequestUri() { - return requestURI; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java index 00d36b3ff9..e162a67680 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java @@ -7,9 +7,9 @@ * 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. @@ -25,7 +25,6 @@ import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; import org.onap.so.apihandler.filters.RequestIdFilter; -import org.onap.so.apihandler.filters.RequestUriFilter; import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper; import org.onap.so.apihandlerinfra.infra.rest.Network; import org.onap.so.apihandlerinfra.infra.rest.ServiceInstance; @@ -72,7 +71,6 @@ public class JerseyConfiguration extends ResourceConfig { register(SwaggerSerializers.class); register(ApiExceptionMapper.class); register(RuntimeExceptionMapper.class); - register(RequestUriFilter.class); register(RequestIdFilter.class); register(E2EServiceInstances.class); register(WorkflowSpecificationsHandler.class); -- cgit 1.2.3-korg