From 2738759fb5ab78f39c0051291143eba004233d86 Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Wed, 28 Sep 2011 19:00:46 +0000 Subject: [PATCH] svn merge -c 1176994 from trunk for HDFS-2346. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1177019 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../blockmanagement/TestHost2NodesMap.java | 26 ++++++++++++------- .../hdfs/server/datanode/TestReplicasMap.java | 17 +++++++----- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 408fb1e80db..a99fe1731f8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1021,6 +1021,9 @@ Release 0.23.0 - Unreleased HDFS-2323. start-dfs.sh script fails for tarball install (tomwhite) + HDFS-2346. TestHost2NodesMap & TestReplicasMap will fail depending upon + execution order of test methods (Laxman via atm) + BREAKDOWN OF HDFS-1073 SUBTASKS HDFS-1521. Persist transaction ID on disk between NN restarts. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestHost2NodesMap.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestHost2NodesMap.java index 7b9126f7de8..d34cf1c4c6e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestHost2NodesMap.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestHost2NodesMap.java @@ -18,31 +18,34 @@ package org.apache.hadoop.hdfs.server.blockmanagement; -import junit.framework.TestCase; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.apache.hadoop.hdfs.protocol.DatanodeID; -import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor; -import org.apache.hadoop.hdfs.server.blockmanagement.Host2NodesMap; +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 = - new DatanodeDescriptor(new DatanodeID("h3:5040"), "/d1/r4"); + 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