diff options
author | Eran (ev672n), Vosk <ev672n@att.com> | 2018-08-07 14:15:05 +0300 |
---|---|---|
committer | Eran (ev672n), Vosk <ev672n@att.com> | 2018-08-07 14:15:05 +0300 |
commit | b9708a7c3cfaf5767992a2b15180e7b85c459242 (patch) | |
tree | 076e19ea52232232e9060a9d7e074947a4a49508 /src/test | |
parent | cc32bd38d72e5c1c92048657083952d3e45c1819 (diff) |
adding the dcae dt code
Adding DCAE-dt code
Change-Id: Id6b779db9d24e10825fb97ad5fd46f41e65e6738
Issue-ID: SDC-1614
Signed-off-by: Eran (ev672n), Vosk <ev672n@att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java b/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java new file mode 100644 index 0000000..94cb2c0 --- /dev/null +++ b/src/test/org/onap/sdc/dcae/controller/proxy/DcaeProxyTest.java @@ -0,0 +1,29 @@ +package org.onap.sdc.dcae.controller.proxy; + +import org.junit.Test; +import org.mockito.Mockito; + +import javax.servlet.http.HttpServletRequest; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + + +//TODO headers and cookies test (API) +public class DcaeProxyTest { + + private static final String BEHOST = "https://host.xxx.yyy:8443"; + private DcaeProxy proxy = new DcaeProxy(BEHOST); + private final static HttpServletRequest servletRequest = Mockito.mock(HttpServletRequest.class); + + + @Test + public void testRewriteUrlWithQueryParams(){ + String requestUrl = "/dcae/dcaeProxy/someBeApi?%20x=1&y=2"; + String expectedUrl = BEHOST + "/dcae/someBeApi?%20x=1&y=2"; + when(servletRequest.getRequestURI()).thenReturn(requestUrl); + String target = proxy.rewriteTarget(servletRequest); + assertTrue(target.equals(expectedUrl)); + } + +} |