zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iv...@apache.org
Subject svn commit: r1438120 - in /zookeeper/bookkeeper/trunk: ./ hedwig-server/ hedwig-server/src/test/java/org/apache/hedwig/server/ hedwig-server/src/test/java/org/apache/hedwig/server/delivery/ hedwig-server/src/test/java/org/apache/hedwig/server/integration/
Date Thu, 24 Jan 2013 18:35:48 GMT
Author: ivank
Date: Thu Jan 24 18:35:47 2013
New Revision: 1438120

URL: http://svn.apache.org/viewvc?rev=1438120&view=rev
Log:
BOOKKEEPER-544: Modify hedwig server tests to allow client testcases to start/stop them as
part of their tests (mridul via ivank)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/hedwig-server/pom.xml
    zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/HedwigHubTestBase.java
    zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/delivery/TestThrottlingDelivery.java
    zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigRegion.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1438120&r1=1438119&r2=1438120&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Thu Jan 24 18:35:47 2013
@@ -12,6 +12,8 @@ Trunk (unreleased changes)
 
     IMPROVEMENTS:
 
+      BOOKKEEPER-544: Modify hedwig server tests to allow client testcases to start/stop
them as part of their tests (mridul via ivank)
+
 Release 4.2.0 - 2013-01-14
 
   Non-backward compatible changes:

Modified: zookeeper/bookkeeper/trunk/hedwig-server/pom.xml
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/pom.xml?rev=1438120&r1=1438119&r2=1438120&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/pom.xml (original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/pom.xml Thu Jan 24 18:35:47 2013
@@ -175,6 +175,18 @@
   <build>
     <plugins>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
         <version>0.7</version>

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/HedwigHubTestBase.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/HedwigHubTestBase.java?rev=1438120&r1=1438119&r2=1438120&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/HedwigHubTestBase.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/HedwigHubTestBase.java
Thu Jan 24 18:35:47 2013
@@ -58,6 +58,11 @@ public abstract class HedwigHubTestBase 
     protected List<PubSubServer> serversList;
     protected List<HedwigSocketAddress> serverAddresses;
 
+    protected boolean sslEnabled = true;
+    protected boolean standalone = false;
+
+    protected static final String HOST = "localhost";
+
     public HedwigHubTestBase() {
         this(1);
     }
@@ -65,9 +70,20 @@ public abstract class HedwigHubTestBase 
     protected HedwigHubTestBase(int numServers) {
         this.numServers = numServers;
 
+        init();
+    }
+
+    public HedwigHubTestBase(String name, int numServers) {
+        super(name);
+        this.numServers = numServers;
+        init();
+    }
+
+    private void init() {
+
         serverAddresses = new LinkedList<HedwigSocketAddress>();
         for (int i = 0; i < numServers; i++) {
-            serverAddresses.add(new HedwigSocketAddress("localhost",
+            serverAddresses.add(new HedwigSocketAddress(HOST,
                                         PortManager.nextFreePort(), PortManager.nextFreePort()));
         }
     }
@@ -85,6 +101,11 @@ public abstract class HedwigHubTestBase 
         }
 
         @Override
+        public boolean isStandalone() {
+            return standalone;
+        }
+
+        @Override
         public int getServerPort() {
             return serverPort;
         }
@@ -96,22 +117,22 @@ public abstract class HedwigHubTestBase 
 
         @Override
         public String getZkHost() {
-            return bktb.getZkHostPort();
+            return null != bktb ? bktb.getZkHostPort() : null;
         }
 
         @Override
         public boolean isSSLEnabled() {
-            return true;
+            return sslEnabled;
         }
 
         @Override
         public String getCertName() {
-            return "/server.p12";
+            return isSSLEnabled() ? "/server.p12" : null;
         }
 
         @Override
         public String getPassword() {
-            return "eUySvp2phM2Wk";
+            return isSSLEnabled() ? "eUySvp2phM2Wk" : null;
         }
     }
 
@@ -136,12 +157,13 @@ public abstract class HedwigHubTestBase 
 
         for (int i = 0; i < numServers; i++) {
             ServerConfiguration conf = getServerConfiguration(serverAddresses.get(i).getPort(),
-                                                              serverAddresses.get(i).getSSLPort());
+                                                              sslEnabled ? serverAddresses.get(i).getSSLPort()
: -1);
             PubSubServer s = new PubSubServer(conf, new ClientConfiguration(), new LoggingExceptionHandler());
             serversList.add(s);
             s.start();
         }
     }
+
     protected void stopHubServers() throws Exception {
         // Shutdown all of the PubSubServers
         for (PubSubServer server : serversList) {
@@ -152,20 +174,22 @@ public abstract class HedwigHubTestBase 
 
     @Override
     @Before
-    public void setUp() throws Exception {
+    protected void setUp() throws Exception {
         logger.info("STARTING " + getName());
-        bktb = new BookKeeperTestBase(numBookies, readDelay);
-        bktb.setUp();
+        if (! standalone) {
+            bktb = new BookKeeperTestBase(numBookies, readDelay);
+            bktb.setUp();
+        }
         startHubServers();
         logger.info("HedwigHub test setup finished");
     }
 
     @Override
     @After
-    public void tearDown() throws Exception {
+    protected void tearDown() throws Exception {
         logger.info("tearDown starting");
         stopHubServers();
-        bktb.tearDown();
+        if (null != bktb) bktb.tearDown();
         logger.info("FINISHED " + getName());
     }
 

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/delivery/TestThrottlingDelivery.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/delivery/TestThrottlingDelivery.java?rev=1438120&r1=1438119&r2=1438120&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/delivery/TestThrottlingDelivery.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/delivery/TestThrottlingDelivery.java
Thu Jan 24 18:35:47 2013
@@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.junit.Before;
+import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -184,6 +185,13 @@ public class TestThrottlingDelivery exte
     }
 
     @Override
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+
+    @Override
     protected ServerConfiguration getServerConfiguration(int port, int sslPort) {
         return new ThrottleDeliveryServerConfiguration(port, sslPort);
     }

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigRegion.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigRegion.java?rev=1438120&r1=1438119&r2=1438120&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigRegion.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigRegion.java
Thu Jan 24 18:35:47 2013
@@ -103,12 +103,6 @@ public class TestHedwigRegion extends He
         super.setUp();
     }
 
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     @Test(timeout=60000)
     public void testMultiRegionSubscribeAndConsume() throws Exception {
         int batchSize = 10;



Mime
View raw message