zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iv...@apache.org
Subject svn commit: r1241855 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BaseTestCase.java
Date Wed, 08 Feb 2012 10:40:43 GMT
Author: ivank
Date: Wed Feb  8 10:40:43 2012
New Revision: 1241855

URL: http://svn.apache.org/viewvc?rev=1241855&view=rev
Log:
BOOKKEEPER-156: BookieJournalRollingTest failing (Sijie Guo via ivank)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BaseTestCase.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1241855&r1=1241854&r2=1241855&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Wed Feb  8 10:40:43 2012
@@ -30,6 +30,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-167: PerChannelBookieClient doesn't use ClientConfiguration (Sijie Guo
via ivank)
 
+        BOOKKEEPER-156: BookieJournalRollingTest failing (Sijie Guo via ivank)
+
       hedwig-server/
       
         BOOKKEEPER-140: Hub server doesn't subscribe remote region correctly when a region
is down. (Sijie Gou via ivank)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BaseTestCase.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BaseTestCase.java?rev=1241855&r1=1241854&r2=1241855&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BaseTestCase.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BaseTestCase.java
Wed Feb  8 10:40:43 2012
@@ -128,6 +128,11 @@ public abstract class BaseTestCase exten
             zkc.create("/ledgers", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
             zkc.create("/ledgers/available", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 
+            baseClientConf.setZkServers("127.0.0.1");
+            if (numBookies > 0) {
+                bkc = new BookKeeperTestClient(baseClientConf);
+            }
+
             // Create Bookie Servers (B1, B2, B3)
             for (int i = 0; i < numBookies; i++) {
                 File f = File.createTempFile("bookie", "test");
@@ -139,14 +144,7 @@ public abstract class BaseTestCase exten
                     initialPort + i, HOSTPORT, f, new File[] { f });
                 bsConfs.add(conf);
 
-                BookieServer server = new BookieServer(conf);
-                server.start();
-                bs.add(server);
-            }
-
-            baseClientConf.setZkServers("127.0.0.1");
-            if (numBookies > 0) {
-                bkc = new BookKeeperTestClient(baseClientConf);
+                bs.add(startBookie(conf));
             }
         } catch(Exception e) {
             LOG.error("Error setting up", e);
@@ -223,9 +221,7 @@ public abstract class BaseTestCase exten
             if (null != newConf) {
                 conf.loadConf(newConf);
             }
-            BookieServer server = new BookieServer(conf);
-            server.start();
-            bs.add(server);
+            bs.add(startBookie(conf));
             j++;
         }
     }
@@ -247,16 +243,29 @@ public abstract class BaseTestCase exten
 
         ServerConfiguration conf = newServerConfiguration(port, HOSTPORT, f, new File[] {
f });
 
+        bs.add(startBookie(conf));
+    }
+
+    /**
+     * Helper method to startup a bookie server using a configuration object
+     *
+     * @param conf
+     *            Server Configuration Object
+     *
+     */
+    private BookieServer startBookie(ServerConfiguration conf)
+            throws IOException, InterruptedException, KeeperException {
         BookieServer server = new BookieServer(conf);
         server.start();
-        bs.add(server);
 
+        int port = conf.getBookiePort();
         while(bkc.getZkHandle().exists("/ledgers/available/" + InetAddress.getLocalHost().getHostAddress()
+ ":" + port, false) == null) {
             Thread.sleep(500);
         }
 
         bkc.readBookiesBlocking();
         LOG.info("New bookie on port " + port + " has been created.");
+        return server;
     }
 
     @After



Mime
View raw message