Merge branch '1.5.2-SNAPSHOT' into 1.6.1-SNAPSHOT

Conflicts:
        test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cfda8fab
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cfda8fab
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cfda8fab

Branch: refs/heads/1.6.1-SNAPSHOT
Commit: cfda8fab6d290008195769a750994a52986bc964
Parents: 76c910b 886cd19
Author: Josh Elser <els...@apache.org>
Authored: Tue Jun 24 14:25:34 2014 -0400
Committer: Josh Elser <els...@apache.org>
Committed: Tue Jun 24 14:25:34 2014 -0400

----------------------------------------------------------------------
 .../accumulo/fate/zookeeper/ZooLockTest.java    | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/cfda8fab/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
----------------------------------------------------------------------
diff --cc test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
index d19320d,40454f6..4045087
--- a/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
+++ b/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
@@@ -104,121 -104,121 +105,121 @@@ public class ZooLockTest 
        this.notifyAll();
      }
    }
 -  
 +
    @BeforeClass
    public static void setupMiniCluster() throws Exception {
 -    
 +
      folder.create();
 -    
 +
      Logger.getLogger("org.apache.zookeeper").setLevel(Level.ERROR);
 -    
 +
      accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
 -    
 +
      accumulo.start();
 -    
 +
    }
  
-   private static int pdCount = 0;
+   private static final AtomicInteger pdCount = new AtomicInteger(0);
  
    @Test(timeout = 10000)
    public void testDeleteParent() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
  
      ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes(), parent);
 -    
 +
      Assert.assertFalse(zl.isLocked());
 -    
 +
      ZooReaderWriter zk = 
ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes());
 -    
 +
      // intentionally created parent after lock
      zk.mkdirs(parent);
 -    
 +
      zk.delete(parent, -1);
 -    
 +
      zk.mkdirs(parent);
 -    
 +
      TestALW lw = new TestALW();
 -    
 +
      zl.lockAsync(lw, "test1".getBytes());
 -    
 +
      lw.waitForChanges(1);
 -    
 +
      Assert.assertTrue(lw.locked);
      Assert.assertTrue(zl.isLocked());
      Assert.assertNull(lw.exception);
      Assert.assertNull(lw.reason);
 -    
 +
      zl.unlock();
    }
 -  
 +
    @Test(timeout = 10000)
    public void testNoParent() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
- 
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
+  
      ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes(), parent);
 -    
 +
      Assert.assertFalse(zl.isLocked());
 -    
 +
      TestALW lw = new TestALW();
 -    
 +
      zl.lockAsync(lw, "test1".getBytes());
 -    
 +
      lw.waitForChanges(1);
 -    
 +
      Assert.assertFalse(lw.locked);
      Assert.assertFalse(zl.isLocked());
      Assert.assertNotNull(lw.exception);
      Assert.assertNull(lw.reason);
    }
 -  
 +
    @Test(timeout = 10000)
    public void testDeleteLock() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
- 
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
+  
      ZooReaderWriter zk = 
ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes());
      zk.mkdirs(parent);
 -    
 +
      ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes(), parent);
 -    
 +
      Assert.assertFalse(zl.isLocked());
 -    
 +
      TestALW lw = new TestALW();
 -    
 +
      zl.lockAsync(lw, "test1".getBytes());
 -    
 +
      lw.waitForChanges(1);
 -    
 +
      Assert.assertTrue(lw.locked);
      Assert.assertTrue(zl.isLocked());
      Assert.assertNull(lw.exception);
      Assert.assertNull(lw.reason);
 -    
 +
      zk.delete(zl.getLockPath(), -1);
 -    
 +
      lw.waitForChanges(2);
 -    
 +
      Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
      Assert.assertNull(lw.exception);
 -    
 +
    }
 -  
 +
    @Test(timeout = 10000)
    public void testDeleteWaiting() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
- 
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
+  
      ZooReaderWriter zk = 
ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes());
      zk.mkdirs(parent);
 -    
 +
      ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", 
"secret".getBytes(), parent);
 -    
 +
      Assert.assertFalse(zl.isLocked());
 -    
 +
      TestALW lw = new TestALW();
 -    
 +
      zl.lockAsync(lw, "test1".getBytes());
 -    
 +
      lw.waitForChanges(1);
 -    
 +
      Assert.assertTrue(lw.locked);
      Assert.assertTrue(zl.isLocked());
      Assert.assertNull(lw.exception);
@@@ -263,14 -263,14 +264,14 @@@
      Assert.assertTrue(zl3.isLocked());
      Assert.assertNull(lw3.exception);
      Assert.assertNull(lw3.reason);
 -    
 +
      zl3.unlock();
 -    
 +
    }
 -  
 +
    @Test(timeout = 10000)
    public void testUnexpectedEvent() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
  
      ConnectedWatcher watcher = new ConnectedWatcher();
      ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 30000, watcher);
@@@ -299,22 -299,22 +300,22 @@@
      Assert.assertTrue(zl.isLocked());
      Assert.assertNull(lw.exception);
      Assert.assertNull(lw.reason);
 -    
 +
      // would not expect data to be set on this node either
      zk.setData(zl.getLockPath(), "bar".getBytes(), -1);
 -    
 +
      zk.delete(zl.getLockPath(), -1);
 -    
 +
      lw.waitForChanges(2);
 -    
 +
      Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
      Assert.assertNull(lw.exception);
 -    
 +
    }
 -  
 +
    @Test(timeout = 10000)
    public void testTryLock() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
  
      ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", 
"secret".getBytes(), parent);
      
@@@ -345,13 -345,13 +346,13 @@@
        field.setAccessible(true);
        Assert.assertTrue((Boolean) field.get(zl));
      }
 -    
 +
      zl.unlock();
    }
 -  
 +
    @Test(timeout = 10000)
    public void testChangeData() throws Exception {
-     String parent = "/zltest-" + this.hashCode() + "-l" + pdCount++;
+     String parent = "/zltest-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet();
      ConnectedWatcher watcher = new ConnectedWatcher();
      ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, watcher);
      zk.addAuthInfo("digest", "secret".getBytes());

Reply via email to