incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
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 GMT
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<String> failedPhases = new HashSet<String>();
     
+    /** 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() {



Mime
View raw message