incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1231496 - in /sling/trunk/testing/tools/src: main/java/org/apache/sling/testing/tools/serversetup/ test/java/org/apache/sling/testing/tools/test/
Date Sat, 14 Jan 2012 13:02:30 GMT
Author: bdelacretaz
Date: Sat Jan 14 13:02:30 2012
New Revision: 1231496

URL: http://svn.apache.org/viewvc?rev=1231496&view=rev
Log:
SLING-2368 - 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
    sling/trunk/testing/tools/src/test/java/org/apache/sling/testing/tools/test/ServerSetupSingletonTest.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=1231496&r1=1231495&r2=1231496&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
Sat Jan 14 13:02:30 2012
@@ -151,10 +151,19 @@ public class ServerSetup {
     private void runRemainingPhases(boolean startup) throws Exception {
         for(String id : phasesToRun) {
             final SetupPhase p = phases.get(id);
+            
             if(donePhases.contains(id)) {
+                log.debug("SetupPhase with id {} already ran, ignored", id);
                 continue;
             }
-            if(p != null && p.isStartupPhase() == startup) {
+            
+            if(p == null) {
+                log.info("SetupPhase with id {} not found, ignored", id);
+                donePhases.add(id);
+                continue;
+            }
+            
+            if(p.isStartupPhase() == startup) {
                 log.info("Executing {}", p);
                 try {
                     p.run(this);
@@ -168,8 +177,6 @@ public class ServerSetup {
                 } finally {
                     donePhases.add(id);
                 }
-            } else {
-                log.info("{} ignored, not in phasesToRun ({})", p, phasesToRun);
             }
         }
     }
@@ -204,6 +211,10 @@ public class ServerSetup {
         }
         phasesToRun.addAll(Arrays.asList(phases));
         
+        if(phasesToRun.isEmpty()) {
+            log.warn("No setup phases defined, {} is empty, is that on purpose?", PHASES_TO_RUN_PROP);
+        }
+        
         donePhases.clear();
         failedPhases.clear();
     }

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=1231496&r1=1231495&r2=1231496&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
Sat Jan 14 13:02:30 2012
@@ -39,7 +39,7 @@ public class StartRunnableJarPhase imple
                     super.run();
                 } else {
                     log.info(
-                            "{}: {} does not {} phase to run, doing nothing", 
+                            "{}: {} does not allow {} phase to run, doing nothing", 
                             new Object[] { this, owner, shutdownId } );
                 }
             }
@@ -55,6 +55,10 @@ public class StartRunnableJarPhase imple
         };
     }
     
+    public String toString() {
+        return getClass().getSimpleName() + "(" + id + ")";
+    }
+    
     /** @inheritDoc */
     public void run(ServerSetup owner) throws Exception {
         executor.start();

Modified: sling/trunk/testing/tools/src/test/java/org/apache/sling/testing/tools/test/ServerSetupSingletonTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/test/java/org/apache/sling/testing/tools/test/ServerSetupSingletonTest.java?rev=1231496&r1=1231495&r2=1231496&view=diff
==============================================================================
--- sling/trunk/testing/tools/src/test/java/org/apache/sling/testing/tools/test/ServerSetupSingletonTest.java
(original)
+++ sling/trunk/testing/tools/src/test/java/org/apache/sling/testing/tools/test/ServerSetupSingletonTest.java
Sat Jan 14 13:02:30 2012
@@ -172,12 +172,12 @@ public class ServerSetupSingletonTest {
         props.setProperty(ServerSetup.PHASES_TO_RUN_PROP, "one, B, five, A, two");
         serverSetup.setConfig(props);
         serverSetup.addSetupPhase(new TestSetupPhase("A", true));
+        serverSetup.addSetupPhase(new TestSetupPhase("B", false));
         serverSetup.setupTestServer();
         
         assertEquals("Expecting all startup phases to have run",
                 "one,A,two", TestSetupPhase.executionLog.toString());
         
-        serverSetup.addSetupPhase(new TestSetupPhase("B", false));
         serverSetup.shutdown();
         assertEquals("Expecting all phases to have run",
                 "one,A,two,B,five", TestSetupPhase.executionLog.toString());



Mime
View raw message