Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet.releaseConnection()


    private void assertNoCacheRequest(String inputUrl, String expectedRedirect) throws Exception {
        HttpGet get = obtainGetMethod(inputUrl, false);
        HttpResponse response = perform(get);
        EntityUtils.consume(response.getEntity());
        get.releaseConnection();

        assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, getStatusCode(response));
        assertEquals(expectedRedirect, response.getFirstHeader(HttpHeaders.LOCATION).getValue());
        assertEquals("no-cache, no-store", response.getFirstHeader(HttpHeaders.CACHE_CONTROL).getValue());
        assertEquals("no-cache", response.getFirstHeader(HttpHeaders.PRAGMA).getValue());
View Full Code Here


        assertEquals(HttpStatus.SC_OK, getStatusCode(response));
        String responseText = getResponseBody(response);
        assertTrue("Expected tag error in: " + responseText,
                responseText.contains("Invalid request, tag must not be empty"));
        get.releaseConnection();
    }

    public void testHTMLTemplateCaching() throws Exception {
        // An application with isOnePageApp set to true
        DefDescriptor<ApplicationDef> desc = addSourceAutoCleanup(ApplicationDef.class,
View Full Code Here

        // We show all of the related dates/strings to help with debugging.
        //
        assertTrue(String.format("Expires header is earlier than expected. Expected !before %s, got %s (%s).",
                expected, expires, expiresHdr), !expires.before(expected));

        get.releaseConnection();
    }

    /**
     * Submit a request and check that the 'no cache' is set correctly.
     *
 
View Full Code Here

        //
        assertTrue(String.format("Expires header should be in the past. Expected before %s, got %s (%s).",
                expected, expires, expiresHdr), expires.before(expected));

        EntityUtils.consume(response.getEntity());
        get.releaseConnection();
    }

    /** Runs a test with special CSP */
    private Header[] doSpecialCspTest(String expectCspAncestors, String... ancestors) throws Exception {
        ContentSecurityPolicy mockCsp = new MockCsp(ancestors);
View Full Code Here

        String scriptTag = String.format("<script src=\"%s\" ></script>", expectedFWUrl);
        assertTrue("Expected Aura FW Script tag not found. Expected to see: " + scriptTag,
                getResponseBody(response).contains(scriptTag));

        assertDefaultAntiClickjacking(response, true, true);
        get.releaseConnection();
    }

    public void testGetUnhandledError() throws Exception {
        DefDescriptor<ApplicationDef> desc = addSourceAutoCleanup(ApplicationDef.class,
                "<aura:application><aura:attribute name='bah'/></aura:application>");
View Full Code Here

        HttpResponse httpResponse = perform(get);
        assertEquals(HttpStatus.SC_OK, getStatusCode(httpResponse));
        String response = getResponseBody(httpResponse);
        assertTrue("Expected null descriptor error message but got: " + response,
                response.contains("descriptor is null"));
        get.releaseConnection();
    }

    /**
     * Verify providing invalid DefDescriptor format to the aura.tag param results in the proper handled Exception and
     * not an AuraUnhandledException, which results in a Gack on SFDC.
View Full Code Here

        String response = getResponseBody(httpResponse);
        assertTrue("Expected 'SystemErrorException: Invalid Descriptor Format' but got: " + response,
                response.contains("SystemErrorException: Invalid Descriptor Format: foo:bar:baz"));
        assertFalse("Invalid aura.tag input should not result in an AuraUnhandledException. " + response,
                response.contains("AuraUnhandledException: Unable to process your request"));
        get.releaseConnection();
    }
}
View Full Code Here

            for (int i = 0; i < 30; i++) {
                try {
                    HttpGet get = obtainGetMethod("/");
                    HttpResponse response = perform(get);
                    status = getStatusCode(response);
                    get.releaseConnection();
                    break;
                } catch (ConnectException ce) {
                    // expected, before server is listening
                    Thread.sleep(1000);
                }
View Full Code Here

    private void verifyDefaultDocument() throws Exception {
        HttpGet get = obtainGetMethod("/");
        HttpResponse httpResponse = perform(get);
        assertEquals("Failed requesting default doc", HttpStatus.SC_OK, getStatusCode(httpResponse));
        String response = getResponseBody(httpResponse).replaceAll("\\s", "");
        get.releaseConnection();
        assertEquals("Unexpected default doc content",
                String.format("<script>window.location=\"/%s/%1$s.app\";</script>", project.artifactId), response);
    }

    private void verifySampleComponents() throws Exception {
View Full Code Here

    private void verifySampleComponents() throws Exception {
        HttpGet get = obtainGetMethod(String.format("/%1$s/%1$s.app", project.artifactId));
        HttpResponse httpResponse = perform(get);
        assertEquals("Failed requesting sample app", HttpStatus.SC_OK, getStatusCode(httpResponse));
        String body = getResponseBody(httpResponse);
        get.releaseConnection();

        goldFileText(body, "-sample.html");
    }

    private Process startProcess(File workingDir, List<String> command) throws Exception {
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.