Package com.netflix.zuul.context

Examples of com.netflix.zuul.context.RequestContext$UnitTest


        }
    }

    HttpResponse forward() throws Exception {

        RequestContext context = RequestContext.getCurrentContext();


        HttpRequest.Builder builder = HttpRequest.newBuilder().
                verb(verb).
                uri(uri).
                entity(requestEntity);

        for (String name : headers.keySet()) {
            List<String> values = headers.get(name);
            for (String value : values) {
                builder.header(name, value);
            }
        }

        for (String name : params.keySet()) {
            List<String> values = params.get(name);
            for (String value : values) {
                builder.queryParams(name, value);
            }
        }

        HttpRequest httpClientRequest = builder.build();

        HttpResponse response = restClient.executeWithLoadBalancer(httpClientRequest);
        context.set("ribbonResponse", response);
        return response;
    }
View Full Code Here


     * @return the return value for that filter
     * @throws ZuulException
     */
    public Object processZuulFilter(ZuulFilter filter) throws ZuulException {

        RequestContext ctx = RequestContext.getCurrentContext();
        boolean bDebug = ctx.debugRouting();
        final String metricPrefix = "zuul.filter-";
        long execTime = 0;
        String filterName = "";
        try {
            long ltime = System.currentTimeMillis();
            filterName = filter.getClass().getSimpleName();
           
            RequestContext copy = null;
            Object o = null;
            Throwable t = null;

            if (bDebug) {
                Debug.addRoutingDebug("Filter " + filter.filterType() + " " + filter.filterOrder() + " " + filterName);
View Full Code Here

        try {
            init((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse);

            // Marks this request as having passed through the "Zuul engine", as opposed to servlets
            // explicitly bound in web.xml, for which requests will not have the same data attached
            RequestContext context = RequestContext.getCurrentContext();
            context.setZuulEngineRan();

            try {
                preRoute();
            } catch (ZuulException e) {
                error(e);
View Full Code Here

        @Test
        public void testProcessZuulFilter() {

            ZuulServlet zuulServlet = new ZuulServlet();
            zuulServlet = spy(zuulServlet);
            RequestContext context = spy(RequestContext.getCurrentContext());


            try {
                FilterProcessor.setProcessor(processor);
                RequestContext.testSetCurrentContext(context);
View Full Code Here

        @Test
        public void testProcessZuulFilter() {

            ZuulRunner runner = new ZuulRunner();
            runner = spy(runner);
            RequestContext context = spy(RequestContext.getCurrentContext());

            try {
                FilterProcessor.setProcessor(processor);
                RequestContext.testSetCurrentContext(context);
                when(servletResponse.getWriter()).thenReturn(writer);
View Full Code Here

            build.setSourceDirectory( v3Build.getSourceDirectory() );
            build.setTestSourceDirectory( v3Build.getUnitTestSourceDirectory() );

            build.setResources( translateResources( v3Build.getResources() ) );

            UnitTest unitTest = v3Build.getUnitTest();
            if ( unitTest != null )
            {
                build.setTestResources( translateResources( unitTest.getResources() ) );

                List testIncludes = unitTest.getIncludes();

                List testExcludes = new ArrayList( unitTest.getExcludes() );

                if ( notEmpty( testIncludes ) || notEmpty( testExcludes ) )
                {
                    Plugin plugin = new Plugin();
                    plugin.setGroupId( "org.apache.maven.plugins" );
View Full Code Here

            build.setSourceDirectory( v3Build.getSourceDirectory() );
            build.setTestSourceDirectory( v3Build.getUnitTestSourceDirectory() );

            build.setResources( translateResources( v3Build.getResources() ) );

            UnitTest unitTest = v3Build.getUnitTest();
            if ( unitTest != null )
            {
                build.setTestResources( translateResources( unitTest.getResources() ) );

                List testIncludes = unitTest.getIncludes();

                List testExcludes = new ArrayList( unitTest.getExcludes() );

                if ( notEmpty( testIncludes ) || notEmpty( testExcludes ) )
                {
                    Plugin plugin = new Plugin();
                    plugin.setGroupId( "org.apache.maven.plugins" );
View Full Code Here

TOP

Related Classes of com.netflix.zuul.context.RequestContext$UnitTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.