zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1460523 [2/2] - in /zookeeper/bookkeeper/trunk: ./ bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ bookke...
Date Mon, 25 Mar 2013 05:27:24 GMT
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=1460523&r1=1460522&r2=1460523&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
Mon Mar 25 05:27:23 2013
@@ -36,6 +36,7 @@ import org.apache.hedwig.client.api.Publ
 import org.apache.hedwig.client.conf.ClientConfiguration;
 import org.apache.hedwig.protocol.PubSubProtocol.Message;
 import org.apache.hedwig.protocol.PubSubProtocol.SubscribeRequest.CreateOrAttach;
+import org.apache.hedwig.protocol.PubSubProtocol.SubscriptionOptions;
 import org.apache.hedwig.server.HedwigRegionTestBase;
 import org.apache.hedwig.server.common.ServerConfiguration;
 import org.apache.hedwig.server.integration.TestHedwigHub.TestCallback;
@@ -109,9 +110,11 @@ public class TestHedwigRegion extends He
         // Subscribe to topics for clients in all regions
         for (HedwigClient client : regionClientsMap.values()) {
             for (int i = 0; i < batchSize; i++) {
+                SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+                    .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+
                 client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
-                                                      ByteString.copyFromUtf8("LocalSubscriber"),
CreateOrAttach.CREATE_OR_ATTACH,
-                                                      new TestCallback(queue), null);
+                        ByteString.copyFromUtf8("LocalSubscriber"), opts, new TestCallback(queue),
null);
                 assertTrue(queue.take());
             }
         }
@@ -150,6 +153,9 @@ public class TestHedwigRegion extends He
     public void testSubscribeAndConsumeWhenARegionDown() throws Exception {
         int batchSize = 10;
 
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+
         // first shut down a region
         Random r = new Random();
         int regionId = r.nextInt(numRegions);
@@ -158,8 +164,8 @@ public class TestHedwigRegion extends He
         for (HedwigClient client : regionClientsMap.values()) {
             for (int i = 0; i < batchSize; i++) {
                 client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
-                                                      ByteString.copyFromUtf8("LocalSubscriber"),
CreateOrAttach.CREATE_OR_ATTACH,
-                                                      new TestCallback(queue), null);
+                                                      ByteString.copyFromUtf8("LocalSubscriber"),
+                                                      opts, new TestCallback(queue), null);
                 assertFalse(queue.take());
             }
         }
@@ -172,8 +178,8 @@ public class TestHedwigRegion extends He
             HedwigClient client = entry.getValue();
             for (int i = 0; i < batchSize; i++) {
                 client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
-                                                      ByteString.copyFromUtf8("LocalSubscriber"),
CreateOrAttach.CREATE_OR_ATTACH,
-                                                      new TestCallback(queue), null);
+                                                      ByteString.copyFromUtf8("LocalSubscriber"),
+                                                      opts, new TestCallback(queue), null);
                 assertTrue(queue.take());
             }
         }
@@ -215,13 +221,16 @@ public class TestHedwigRegion extends He
     public void testAttachExistingSubscriptionsWhenARegionDown() throws Exception {
         int batchSize = 10;
         
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+
         // sub it remotely to make subscriptions existed
         for (Map.Entry<String, HedwigClient> entry : regionClientsMap.entrySet()) {
             HedwigClient client = entry.getValue();
             for (int i = 0; i < batchSize; i++) {
                 client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
-                                                      ByteString.copyFromUtf8("LocalSubscriber"),
CreateOrAttach.CREATE_OR_ATTACH,
-                                                      new TestCallback(queue), null);
+                                                      ByteString.copyFromUtf8("LocalSubscriber"),
+                                                      opts, new TestCallback(queue), null);
                 assertTrue(queue.take());
             }
         }
@@ -244,8 +253,8 @@ public class TestHedwigRegion extends He
         for (HedwigClient client : regionClientsMap.values()) {
             for (int i = 0; i < batchSize; i++) {
                 client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
-                                                      ByteString.copyFromUtf8("LocalSubscriber"),
CreateOrAttach.CREATE_OR_ATTACH,
-                                                      new TestCallback(queue), null);
+                                                      ByteString.copyFromUtf8("LocalSubscriber"),
+                                                      opts, new TestCallback(queue), null);
                 assertTrue(queue.take());
             }
         }
@@ -268,8 +277,8 @@ public class TestHedwigRegion extends He
         HedwigClient client = regionClientsMap.get(regionName);
         for (int i = 0; i < batchSize; i++) {
             client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
-                                                  ByteString.copyFromUtf8("LocalSubscriber"),
CreateOrAttach.CREATE_OR_ATTACH,
-                                                  new TestCallback(queue), null);
+                                                  ByteString.copyFromUtf8("LocalSubscriber"),
+                                                  opts, new TestCallback(queue), null);
             assertTrue(queue.take());
             client.getSubscriber().startDelivery(ByteString.copyFromUtf8("Topic" + i),
                     ByteString.copyFromUtf8("LocalSubscriber"), new TestMessageHandler(consumeQueue));

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/MessageBoundedPersistenceTest.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/MessageBoundedPersistenceTest.java?rev=1460523&r1=1460522&r2=1460523&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/MessageBoundedPersistenceTest.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/MessageBoundedPersistenceTest.java
Mon Mar 25 05:27:23 2013
@@ -94,7 +94,9 @@ public class MessageBoundedPersistenceTe
             pub.publish(topic, Message.newBuilder().setBody(
                                 ByteString.copyFromUtf8(String.valueOf(i))).build());
         }
-        sub.subscribe(topic, subid, CreateOrAttach.ATTACH);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.ATTACH).build();
+        sub.subscribe(topic, subid, opts);
 
         final AtomicInteger expected = new AtomicInteger(X - Y);
         final CountDownLatch latch = new CountDownLatch(1);
@@ -140,7 +142,9 @@ public class MessageBoundedPersistenceTe
 
         ByteString topic = ByteString.copyFromUtf8("basicBoundingTopic");
         ByteString subid = ByteString.copyFromUtf8("basicBoundingSubId");
-        sub.subscribe(topic, subid, CreateOrAttach.CREATE);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE).build();
+        sub.subscribe(topic, subid, opts);
         sub.closeSubscription(topic, subid);
 
         sendXExpectLastY(pub, sub, topic, subid, 1000, 5);
@@ -222,7 +226,9 @@ public class MessageBoundedPersistenceTe
         sendXExpectLastY(pub, sub, topic, subid, 50, 10);
 
         // message bound is not provided, no update
-        sub.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+        sub.subscribe(topic, subid, opts);
         sub.closeSubscription(topic, subid);
         sendXExpectLastY(pub, sub, topic, subid, 50, 10);
 
@@ -238,7 +244,9 @@ public class MessageBoundedPersistenceTe
         String ledgersPath = "/hedwig/standalone/topics/testGCTopic/ledgers";
         ByteString topic = ByteString.copyFromUtf8("testGCTopic");
         ByteString subid = ByteString.copyFromUtf8("testGCSubId");
-        sub.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+        sub.subscribe(topic, subid, opts);
         sub.closeSubscription(topic, subid);
 
         for (int i = 1; i <= 100; i++) {

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/TestDeadlock.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/TestDeadlock.java?rev=1460523&r1=1460522&r2=1460523&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/TestDeadlock.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/persistence/TestDeadlock.java
Mon Mar 25 05:27:23 2013
@@ -37,6 +37,7 @@ import org.apache.hedwig.client.conf.Cli
 import org.apache.hedwig.client.HedwigClient;
 import org.apache.hedwig.protocol.PubSubProtocol.Message;
 import org.apache.hedwig.protocol.PubSubProtocol.SubscribeRequest.CreateOrAttach;
+import org.apache.hedwig.protocol.PubSubProtocol.SubscriptionOptions;
 import org.apache.hedwig.server.HedwigHubTestBase;
 import org.apache.hedwig.server.common.ServerConfiguration;
 import org.apache.hedwig.util.Callback;
@@ -182,7 +183,11 @@ public class TestDeadlock extends Hedwig
             return 1;
         }
         @Override
-        public int getBkQuorumSize() {
+        public int getBkWriteQuorumSize() {
+            return 1;
+        }
+        @Override
+        public int getBkAckQuorumSize() {
             return 1;
         }
         @Override
@@ -218,7 +223,9 @@ public class TestDeadlock extends Hedwig
 
         // subscribe to topic
         logger.info("Setup subscriptions");
-        subscriber.subscribe(topic, subscriberId, CreateOrAttach.CREATE_OR_ATTACH);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+        subscriber.subscribe(topic, subscriberId, opts);
         subscriber.closeSubscription(topic, subscriberId);
 
         // publish 5 messages to form first ledger
@@ -242,7 +249,7 @@ public class TestDeadlock extends Hedwig
 
         logger.info("Start subscribe topics again and receive messages");
         // subscribe to topic
-        subscriber.subscribe(topic, subscriberId, CreateOrAttach.CREATE_OR_ATTACH);
+        subscriber.subscribe(topic, subscriberId, opts);
         subscriber.startDelivery(topic, subscriberId,
                                  new TestMessageHandler(consumeQueue));
         for (int i=0; i<(2*numMessages+3); i++) {

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/subscriptions/TestUpdateSubscriptionState.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/subscriptions/TestUpdateSubscriptionState.java?rev=1460523&r1=1460522&r2=1460523&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/subscriptions/TestUpdateSubscriptionState.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/subscriptions/TestUpdateSubscriptionState.java
Mon Mar 25 05:27:23 2013
@@ -25,6 +25,7 @@ import org.apache.hedwig.client.api.Publ
 import org.apache.hedwig.client.api.Subscriber;
 import org.apache.hedwig.client.conf.ClientConfiguration;
 import org.apache.hedwig.protocol.PubSubProtocol.Message;
+import org.apache.hedwig.protocol.PubSubProtocol.SubscriptionOptions;
 import org.apache.hedwig.protocol.PubSubProtocol.SubscribeRequest.CreateOrAttach;
 import org.apache.hedwig.server.HedwigHubTestBase;
 import org.apache.hedwig.server.common.ServerConfiguration;
@@ -161,7 +162,9 @@ public class TestUpdateSubscriptionState
         int startMsgId = 0;
         int numMsgs = 10;
         // subscriber in client
-        subscriber.subscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
+        subscriber.subscribe(topic, subId, opts);
         // start delivery
         OrderCheckingMessageHandler ocm = new OrderCheckingMessageHandler(
                 topic, subId, startMsgId, numMsgs);
@@ -185,7 +188,7 @@ public class TestUpdateSubscriptionState
 
         startMsgId = 20;
         // reconnect it again
-        subscriber.subscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH);
+        subscriber.subscribe(topic, subId, opts);
         ocm = new OrderCheckingMessageHandler(topic, subId, startMsgId, numMsgs);
         subscriber.startDelivery(topic, subId, ocm);
         for (int i=0; i<numMsgs; i++) {
@@ -205,8 +208,10 @@ public class TestUpdateSubscriptionState
 
         int startMsgId = 0;
         int numMsgs = 10;
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
         // subscriber in client
-        subscriber.subscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH);
+        subscriber.subscribe(topic, subId, opts);
         // start delivery
         OrderCheckingMessageHandler ocm = new OrderCheckingMessageHandler(
                 topic, subId, startMsgId, numMsgs);
@@ -232,7 +237,7 @@ public class TestUpdateSubscriptionState
 
         startMsgId = 20;
         // reconnect it again
-        subscriber.subscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH);
+        subscriber.subscribe(topic, subId, opts);
         ocm = new OrderCheckingMessageHandler(topic, subId, startMsgId, numMsgs);
         subscriber.startDelivery(topic, subId, ocm);
         for (int i=0; i<numMsgs; i++) {

Modified: zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/topics/TestConcurrentTopicAcquisition.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/topics/TestConcurrentTopicAcquisition.java?rev=1460523&r1=1460522&r2=1460523&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/topics/TestConcurrentTopicAcquisition.java
(original)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/server/topics/TestConcurrentTopicAcquisition.java
Mon Mar 25 05:27:23 2013
@@ -28,6 +28,7 @@ import org.apache.hedwig.client.api.Publ
 import org.apache.hedwig.client.api.Subscriber;
 import org.apache.hedwig.exceptions.PubSubException;
 import org.apache.hedwig.protocol.PubSubProtocol.SubscribeRequest.CreateOrAttach;
+import org.apache.hedwig.protocol.PubSubProtocol.SubscriptionOptions;
 import org.apache.hedwig.server.HedwigHubTestBase;
 import org.apache.hedwig.util.Callback;
 import org.apache.hedwig.util.ConcurrencyUtils;
@@ -116,12 +117,14 @@ public class TestConcurrentTopicAcquisit
         // 300 subscribers subscribe to a same topic
         final AtomicBoolean inRedirectLoop = new AtomicBoolean(false);
         numDone.set(0);
+        SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+            .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
         for (int i=0; i<numSubscribers; i++) {
             ByteString subId = ByteString.copyFromUtf8("sub-" + i);
             if (logger.isDebugEnabled()) {
                 logger.debug("subscriber " + subId.toStringUtf8() + " subscribes topic "
+ topic.toStringUtf8());
             }
-            subscriber.asyncSubscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH,
+            subscriber.asyncSubscribe(topic, subId, opts,
                 new Callback<Void>() {
                 
                     private void tick() {
@@ -175,14 +178,15 @@ public class TestConcurrentTopicAcquisit
                     }
                     
                     ByteString subId;
+                    SubscriptionOptions opts = SubscriptionOptions.newBuilder()
+                        .setCreateOrAttach(CreateOrAttach.CREATE_OR_ATTACH).build();
                     while (true) {
                         subId = subscribers.take();
                         
                         if (logger.isDebugEnabled()) {
                             logger.debug("subscriber " + subId.toStringUtf8() + " subscribes
topic " + topic.toStringUtf8());
                         }
-                        subscriber.asyncSubscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH,
-                            new SubCallback(subId), null);
+                        subscriber.asyncSubscribe(topic, subId, opts, new SubCallback(subId),
null);
                     }
                     // subscriber.asyncSubscribe(topic, subscriberId, mode, callback, context)
                 } catch (InterruptedException ie) {

Modified: zookeeper/bookkeeper/trunk/pom.xml
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/pom.xml?rev=1460523&r1=1460522&r2=1460523&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/pom.xml (original)
+++ zookeeper/bookkeeper/trunk/pom.xml Mon Mar 25 05:27:23 2013
@@ -53,10 +53,15 @@
       </plugin>
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.3.2</version>
+        <version>3.0</version>
         <configuration>
           <source>1.6</source>
           <target>1.6</target>
+          <compilerArguments>
+	    <Werror />
+	    <Xlint:deprecation />
+	    <Xlint:unchecked />
+	  </compilerArguments>
         </configuration>
       </plugin>
       <plugin>



Mime
View raw message