Update of /var/cvs/tests/common/org/mmbase/tests
In directory james.mmbase.org:/tmp/cvs-serv7386/org/mmbase/tests

Modified Files:
        BridgeTest.java MMBaseTest.java 
Log Message:
added getCloudContext


See also: http://cvs.mmbase.org/viewcvs/tests/common/org/mmbase/tests


Index: BridgeTest.java
===================================================================
RCS file: /var/cvs/tests/common/org/mmbase/tests/BridgeTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- BridgeTest.java     30 Aug 2006 18:09:35 -0000      1.13
+++ BridgeTest.java     18 Jul 2008 05:45:04 -0000      1.14
@@ -9,6 +9,9 @@
 */
 package org.mmbase.tests;
 import org.mmbase.bridge.*;
+import org.mmbase.util.logging.Logger;
+import org.mmbase.util.logging.Logging;
+
 
 /**
  * Test-case running via the bridge. This base class takes care of
@@ -17,7 +20,7 @@
  * @author Michiel Meeuwissen
  */
 public abstract class BridgeTest extends MMBaseTest {
-
+    private static final Logger log = 
Logging.getLoggerInstance(BridgeTest.class);
     public BridgeTest() {
         super();
     }
@@ -27,30 +30,37 @@
 
     int tryCount = 0;
 
-    protected Cloud getCloud() {
-        Cloud c = null;
-        while(c == null) {
+    protected CloudContext getCloudContext() {
             CloudContext cc = null;
+        while(cc == null) {
             try {
                 cc = ContextProvider.getDefaultCloudContext();
-                c = cc.getCloud("mmbase", "class", null);
                 break;
             } catch (BridgeException be) {
                 if (cc instanceof LocalContext) {
                     throw be;
                 }
-                System.out.println(be.getMessage() + ". LOCAL. Perhaps mmbase 
not yet running, retrying in 5 seconds (" + tryCount + ")");
+                if (tryCount < 19) {
+                    log.info(be.getMessage() + ".  Perhaps mmbase not yet 
running, retrying in 5 seconds (" + tryCount + ")");
+                } else {
+                    log.warn(be.getMessage() + ".  Perhaps mmbase not yet 
running, retrying in 5 seconds (" + tryCount + ")", be);
+                }
                 try {
                     tryCount ++;
                     Thread.sleep(5000);
                 } catch (Exception ie) {
                     return null;
                 }
-                if (tryCount > 25) {
+                if (tryCount > 20) {
                     throw be;
                 }
             }
         }
+        return cc;
+    }
+
+    protected Cloud getCloud() {
+        Cloud c = getCloudContext().getCloud("mmbase", "class", null);
         ensureDeployed(c, "local cloud");
         return c;
     }


Index: MMBaseTest.java
===================================================================
RCS file: /var/cvs/tests/common/org/mmbase/tests/MMBaseTest.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- MMBaseTest.java     21 Jun 2007 15:50:27 -0000      1.16
+++ MMBaseTest.java     18 Jul 2008 05:45:04 -0000      1.17
@@ -89,6 +89,9 @@
         }
     }
 
+    static protected void persist() {
+    }
+
     /**
      * If no running MMBase is needed, then you probably want at least to 
initialize logging.
      */
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to