Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A413210EAC for ; Tue, 5 Nov 2013 14:42:51 +0000 (UTC) Received: (qmail 93800 invoked by uid 500); 5 Nov 2013 14:42:42 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 93761 invoked by uid 500); 5 Nov 2013 14:42:41 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 93754 invoked by uid 99); 5 Nov 2013 14:42:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Nov 2013 14:42:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Nov 2013 14:42:38 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CBBC923888E7; Tue, 5 Nov 2013 14:42:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1539011 - /sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java Date: Tue, 05 Nov 2013 14:42:16 -0000 To: commits@sling.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131105144216.CBBC923888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bdelacretaz Date: Tue Nov 5 14:42:16 2013 New Revision: 1539011 URL: http://svn.apache.org/r1539011 Log: Make more utility methods public, for reuse in JUnit4-style tests Modified: sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java Modified: sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java?rev=1539011&r1=1539010&r2=1539011&view=diff ============================================================================== --- sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java (original) +++ sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java Tue Nov 5 14:42:16 2013 @@ -102,7 +102,7 @@ public class HttpTestBase extends TestCa } }; - protected static String removeEndingSlash(String str) { + public static String removeEndingSlash(String str) { if(str != null && str.endsWith("/")) { return str.substring(0, str.length() - 1); } @@ -157,7 +157,7 @@ public class HttpTestBase extends TestCa /** * Generate default credentials used for HTTP requests. */ - protected Credentials getDefaultCredentials() { + public Credentials getDefaultCredentials() { return new UsernamePasswordCredentials("admin", "admin"); } @@ -286,7 +286,7 @@ public class HttpTestBase extends TestCa /** Verify that given URL returns expectedStatusCode * @return the HttpMethod executed * @throws IOException */ - protected HttpMethod assertHttpStatus(String urlString, int expectedStatusCode, String assertMessage) throws IOException { + public HttpMethod assertHttpStatus(String urlString, int expectedStatusCode, String assertMessage) throws IOException { final GetMethod get = new GetMethod(urlString); final int status = httpClient.executeMethod(get); if(assertMessage == null) { @@ -300,14 +300,14 @@ public class HttpTestBase extends TestCa /** Verify that given URL returns expectedStatusCode * @return the HttpMethod executed * @throws IOException */ - protected HttpMethod assertHttpStatus(String urlString, int expectedStatusCode) throws IOException { + public HttpMethod assertHttpStatus(String urlString, int expectedStatusCode) throws IOException { return assertHttpStatus(urlString, expectedStatusCode, null); } /** Execute a POST request and check status * @return the HttpMethod executed * @throws IOException */ - protected HttpMethod assertPostStatus(String url, int expectedStatusCode, List postParams, String assertMessage) + public HttpMethod assertPostStatus(String url, int expectedStatusCode, List postParams, String assertMessage) throws IOException { final PostMethod post = new PostMethod(url); post.setFollowRedirects(false); @@ -411,12 +411,12 @@ public class HttpTestBase extends TestCa } /** Upload script, execute with no parameters and return content */ - protected String executeScript(String localFilename) throws Exception { + public String executeScript(String localFilename) throws Exception { return executeScript(localFilename, null); } /** Upload script, execute with given parameters (optional) and return content */ - protected String executeScript(String localFilename, List params) throws Exception { + public String executeScript(String localFilename, List params) throws Exception { // Use unique resource type int counter = 0; @@ -448,12 +448,12 @@ public class HttpTestBase extends TestCa } } - protected void assertJavascript(String expectedOutput, String jsonData, String code) throws IOException { + public void assertJavascript(String expectedOutput, String jsonData, String code) throws IOException { assertJavascript(expectedOutput, jsonData, code, null); } /** Evaluate given code using given jsonData as the "data" object */ - protected void assertJavascript(String expectedOutput, String jsonData, String code, String testInfo) throws IOException { + public void assertJavascript(String expectedOutput, String jsonData, String code, String testInfo) throws IOException { final String result = javascriptEngine.execute(code, jsonData); if(!result.equals(expectedOutput)) { fail(