From 548c5a220333c7cd666b861e737bff0b45461f18 Mon Sep 17 00:00:00 2001 From: "Stone, Avi (as206k)" Date: Sun, 3 Jun 2018 13:12:12 +0300 Subject: Update FE project Update FE to latest version so that fe can run on docker Change-Id: I9c5dee756b567dbe64fac6d3d6fd89362813bdcc Issue-ID: SDC-1359 Signed-off-by: Stone, Avi (as206k) --- .../java/org/onap/sdc/dcae/controller/proxy/DcaeProxy.java | 10 ++++++---- src/main/webapp/WEB-INF/config/dcae-fe/application.properties | 4 +++- src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/sdc/dcae/controller/proxy/DcaeProxy.java b/src/main/java/org/onap/sdc/dcae/controller/proxy/DcaeProxy.java index 84b6918..4900f27 100644 --- a/src/main/java/org/onap/sdc/dcae/controller/proxy/DcaeProxy.java +++ b/src/main/java/org/onap/sdc/dcae/controller/proxy/DcaeProxy.java @@ -43,14 +43,16 @@ public class DcaeProxy extends ProxyServlet { log.error("Unexpected FE request logging error :", e); } String uri = request.getRequestURI(); - uri = uri.replace("/dcaeProxy", ""); + uri = uri.replaceFirst("/dcaed", "/dcae"); // replacing the new FE context (/dcaed) with BE context (/dcae) + uri = uri.replace("/dcaeProxy", ""); // removing the proxy from the request String query = request.getQueryString(); StringBuilder url = new StringBuilder(); url.append(beHostUrl).append(uri); - if(null != query) - url.append("?").append(query); + if(null != query){ + url.append("?").append(query); // restoring all query params if tsuch exists + } String urlString = url.toString(); - log.info("Proxy outgoing request={}", urlString); + log.info("New FE Proxy outgoing request={}", urlString); return urlString; } diff --git a/src/main/webapp/WEB-INF/config/dcae-fe/application.properties b/src/main/webapp/WEB-INF/config/dcae-fe/application.properties index a018abb..37b5a2d 100644 --- a/src/main/webapp/WEB-INF/config/dcae-fe/application.properties +++ b/src/main/webapp/WEB-INF/config/dcae-fe/application.properties @@ -1,3 +1,5 @@ server.port=8181 -server.context-path=/dcae +# this is the context path in which the dcae_fe is exposed: +server.context-path=/dcaed +# this is the dcae-d be url which the dcaeProxy in the FE is delegating the request to beUrl=https://zldcrdm2sdc2abe01.3f1a87.rdm2.tci.att.com:8443 diff --git a/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java b/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java index 94cb2c0..13b9c78 100644 --- a/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java +++ b/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java @@ -19,8 +19,8 @@ public class DcaeProxyTest { @Test public void testRewriteUrlWithQueryParams(){ - String requestUrl = "/dcae/dcaeProxy/someBeApi?%20x=1&y=2"; - String expectedUrl = BEHOST + "/dcae/someBeApi?%20x=1&y=2"; + String requestUrl = "/dcaed/dcaeProxy/someBeApi?%20x=1&y=2"; + String expectedUrl = BEHOST + "/dcaed/someBeApi?%20x=1&y=2"; when(servletRequest.getRequestURI()).thenReturn(requestUrl); String target = proxy.rewriteTarget(servletRequest); assertTrue(target.equals(expectedUrl)); -- cgit