Return-Path: Delivered-To: apmail-hadoop-zookeeper-commits-archive@minotaur.apache.org Received: (qmail 8770 invoked from network); 14 May 2010 23:32:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 May 2010 23:32:45 -0000 Received: (qmail 96821 invoked by uid 500); 14 May 2010 23:32:45 -0000 Delivered-To: apmail-hadoop-zookeeper-commits-archive@hadoop.apache.org Received: (qmail 96800 invoked by uid 500); 14 May 2010 23:32:45 -0000 Mailing-List: contact zookeeper-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-dev@ Delivered-To: mailing list zookeeper-commits@hadoop.apache.org Received: (qmail 96792 invoked by uid 99); 14 May 2010 23:32:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 May 2010 23:32:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 May 2010 23:32:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 204F4238897A; Fri, 14 May 2010 23:32:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r944515 - in /hadoop/zookeeper/trunk: ./ src/recipes/lock/test/org/apache/zookeeper/recipes/lock/ src/recipes/queue/test/org/apache/zookeeper/recipes/queue/ Date: Fri, 14 May 2010 23:32:21 -0000 To: zookeeper-commits@hadoop.apache.org From: phunt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100514233221.204F4238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: phunt Date: Fri May 14 23:32:20 2010 New Revision: 944515 URL: http://svn.apache.org/viewvc?rev=944515&view=rev Log: ZOOKEEPER-774. Recipes tests are slightly outdated: they do not compile against JUnit 4.8 Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/WriteLockTest.java hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/ZNodeNameTest.java hadoop/zookeeper/trunk/src/recipes/queue/test/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=944515&r1=944514&r2=944515&view=diff ============================================================================== --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Fri May 14 23:32:20 2010 @@ -52,6 +52,9 @@ BUGFIXES: ZOOKEEPER-763. Deadlock on close w/ zkpython / c client (henry via phunt) + ZOOKEEPER-774. Recipes tests are slightly outdated: they do not compile + against JUnit 4.8 (Sergey Doroshenko via phunt) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/WriteLockTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/WriteLockTest.java?rev=944515&r1=944514&r2=944515&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/WriteLockTest.java (original) +++ hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/WriteLockTest.java Fri May 14 23:32:20 2010 @@ -23,6 +23,10 @@ import org.apache.zookeeper.test.ClientB import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; + /** * test for writelock */ @@ -35,6 +39,7 @@ public class WriteLockTest extends Clien private boolean workAroundClosingLastZNodeFails = true; private boolean killLeader = true; + @Test public void testRun() throws Exception { runTest(3); } @@ -68,11 +73,11 @@ public class WriteLockTest extends Clien dumpNodes(count); // lets assert that the first election is the leader - assertTrue("The first znode should be the leader " + first.getId(), first.isOwner()); + Assert.assertTrue("The first znode should be the leader " + first.getId(), first.isOwner()); for (int i = 1; i < count; i++) { WriteLock node = nodes[i]; - assertFalse("Node should not be the leader " + node.getId(), node.isOwner()); + Assert.assertFalse("Node should not be the leader " + node.getId(), node.isOwner()); } if (count > 1) { @@ -86,11 +91,11 @@ public class WriteLockTest extends Clien WriteLock second = nodes[1]; dumpNodes(count); // lets assert that the first election is the leader - assertTrue("The second znode should be the leader " + second.getId(), second.isOwner()); + Assert.assertTrue("The second znode should be the leader " + second.getId(), second.isOwner()); for (int i = 2; i < count; i++) { WriteLock node = nodes[i]; - assertFalse("Node should not be the leader " + node.getId(), node.isOwner()); + Assert.assertFalse("Node should not be the leader " + node.getId(), node.isOwner()); } } @@ -126,8 +131,8 @@ public class WriteLockTest extends Clien } } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { if (nodes != null) { for (int i = 0; i < nodes.length; i++) { WriteLock node = nodes[i]; Modified: hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/ZNodeNameTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/ZNodeNameTest.java?rev=944515&r1=944514&r2=944515&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/ZNodeNameTest.java (original) +++ hadoop/zookeeper/trunk/src/recipes/lock/test/org/apache/zookeeper/recipes/lock/ZNodeNameTest.java Fri May 14 23:32:20 2010 @@ -22,15 +22,19 @@ import junit.framework.TestCase; import java.util.SortedSet; import java.util.TreeSet; +import org.junit.Test; + /** * test for znodenames */ public class ZNodeNameTest extends TestCase { + @Test public void testOrderWithSamePrefix() throws Exception { String[] names = { "x-3", "x-5", "x-11", "x-1" }; String[] expected = { "x-1", "x-3", "x-5", "x-11" }; assertOrderedNodeNames(names, expected); } + @Test public void testOrderWithDifferentPrefixes() throws Exception { String[] names = { "r-3", "r-2", "r-1", "w-2", "w-1" }; String[] expected = { "r-1", "r-2", "r-3", "w-1", "w-2" }; Modified: hadoop/zookeeper/trunk/src/recipes/queue/test/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/recipes/queue/test/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java?rev=944515&r1=944514&r2=944515&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/recipes/queue/test/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java (original) +++ hadoop/zookeeper/trunk/src/recipes/queue/test/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java Fri May 14 23:32:20 2010 @@ -17,25 +17,27 @@ */ package org.apache.zookeeper.recipes.queue; -import java.util.Calendar; import java.util.NoSuchElementException; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooKeeper; -import org.apache.zookeeper.recipes.queue.DistributedQueue; import org.apache.zookeeper.test.ClientBase; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; public class DistributedQueueTest extends ClientBase { - @Override - protected void tearDown() throws Exception { + + @After + public void tearDown() throws Exception { super.tearDown(); - LOG.info("FINISHED " + getName()); + LOG.info("FINISHED " + getTestName()); } - + @Test public void testOffer1() throws Exception { String dir = "/testOffer1"; String testString = "Hello World"; @@ -50,9 +52,10 @@ public class DistributedQueueTest extend queueHandles[0].offer(testString.getBytes()); byte dequeuedBytes[] = queueHandles[0].remove(); - assertEquals(new String(dequeuedBytes), testString); + Assert.assertEquals(new String(dequeuedBytes), testString); } + @Test public void testOffer2() throws Exception { String dir = "/testOffer2"; String testString = "Hello World"; @@ -67,9 +70,10 @@ public class DistributedQueueTest extend queueHandles[0].offer(testString.getBytes()); byte dequeuedBytes[] = queueHandles[1].remove(); - assertEquals(new String(dequeuedBytes), testString); + Assert.assertEquals(new String(dequeuedBytes), testString); } + @Test public void testTake1() throws Exception { String dir = "/testTake1"; String testString = "Hello World"; @@ -84,11 +88,12 @@ public class DistributedQueueTest extend queueHandles[0].offer(testString.getBytes()); byte dequeuedBytes[] = queueHandles[0].take(); - assertEquals(new String(dequeuedBytes), testString); + Assert.assertEquals(new String(dequeuedBytes), testString); } + @Test public void testRemove1() throws Exception{ String dir = "/testRemove1"; String testString = "Hello World"; @@ -105,7 +110,7 @@ public class DistributedQueueTest extend }catch(NoSuchElementException e){ return; } - assertTrue(false); + Assert.assertTrue(false); } public void createNremoveMtest(String dir,int n,int m) throws Exception{ @@ -127,12 +132,14 @@ public class DistributedQueueTest extend for(int i=0; i