Package org.apache.sling.testing.tools.http

Examples of org.apache.sling.testing.tools.http.RequestBuilder.buildGetRequest()


                    return "Check if MDCTestServlet is up";
                }

                public boolean isTrue() throws Exception {
                    RequestBuilder rb = new RequestBuilder(ServerConfiguration.getServerUrl());
                    executor.execute(rb.buildGetRequest("/mdc")).assertStatus(200);
                    rb = new RequestBuilder(ServerConfiguration.getServerUrl());

                    //Create test config via servlet
                    executor.execute(rb.buildGetRequest("/mdc", "createTestConfig", "true"));
                    TimeUnit.SECONDS.sleep(1);
View Full Code Here


                    RequestBuilder rb = new RequestBuilder(ServerConfiguration.getServerUrl());
                    executor.execute(rb.buildGetRequest("/mdc")).assertStatus(200);
                    rb = new RequestBuilder(ServerConfiguration.getServerUrl());

                    //Create test config via servlet
                    executor.execute(rb.buildGetRequest("/mdc", "createTestConfig", "true"));
                    TimeUnit.SECONDS.sleep(1);
                    return true;
                }
            },5,100);
        }
View Full Code Here

    @Test
    public void testDefault() throws Exception{
        RequestBuilder rb = new RequestBuilder(ServerConfiguration.getServerUrl());
        // Add Sling POST options
        RequestExecutor result = executor.execute(
                rb.buildGetRequest("/mdc","foo","bar"));

        JSONObject jb = new JSONObject(result.getContent());
        assertEquals("/mdc", jb.getString("req.requestURI"));
        assertEquals("foo=bar", jb.getString("req.queryString"));
        assertEquals(ServerConfiguration.getServerUrl() + "/mdc", jb.getString("req.requestURL"));
View Full Code Here

    @Test
    public void testWihCustomData() throws Exception{
        RequestBuilder rb = new RequestBuilder(ServerConfiguration.getServerUrl());

        //Create test config via servlet
        executor.execute(rb.buildGetRequest("/mdc", "createTestConfig", "true"));
        TimeUnit.SECONDS.sleep(1);

        //Pass custom cookie
        BasicClientCookie cookie = new BasicClientCookie("mdc-test-cookie", "foo-test-cookie");
        cookie.setPath("/");
View Full Code Here

        cookie.setDomain("localhost");
        httpClient.getCookieStore().addCookie(cookie);

        //Execute request
        RequestExecutor result = executor.execute(
                rb.buildGetRequest("/mdc", "mdc-test-param", "foo-test-param", "ignored-param", "ignored-value")
                        .withHeader("X-Forwarded-For", "foo-forwarded-for")
                        .withHeader("mdc-test-header", "foo-test-header")
        );

        JSONObject jb = new JSONObject(result.getContent());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.