Java Code Examples for com.netflix.zuul.context.RequestContext#clear()

The following examples show how to use com.netflix.zuul.context.RequestContext#clear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PageRedirectionFilterTest.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@BeforeEach
public void setUp() {
    discoveryClient = mock(DiscoveryClient.class);

    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.clear();
    ctx.set(SERVICE_ID_KEY, SERVICE_ID);
    MockHttpServletRequest request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
    ctx.setRequest(request);
    ctx.setResponse(response);

    GatewayConfigProperties gatewayConfigProperties = getGatewayConfigProperties(ctx);

    this.filter = new PageRedirectionFilter(this.discoveryClient, gatewayConfigProperties);
}
 
Example 2
Source File: LocationFilterTest.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@BeforeEach
public void setUp() {
    this.filter = new LocationFilter();
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.clear();
    ctx.set(REQUEST_URI_KEY, "/path");
    ctx.set(PROXY_KEY, "api/v1/service");
    ctx.set(SERVICE_ID_KEY, "service");
    RoutedServices routedServices = new RoutedServices();
    routedServices.addRoutedService(
        new RoutedService("testv1", "ui/r4", "/service/r1"));
    routedServices.addRoutedService(
        new RoutedService("testv4", "api/v2", "/service/v2"));
    routedServices.addRoutedService(
        new RoutedService("testv2", "test", "/service/test1"));
    routedServices.addRoutedService(
        new RoutedService("testv3", "api/v1", "/service/v1"));
    this.filter.addRoutedServices("service", routedServices);
}
 
Example 3
Source File: EncodedCharactersFilterTest.java    From api-layer with Eclipse Public License 2.0 5 votes vote down vote up
@BeforeEach
public void setup() {
    filter = new EncodedCharactersFilter(discoveryClient, messageService);
    serviceInstanceWithConfiguration.getMetadata().put(METADATA_KEY, "true");
    serviceInstanceWithoutConfiguration.getMetadata().put(METADATA_KEY, "false");
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.clear();
    ctx.set(PROXY_KEY, "api/v1/" + SERVICE_ID);
    ctx.set(SERVICE_ID_KEY, SERVICE_ID);
    ctx.setResponse(new MockHttpServletResponse());
}
 
Example 4
Source File: SlashFilterTest.java    From api-layer with Eclipse Public License 2.0 5 votes vote down vote up
@BeforeEach
public void setUp() throws Exception {
    this.filter = new SlashFilter();
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.clear();
    ctx.set(PROXY_KEY, "ui/service");
    ctx.set(SERVICE_ID_KEY, "service");
    ctx.setResponse(new MockHttpServletResponse());
    MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setRequestURI("/ui/service");
    ctx.setRequest(mockRequest);
}