hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1200199 - in /hadoop/common/branches/branch-0.20-security-205: CHANGES.txt src/test/org/apache/hadoop/hdfs/server/namenode/TestHost2NodesMap.java
Date Thu, 10 Nov 2011 07:17:06 GMT
Author: mattf
Date: Thu Nov 10 07:17:05 2011
New Revision: 1200199

URL: http://svn.apache.org/viewvc?rev=1200199&view=rev
Log:
HDFS-2346. TestHost2NodesMap & TestReplicasMap will fail depending upon execution order
of test methods. Contributed by Laxman and Uma Maheswara Rao.

Modified:
    hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
    hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/hdfs/server/namenode/TestHost2NodesMap.java

Modified: hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/CHANGES.txt?rev=1200199&r1=1200198&r2=1200199&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security-205/CHANGES.txt Thu Nov 10 07:17:05 2011
@@ -33,6 +33,9 @@ Release 0.20.205.1 - unreleased
 
   BUG FIXES
 
+    HDFS-2346. TestHost2NodesMap & TestReplicasMap will fail depending upon 
+    execution order of test methods. (Laxman and Uma Maheswara Rao via Matt Foley)
+
     MAPREDUCE-3374. src/c++/task-controller/configure is not set executable in 
     the tarball and that prevents task-controller from rebuilding. 
     (Roman Shaposhnik via Matt Foley)

Modified: hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/hdfs/server/namenode/TestHost2NodesMap.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/hdfs/server/namenode/TestHost2NodesMap.java?rev=1200199&r1=1200198&r2=1200199&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/hdfs/server/namenode/TestHost2NodesMap.java
(original)
+++ hadoop/common/branches/branch-0.20-security-205/src/test/org/apache/hadoop/hdfs/server/namenode/TestHost2NodesMap.java
Thu Nov 10 07:17:05 2011
@@ -18,29 +18,34 @@
 
 package org.apache.hadoop.hdfs.server.namenode;
 
-import org.apache.hadoop.hdfs.protocol.DatanodeID;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-import junit.framework.TestCase;
+import org.apache.hadoop.hdfs.protocol.DatanodeID;
+import org.junit.Before;
+import org.junit.Test;
 
-public class TestHost2NodesMap extends TestCase {
-  static private Host2NodesMap map = new Host2NodesMap();
-  private final static DatanodeDescriptor dataNodes[] = new DatanodeDescriptor[] {
+public class TestHost2NodesMap {
+    private Host2NodesMap map = new Host2NodesMap();
+    private final DatanodeDescriptor dataNodes[] = new DatanodeDescriptor[] {
     new DatanodeDescriptor(new DatanodeID("h1:5020"), "/d1/r1"),
     new DatanodeDescriptor(new DatanodeID("h2:5020"), "/d1/r1"),
     new DatanodeDescriptor(new DatanodeID("h3:5020"), "/d1/r2"),
     new DatanodeDescriptor(new DatanodeID("h3:5030"), "/d1/r2"),
   };
-  private final static DatanodeDescriptor NULL_NODE = null; 
-  private final static DatanodeDescriptor NODE = 
+  private final DatanodeDescriptor NULL_NODE = null; 
+  private final DatanodeDescriptor NODE = 
     new DatanodeDescriptor(new DatanodeID("h3:5040"), "/d1/r4");
 
-  static {
+  @Before
+  public void setup() {
     for(DatanodeDescriptor node:dataNodes) {
       map.add(node);
     }
     map.add(NULL_NODE);
   }
   
+  @Test
   public void testContains() throws Exception {
     for(int i=0; i<dataNodes.length; i++) {
       assertTrue(map.contains(dataNodes[i]));
@@ -49,6 +54,7 @@ public class TestHost2NodesMap extends T
     assertFalse(map.contains(NODE));
   }
 
+  @Test
   public void testGetDatanodeByHost() throws Exception {
     assertTrue(map.getDatanodeByHost("h1")==dataNodes[0]);
     assertTrue(map.getDatanodeByHost("h2")==dataNodes[1]);
@@ -57,6 +63,7 @@ public class TestHost2NodesMap extends T
     assertTrue(null==map.getDatanodeByHost("h4"));
   }
 
+  @Test
   public void testGetDatanodeByName() throws Exception {
     assertTrue(map.getDatanodeByName("h1:5020")==dataNodes[0]);
     assertTrue(map.getDatanodeByName("h1:5030")==null);
@@ -69,6 +76,7 @@ public class TestHost2NodesMap extends T
     assertTrue(map.getDatanodeByName(null)==null);
   }
 
+  @Test
   public void testRemove() throws Exception {
     assertFalse(map.remove(NODE));
     



Mime
View raw message