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 EA26B9CF9 for ; Tue, 17 Jan 2012 15:45:17 +0000 (UTC) Received: (qmail 16606 invoked by uid 500); 17 Jan 2012 15:45:17 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 16543 invoked by uid 500); 17 Jan 2012 15:45:17 -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 16531 invoked by uid 99); 17 Jan 2012 15:45:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2012 15:45:17 +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, 17 Jan 2012 15:45:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 136B8238890B; Tue, 17 Jan 2012 15:44:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1232446 - in /sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup: ServerSetup.java StartRunnableJarPhase.java Date: Tue, 17 Jan 2012 15:44:52 -0000 To: commits@sling.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120117154453.136B8238890B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bdelacretaz Date: Tue Jan 17 15:44:52 2012 New Revision: 1232446 URL: http://svn.apache.org/viewvc?rev=1232446&view=rev Log: SLING-2368 set hostname in ServerSetup context + log tweaks Modified: sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/ServerSetup.java sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/StartRunnableJarPhase.java Modified: sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/ServerSetup.java URL: http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/ServerSetup.java?rev=1232446&r1=1232445&r2=1232446&view=diff ============================================================================== --- sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/ServerSetup.java (original) +++ sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/ServerSetup.java Tue Jan 17 15:44:52 2012 @@ -99,6 +99,9 @@ public class ServerSetup { /** List of phases that failed */ private final Set failedPhases = new HashSet(); + /** Context attribute: server access URL */ + public static final String SERVER_BASE_URL = "server.base.url"; + /** Shutdown hook thread */ private Thread shutdownHook; @@ -149,22 +152,24 @@ public class ServerSetup { /** Run phases that haven't run yet */ private void runRemainingPhases(boolean startup) throws Exception { + final String mode = startup ? "startup" : "shutdown"; for(String id : phasesToRun) { final SetupPhase p = phases.get(id); if(donePhases.contains(id)) { - log.debug("SetupPhase with id {} already ran, ignored", id); + log.debug("SetupPhase ({}) with id {} already ran, ignored", mode, id); continue; } if(p == null) { - log.info("SetupPhase with id {} not found, ignored", id); + log.info("SetupPhase ({}) with id {} not found, ignored", mode, id); donePhases.add(id); continue; } if(p.isStartupPhase() == startup) { - log.info("Executing {}", p); + log.info("Executing ({}) {}:{}", + new Object [] { mode, p.getClass().getSimpleName(), p.getDescription()}); try { p.run(this); } catch(Exception e) { Modified: sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/StartRunnableJarPhase.java URL: http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/StartRunnableJarPhase.java?rev=1232446&r1=1232445&r2=1232446&view=diff ============================================================================== --- sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/StartRunnableJarPhase.java (original) +++ sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/serversetup/StartRunnableJarPhase.java Tue Jan 17 15:44:52 2012 @@ -15,6 +15,8 @@ import org.slf4j.LoggerFactory; */ public class StartRunnableJarPhase implements SetupPhase { + public static final String TEST_SERVER_HOSTNAME = "test.server.hostname"; + private final Logger log = LoggerFactory.getLogger(getClass()); private final String id; private final String description; @@ -51,8 +53,15 @@ public class StartRunnableJarPhase imple protected ProcessDestroyer getProcessDestroyer() { return destroyer; } - }; + + String hostname = config.getProperty(TEST_SERVER_HOSTNAME); + if(hostname == null) { + hostname = "localhost"; + } + final String url = "http://" + hostname + ":" + executor.getServerPort(); + log.info("Server base URL={}", url); + owner.getContext().put(ServerSetup.SERVER_BASE_URL, url); } public String toString() {