diff options
author | ilanap <ilanap@amdocs.com> | 2019-11-28 11:13:24 +0200 |
---|---|---|
committer | Oren Kleks <oren.kleks@amdocs.com> | 2019-12-05 09:19:40 +0000 |
commit | ee4c4d72ed2118ea44dd5d83e1cf1677b6ebb03c (patch) | |
tree | a1558696a8576d1e1d1e0665ebefec81398e3be5 /catalog-fe/src/test/java | |
parent | cc8f8c056b99d530d48190b67846be3705a4225f (diff) |
Add Option to proxy to plugins
Added option to proxy the plugins throught the catalog proxy. Remove hardcoded redirect to workflow and added to the plugin configuration.
Issue-ID: SDC-2691
Signed-off-by: ilanap <ilanap@amdocs.com>
Change-Id: Ica479ff00e1a8c281b9280b5495ac022172775c4
Signed-off-by: ilanap <ilanap@amdocs.com>
Diffstat (limited to 'catalog-fe/src/test/java')
-rw-r--r-- | catalog-fe/src/test/java/org/openecomp/sdc/servlets/FeProxyServletTest.java | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/servlets/FeProxyServletTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/servlets/FeProxyServletTest.java index 4915936b1d..81e939b929 100644 --- a/catalog-fe/src/test/java/org/openecomp/sdc/servlets/FeProxyServletTest.java +++ b/catalog-fe/src/test/java/org/openecomp/sdc/servlets/FeProxyServletTest.java @@ -113,7 +113,12 @@ public class FeProxyServletTest { when(plugin.getPluginId()).thenReturn("WORKFLOW"); when(plugin.getPluginSourceUrl()).thenReturn(WF_PROTOCOL + "://" + WF_HOST + ":" + WF_PORT); when(plugin.getPluginDiscoveryUrl()).thenReturn(WF_PROTOCOL + "://" + WF_HOST + ":" + WF_PORT + "/workflows"); + when(plugin.getPluginFeProxyUrl()).thenReturn(WF_PROTOCOL + "://" + WF_HOST + ":" + WF_PORT + "/workflows/wf/"); + when(plugin.getPluginProxyRedirectPath()).thenReturn("/wf/"); pluginList.add(plugin); + PluginsConfiguration.Plugin noConfigPlugin = new PluginsConfiguration.Plugin(); + noConfigPlugin.setPluginId("NO_CONFIG"); + pluginList.add(noConfigPlugin); when(configurationManager.getPluginsConfiguration()).thenReturn(pluginsConfiguration); when(pluginsConfiguration.getPluginsList()).thenReturn(pluginList); @@ -182,17 +187,31 @@ public class FeProxyServletTest { @Test public void testRewriteURIWithWFAPIRequest() { - when(servletRequest.getRequestURI()).thenReturn("/sdc1/feProxy/wf/workflows"); - String requestResourceUrl = "http://localhost:8080/sdc1/feProxy/wf/workflows"; + when(servletRequest.getRequestURI()).thenReturn("/sdc1/feProxy/plugin/wf/workflows"); + String requestResourceUrl = "http://localhost:8080/sdc1/feProxy/plugin/wf/workflows"; String expectedChangedUrl = WF_PROTOCOL + "://" + WF_HOST + ":" + WF_PORT + "/workflows/wf/workflows"; when(servletRequest.getRequestURL()).thenReturn(new StringBuffer(requestResourceUrl)); when(servletRequest.getContextPath()).thenReturn("/sdc1"); - when(servletRequest.getServletPath()).thenReturn("/feProxy/wf/workflows"); + when(servletRequest.getServletPath()).thenReturn("/feProxy/plugin/wf/workflows"); String rewriteURI = feProxy.rewriteTarget(servletRequest); assertEquals(expectedChangedUrl, rewriteURI); + + // now test in case it did not go through the plugin + when(servletRequest.getRequestURI()).thenReturn("/sdc1/feProxy/wf/workflows"); + requestResourceUrl = "http://localhost:8080/sdc1/feProxy/wf/workflows"; + expectedChangedUrl = BE_PROTOCOL + "://" + BE_HOST + ":" + BE_PORT + "/sdc2/wf/workflows"; + when(servletRequest.getRequestURL()).thenReturn(new StringBuffer(requestResourceUrl)); + + when(servletRequest.getContextPath()).thenReturn("/sdc1"); + when(servletRequest.getServletPath()).thenReturn("/feProxy/wf/workflows"); + + rewriteURI = feProxy.rewriteTarget(servletRequest); + + assertEquals(expectedChangedUrl, rewriteURI); + } /** |