blob: 94cb2c03e1e236751e0ad3223cecc532600776b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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));
}
}
|