Package org.geoserver.ows

Examples of org.geoserver.ows.Request


        if (env != null)
            kvp.put("BBOX", env);
        if (srsName != null)
            kvp.put("SRS", srsName);

        Request owsRequest = EasyMock.createMock(Request.class);
        EasyMock.expect(owsRequest.getService()).andReturn("wms").anyTimes();
        EasyMock.expect(owsRequest.getRequest()).andReturn(requestName).anyTimes();
        EasyMock.expect(owsRequest.getKvp()).andReturn(kvp).anyTimes();
        EasyMock.replay(owsRequest);
        Dispatcher.REQUEST.set(owsRequest);
    }
View Full Code Here


   
    public void testConcurrentRequestsSingleUser() {
        // a cookie based flow controller that will allow just one request at a time
        UserFlowController controller = new UserFlowController(1);
       
        Request firstRequest = buildRequest(null);
        FlowControllerTestingThread tSample = new FlowControllerTestingThread(controller, firstRequest,
                0, 0);
        tSample.start();
        waitTerminated(tSample, MAX_WAIT);
       
        Cookie cookie = (Cookie) ((MockHttpServletResponse) firstRequest.getHttpResponse()).getCookies().get(0);
        String cookieValue = cookie.getValue();
       
        // make three testing threads that will "process" forever, and will use the cookie to identify themselves
        // as the same client, until we interrupt them
        FlowControllerTestingThread t1 = new FlowControllerTestingThread(controller, buildRequest(cookieValue),
View Full Code Here

        }
       
    }
   
    Request buildRequest(String gsCookieValue) {
        Request request = new Request();
        MockHttpServletRequest httpRequest = new MockHttpServletRequest();
        request.setHttpRequest(httpRequest);
        request.setHttpResponse(new MockHttpServletResponse());
       
        if(gsCookieValue != null) {
            httpRequest.addCookie(new Cookie(UserFlowController.COOKIE_NAME, gsCookieValue));
        }
        return request;
View Full Code Here

        assertFalse(controller.matchesRequest(buildRequest("WMS", "GETMAP", "application/pdf")));
        assertFalse(controller.matchesRequest(buildRequest("WMS", "GetFeatureInfo", "image/png")));
    }

    Request buildRequest(String service, String request, String outputFormat) {
        Request r = new Request();
        r.setService(service);
        r.setRequest(request);
        r.setOutputFormat(outputFormat);

        return r;
    }
View Full Code Here

    public void testSingleDelay() throws Exception {
        // create a single item flow controller
        GlobalFlowController controller = new GlobalFlowController(1);

        // make three testing threads that will "process" forever, until we interrupt them
        FlowControllerTestingThread t1 = new FlowControllerTestingThread(controller, new Request(),
                0, Long.MAX_VALUE);
        FlowControllerTestingThread t2 = new FlowControllerTestingThread(controller, new Request(),
                0, Long.MAX_VALUE);
        FlowControllerTestingThread t3 = new FlowControllerTestingThread(controller, new Request(),
                0, Long.MAX_VALUE);
        try {
            // start threads making sure every one of them managed to block somewhere before
            // starting the next one
            t1.start();
View Full Code Here

        // create a single item flow controller
        GlobalFlowController controller = new GlobalFlowController(1);

        // make two testing threads that will "process" for 400ms, but with a timeout of 200 on the
        // flow controller
        FlowControllerTestingThread t1 = new FlowControllerTestingThread(controller, new Request(),
                100, 400);
        FlowControllerTestingThread t2 = new FlowControllerTestingThread(controller, new Request(),
                100, 400);
       
        // start t1 first, let go t2 after
        try {
            t1.start();
View Full Code Here

            // if in hide mode, we just hide the resource
            if (accessManager.getMode() == CatalogMode.HIDE) {
                return WrapperPolicy.HIDE;
            } else if (accessManager.getMode() == CatalogMode.MIXED) {
                // if request is a get capabilities and mixed, we hide again
                Request request = Dispatcher.REQUEST.get();
                if(request != null && "GetCapabilities".equalsIgnoreCase(request.getRequest()))
                    return WrapperPolicy.HIDE;
                // otherwise challenge the user for credentials
                else
                    throw unauthorizedAccess(resourceName);
            } else {
View Full Code Here

        DataAccessManager manager = buildManager("lockedDownMixed.properties");
        SecureCatalogImpl sc = new SecureCatalogImpl(catalog, manager);

        // try with read only user and GetFeatures request
        SecurityContextHolder.getContext().setAuthentication(roUser);
        Request request = org.easymock.classextension.EasyMock.createNiceMock(Request.class);
        org.easymock.classextension.EasyMock.expect(request.getRequest()).andReturn("GetFeatures").anyTimes();
        org.easymock.classextension.EasyMock.replay(request);
        Dispatcher.REQUEST.set(request);

        // check a direct access does trigger a security challenge
        try {
            sc.getFeatureTypeByName("topp:states");
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getCoverageByName("nurc:arcgrid");
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getResourceByName("topp:states", FeatureTypeInfo.class);
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getResourceByName("nurc:arcgrid", CoverageInfo.class);
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getWorkspaceByName("topp");
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getDataStoreByName("states");
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getDataStoreByName("roads");
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
        try {
            sc.getCoverageStoreByName("arcGrid");
            fail("Should have failed with a security exception");
        } catch(AcegiSecurityException e) {
            //
        }
       
        // try with a getCapabilities, make sure the lists are empty
        request = org.easymock.classextension.EasyMock.createNiceMock(Request.class);
        org.easymock.classextension.EasyMock.expect(request.getRequest()).andReturn("GetCapabilities").anyTimes();
        org.easymock.classextension.EasyMock.replay(request);
        Dispatcher.REQUEST.set(request);
       
        // check the lists used to build capabilities are empty
        assertEquals(0, sc.getFeatureTypes().size());
View Full Code Here

       
        ControlFlowCallbackProxy proxy = new ControlFlowCallbackProxy(monitor, callback);
        callback = (DispatcherCallback) Proxy.newProxyInstance(getClass().getClassLoader(),
                new Class[]{DispatcherCallback.class}, proxy);
       
        callback.operationDispatched(new Request(),
            new Operation("foo", new Service("bar", null, null, null), null, null));
       
        assertEquals(Status.RUNNING, data.getStatus());
    }
View Full Code Here

        monitor.complete();
    }
   
    @Test
    public void testBasic() throws Exception {
        callback.operationDispatched(new Request(), op("foo", "bar", "1.2.3", null));
       
        assertEquals("BAR", data.getOwsService());
        assertEquals("foo", data.getOwsOperation());
        assertEquals("1.2.3", data.getOwsVersion());
    }
View Full Code Here

TOP

Related Classes of org.geoserver.ows.Request

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.