Package com.volantis.xml.pipeline.sax.drivers.web

Examples of com.volantis.xml.pipeline.sax.drivers.web.HTTPResponseAccessor


        if (params != null) {
            url = url + params;
        }
        HTTPRequestExecutor request = testInstance.createHTTPRequestExecutor(
            url, type, HTTPVersion.HTTP_1_1, null, null);
        HTTPResponseAccessor result = request.execute();
        request.release();

        return result;
    }
View Full Code Here


            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor respA =
                performRequest(manager, fakeResponse,
                                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. This will be added
        // to the age header in the response and should exceed the timeout
        // set for this cached entry.
        Thread.sleep(1200);
        HTTPResponseAccessor respB =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        assertTrue("The content should be the same",
            equals(respA.getResponseStream(), respB.getResponseStream()));
        assertFalse("The server used up all of the transactions.",
            serverMock.hasTransactions());
    }
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                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. 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)
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor respA =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        // sleep for 2.2 seconds. This should give an age of 1 second due to
        // the conservative nature of the age calculation. (and the fact that the
        // creation date is 1 second in the future
        Thread.sleep(2200);
        HTTPResponseAccessor respB =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        assertTrue("The content should be the same",
            equals(respA.getResponseStream(), respB.getResponseStream()));
        assertFalse("The server used up all of the transactions.",
            serverMock.hasTransactions());
    }
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                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());
View Full Code Here

            "<BODY>",
            "<H1>Fake response</H1>"
        };

        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        HTTPResponseAccessor resp2 =
                performRequest(manager, null,
                                HTTPRequestType.GET, null);

        assertTrue(
            "Accessors should be equal as they should both be from the cache",
            equals(resp.getResponseStream(), resp2.getResponseStream()));
    }
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        Thread.sleep(3000);   // wait three seconds so that max-age expires.
        HTTPResponseAccessor resp2 =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        assertTrue("The content should be the same",
            equals(resp.getResponseStream(), resp2.getResponseStream()));
        assertFalse("The server used up all of the transactions.",
            serverMock.hasTransactions());
    }
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        //   Thread.sleep(1000);   // wait one second
        HTTPResponseAccessor resp2 =
                performRequest(manager, null,
                                HTTPRequestType.GET, null);

        assertTrue(
            "Accessors should be equal as they should both be from the cache",
            equals(resp.getResponseStream(), resp2.getResponseStream()));
    }
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        HTTPResponseAccessor resp2 =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.GET, null);

        assertTrue("The content should be the same",
            equals(resp.getResponseStream(), resp2.getResponseStream()));
        assertFalse("The server used up all of the transactions.",
            serverMock.hasTransactions());
    }
View Full Code Here

            "</HEAD>",
            "<BODY>",
            "<H1>Fake response</H1>"
        };
        AbstractPluggableHTTPManager manager = createTestInstance();
        HTTPResponseAccessor resp =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.POST, null);

        HTTPResponseAccessor resp2 =
                performRequest(manager, fakeResponse,
                                HTTPRequestType.POST, null);

        assertTrue("The content should be the same",
            equals(resp.getResponseStream(), resp2.getResponseStream()));
        assertFalse("The server used up all of the transactions.",
            serverMock.hasTransactions());
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.pipeline.sax.drivers.web.HTTPResponseAccessor

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.