Package com.volantis.shared.net.http

Examples of com.volantis.shared.net.http.HTTPMessageEntities


     *
     * @return The HTTPMessageEntities from the XMLPipelineContext for the
     *         entity.
     */
    protected HTTPMessageEntities getEntities(XMLPipelineContext context) {
        HTTPMessageEntities entities = (HTTPMessageEntities)
                context.getProperty(entityCollectionKey);
        if (entities == null) {
            entities = factory.createHTTPMessageEntities();
            context.setProperty(entityCollectionKey, entities, false);
        }
View Full Code Here


        // sleep for 1.2 seconds. This should give an age of 1 second due to
        // the conservative nature of the age calculation. This will be added
        // to the age header in the response
        Thread.sleep(1200);
        HTTPMessageEntities headers = resp.getHeaders();
        HTTPMessageEntity[] ages = headers.retrieve(AGE_HEADER);

        assertNotNull("There should be an age header", ages);
        // check that we have calcualted the age to the page to be 1 second
        // (its always rounded down)
        assertEquals("Age should be 3 second", 3,
View Full Code Here

                                HTTPRequestType.GET, null);

        // sleep for 1.2 seconds. This should give an age of 1 second due to
        // the conservative nature of the age calculation.
        Thread.sleep(1200);
        HTTPMessageEntities headers = resp.getHeaders();
        HTTPMessageEntity[] ages = headers.retrieve(AGE_HEADER);

        // check that we have calcualted the age to the page to be about 1
        // second (its always rounded down)
        int age = Integer.parseInt(ages[0].getValue());
        assertTrue("Age should be greater then 0 and less then 2",
View Full Code Here

            WebDriverAccessor accessor = createWebDriverAccessor();

            // register the parameters that this test requires with the
            // WebDriverRequest
            WebDriverRequest request = accessor.getRequest(context);
            HTTPMessageEntities parameters =
                    HTTPFactory.getDefaultInstance().
                    createHTTPMessageEntities();
            RequestParameter parameter1 = new RequestParameterImpl("name");
            parameter1.setValue("fred");
            RequestParameter parameter2 = new RequestParameterImpl("request2");
            parameter2.setValue("jane");
            parameters.add(parameter1);
            parameters.add(parameter2);
            request.setRequestParameters(parameters);

            context.setProperty(WebDriverAccessor.class, accessor, false);

            doInContextTest(context,
View Full Code Here

            WebDriverAccessor accessor = createWebDriverAccessor();
            // register the parameters that this test requires with the
            // WebDriverRequest
            WebDriverRequest request = accessor.getRequest(context);

            HTTPMessageEntities headers =
                    HTTPFactory.getDefaultInstance().
                    createHTTPMessageEntities();
            Header header1 = new HeaderImpl("name");
            header1.setValue("fred");
            Header header2 = new HeaderImpl("request2");
            header2.setValue("jane");
            headers.add(header1);
            headers.add(header2);
            request.setHeaders(headers);

            context.setProperty(WebDriverAccessor.class, accessor, false);

            doInContextTest(context,
View Full Code Here

    private void assertSingleHeader(
            WebDriverResponse response,
                                    String expectedName,
                                    String expectedValue) {

        HTTPMessageEntities headers = response.getHeaders();
        Header expected =
                HTTPFactory.getDefaultInstance().createHeader(expectedName);

        Header[] headerArray = (Header[]) headers.retrieve(
                expected.getIdentity());

        assertNotNull("Should be a " + expectedName + " header", headerArray);
        assertEquals("Should only be a single " + expectedName + " header",
                     1,
View Full Code Here

    private void assertMultipleHeader(
            WebDriverResponse response,
                                      String expectedName,
                                      List expectedValues) {

        HTTPMessageEntities headers = response.getHeaders();
        int expectedCount = expectedValues.size();

        Header expected = HTTPFactory.getDefaultInstance().createHeader(
                expectedName);
        Header[] headerArray = (Header[]) headers.retrieve(
                expected.getIdentity());

        assertNotNull("Should be " + expectedName + " headers", headerArray);
        assertEquals("Should only be " + expectedCount + " " + expectedName +
                     " headers",
View Full Code Here

     */
    private void assertSingleCookie(
            WebDriverResponse response,
                                    Cookie expected) {

        HTTPMessageEntities cookies = response.getCookies();
        Cookie[] cookieArray = (Cookie[]) cookies.retrieve(
                expected.getIdentity());

        assertNotNull("Should be a " + expected.getName() + " cookie",
                      cookieArray);
        assertEquals("Should only be a single " + expected.getName() +
View Full Code Here

    private void assertMultipleCookies(
            WebDriverResponse response,
                                       String expectedName,
                                       List expectedCookies) {

        HTTPMessageEntities cookies = response.getCookies();
        // the multiple cookies should have the same identity
        Cookie cookie = (Cookie) expectedCookies.get(0);
        CookieIdentity expectedIdentity = (CookieIdentity) cookie.getIdentity();

        int expectedCount = expectedCookies.size();
        Cookie[] cookieArray = (Cookie[]) cookies.retrieve(expectedIdentity);

        assertNotNull("Should be " + expectedName + " cookies", cookieArray);
        assertEquals("Should only be " + expectedCount + " " + expectedName +
                     " cookies",
                     expectedCount,
View Full Code Here

        return new SimpleHTTPMessageEntities();
    }

    // javadoc inherited
    public HTTPMessageEntities createCookies(HttpServletRequest request) {
        HTTPMessageEntities cookies = createCookies();
        javax.servlet.http.Cookie requestCookies[] = request.getCookies();
        if (cookies != null) {
            for (int i = 0; i < requestCookies.length; i++) {
                cookies.add(new HTTPServletCookie(requestCookies[i]));
            }
        }
        return cookies;
    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.net.http.HTTPMessageEntities

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.