hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkesa...@apache.org
Subject svn commit: r1369164 [4/16] - in /hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project: ./ hadoop-hdfs-httpfs/ hadoop-hdfs-httpfs/dev-support/ hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/ hadoop-hdfs-httpfs/src/main/java/or...
Date Fri, 03 Aug 2012 19:00:59 GMT
Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/instrumentation/TestInstrumentationService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/instrumentation/TestInstrumentationService.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/instrumentation/TestInstrumentationService.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/instrumentation/TestInstrumentationService.java Fri Aug  3 19:00:15 2012
@@ -18,7 +18,16 @@
 
 package org.apache.hadoop.lib.service.instrumentation;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.lib.server.Server;
 import org.apache.hadoop.lib.service.Instrumentation;
@@ -27,15 +36,11 @@ import org.apache.hadoop.test.HTestCase;
 import org.apache.hadoop.test.TestDir;
 import org.apache.hadoop.test.TestDirHelper;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.Time;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
 import org.junit.Test;
 
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
 public class TestInstrumentationService extends HTestCase {
 
   @Override
@@ -46,51 +51,51 @@ public class TestInstrumentationService 
   @Test
   public void cron() {
     InstrumentationService.Cron cron = new InstrumentationService.Cron();
-    Assert.assertEquals(cron.start, 0);
-    Assert.assertEquals(cron.lapStart, 0);
-    Assert.assertEquals(cron.own, 0);
-    Assert.assertEquals(cron.total, 0);
-    long begin = System.currentTimeMillis();
-    Assert.assertEquals(cron.start(), cron);
-    Assert.assertEquals(cron.start(), cron);
-    Assert.assertEquals(cron.start, begin, 20);
-    Assert.assertEquals(cron.start, cron.lapStart);
+    assertEquals(cron.start, 0);
+    assertEquals(cron.lapStart, 0);
+    assertEquals(cron.own, 0);
+    assertEquals(cron.total, 0);
+    long begin = Time.now();
+    assertEquals(cron.start(), cron);
+    assertEquals(cron.start(), cron);
+    assertEquals(cron.start, begin, 20);
+    assertEquals(cron.start, cron.lapStart);
     sleep(100);
-    Assert.assertEquals(cron.stop(), cron);
-    long end = System.currentTimeMillis();
+    assertEquals(cron.stop(), cron);
+    long end = Time.now();
     long delta = end - begin;
-    Assert.assertEquals(cron.own, delta, 20);
-    Assert.assertEquals(cron.total, 0);
-    Assert.assertEquals(cron.lapStart, 0);
+    assertEquals(cron.own, delta, 20);
+    assertEquals(cron.total, 0);
+    assertEquals(cron.lapStart, 0);
     sleep(100);
-    long reStart = System.currentTimeMillis();
+    long reStart = Time.now();
     cron.start();
-    Assert.assertEquals(cron.start, begin, 20);
-    Assert.assertEquals(cron.lapStart, reStart, 20);
+    assertEquals(cron.start, begin, 20);
+    assertEquals(cron.lapStart, reStart, 20);
     sleep(100);
     cron.stop();
-    long reEnd = System.currentTimeMillis();
+    long reEnd = Time.now();
     delta += reEnd - reStart;
-    Assert.assertEquals(cron.own, delta, 20);
-    Assert.assertEquals(cron.total, 0);
-    Assert.assertEquals(cron.lapStart, 0);
+    assertEquals(cron.own, delta, 20);
+    assertEquals(cron.total, 0);
+    assertEquals(cron.lapStart, 0);
     cron.end();
-    Assert.assertEquals(cron.total, reEnd - begin, 20);
+    assertEquals(cron.total, reEnd - begin, 20);
 
     try {
       cron.start();
-      Assert.fail();
+      fail();
     } catch (IllegalStateException ex) {
     } catch (Exception ex) {
-      Assert.fail();
+      fail();
     }
 
     try {
       cron.stop();
-      Assert.fail();
+      fail();
     } catch (IllegalStateException ex) {
     } catch (Exception ex) {
-      Assert.fail();
+      fail();
     }
   }
 
@@ -109,22 +114,22 @@ public class TestInstrumentationService 
     long avgOwn;
 
     cron.start();
-    ownStart = System.currentTimeMillis();
+    ownStart = Time.now();
     totalStart = ownStart;
     ownDelta = 0;
     sleep(100);
 
     cron.stop();
-    ownEnd = System.currentTimeMillis();
+    ownEnd = Time.now();
     ownDelta += ownEnd - ownStart;
     sleep(100);
 
     cron.start();
-    ownStart = System.currentTimeMillis();
+    ownStart = Time.now();
     sleep(100);
 
     cron.stop();
-    ownEnd = System.currentTimeMillis();
+    ownEnd = Time.now();
     ownDelta += ownEnd - ownStart;
     totalEnd = ownEnd;
     totalDelta = totalEnd - totalStart;
@@ -134,30 +139,30 @@ public class TestInstrumentationService 
 
     timer.addCron(cron);
     long[] values = timer.getValues();
-    Assert.assertEquals(values[InstrumentationService.Timer.LAST_TOTAL], totalDelta, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.LAST_OWN], ownDelta, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.AVG_TOTAL], avgTotal, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.AVG_OWN], avgOwn, 20);
+    assertEquals(values[InstrumentationService.Timer.LAST_TOTAL], totalDelta, 20);
+    assertEquals(values[InstrumentationService.Timer.LAST_OWN], ownDelta, 20);
+    assertEquals(values[InstrumentationService.Timer.AVG_TOTAL], avgTotal, 20);
+    assertEquals(values[InstrumentationService.Timer.AVG_OWN], avgOwn, 20);
 
     cron = new InstrumentationService.Cron();
 
     cron.start();
-    ownStart = System.currentTimeMillis();
+    ownStart = Time.now();
     totalStart = ownStart;
     ownDelta = 0;
     sleep(200);
 
     cron.stop();
-    ownEnd = System.currentTimeMillis();
+    ownEnd = Time.now();
     ownDelta += ownEnd - ownStart;
     sleep(200);
 
     cron.start();
-    ownStart = System.currentTimeMillis();
+    ownStart = Time.now();
     sleep(200);
 
     cron.stop();
-    ownEnd = System.currentTimeMillis();
+    ownEnd = Time.now();
     ownDelta += ownEnd - ownStart;
     totalEnd = ownEnd;
     totalDelta = totalEnd - totalStart;
@@ -167,10 +172,10 @@ public class TestInstrumentationService 
 
     timer.addCron(cron);
     values = timer.getValues();
-    Assert.assertEquals(values[InstrumentationService.Timer.LAST_TOTAL], totalDelta, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.LAST_OWN], ownDelta, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.AVG_TOTAL], avgTotal, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.AVG_OWN], avgOwn, 20);
+    assertEquals(values[InstrumentationService.Timer.LAST_TOTAL], totalDelta, 20);
+    assertEquals(values[InstrumentationService.Timer.LAST_OWN], ownDelta, 20);
+    assertEquals(values[InstrumentationService.Timer.AVG_TOTAL], avgTotal, 20);
+    assertEquals(values[InstrumentationService.Timer.AVG_OWN], avgOwn, 20);
 
     avgTotal = totalDelta;
     avgOwn = ownDelta;
@@ -178,22 +183,22 @@ public class TestInstrumentationService 
     cron = new InstrumentationService.Cron();
 
     cron.start();
-    ownStart = System.currentTimeMillis();
+    ownStart = Time.now();
     totalStart = ownStart;
     ownDelta = 0;
     sleep(300);
 
     cron.stop();
-    ownEnd = System.currentTimeMillis();
+    ownEnd = Time.now();
     ownDelta += ownEnd - ownStart;
     sleep(300);
 
     cron.start();
-    ownStart = System.currentTimeMillis();
+    ownStart = Time.now();
     sleep(300);
 
     cron.stop();
-    ownEnd = System.currentTimeMillis();
+    ownEnd = Time.now();
     ownDelta += ownEnd - ownStart;
     totalEnd = ownEnd;
     totalDelta = totalEnd - totalStart;
@@ -204,27 +209,27 @@ public class TestInstrumentationService 
     cron.stop();
     timer.addCron(cron);
     values = timer.getValues();
-    Assert.assertEquals(values[InstrumentationService.Timer.LAST_TOTAL], totalDelta, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.LAST_OWN], ownDelta, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.AVG_TOTAL], avgTotal, 20);
-    Assert.assertEquals(values[InstrumentationService.Timer.AVG_OWN], avgOwn, 20);
+    assertEquals(values[InstrumentationService.Timer.LAST_TOTAL], totalDelta, 20);
+    assertEquals(values[InstrumentationService.Timer.LAST_OWN], ownDelta, 20);
+    assertEquals(values[InstrumentationService.Timer.AVG_TOTAL], avgTotal, 20);
+    assertEquals(values[InstrumentationService.Timer.AVG_OWN], avgOwn, 20);
 
     JSONObject json = (JSONObject) new JSONParser().parse(timer.toJSONString());
-    Assert.assertEquals(json.size(), 4);
-    Assert.assertEquals(json.get("lastTotal"), values[InstrumentationService.Timer.LAST_TOTAL]);
-    Assert.assertEquals(json.get("lastOwn"), values[InstrumentationService.Timer.LAST_OWN]);
-    Assert.assertEquals(json.get("avgTotal"), values[InstrumentationService.Timer.AVG_TOTAL]);
-    Assert.assertEquals(json.get("avgOwn"), values[InstrumentationService.Timer.AVG_OWN]);
+    assertEquals(json.size(), 4);
+    assertEquals(json.get("lastTotal"), values[InstrumentationService.Timer.LAST_TOTAL]);
+    assertEquals(json.get("lastOwn"), values[InstrumentationService.Timer.LAST_OWN]);
+    assertEquals(json.get("avgTotal"), values[InstrumentationService.Timer.AVG_TOTAL]);
+    assertEquals(json.get("avgOwn"), values[InstrumentationService.Timer.AVG_OWN]);
 
     StringWriter writer = new StringWriter();
     timer.writeJSONString(writer);
     writer.close();
     json = (JSONObject) new JSONParser().parse(writer.toString());
-    Assert.assertEquals(json.size(), 4);
-    Assert.assertEquals(json.get("lastTotal"), values[InstrumentationService.Timer.LAST_TOTAL]);
-    Assert.assertEquals(json.get("lastOwn"), values[InstrumentationService.Timer.LAST_OWN]);
-    Assert.assertEquals(json.get("avgTotal"), values[InstrumentationService.Timer.AVG_TOTAL]);
-    Assert.assertEquals(json.get("avgOwn"), values[InstrumentationService.Timer.AVG_OWN]);
+    assertEquals(json.size(), 4);
+    assertEquals(json.get("lastTotal"), values[InstrumentationService.Timer.LAST_TOTAL]);
+    assertEquals(json.get("lastOwn"), values[InstrumentationService.Timer.LAST_OWN]);
+    assertEquals(json.get("avgTotal"), values[InstrumentationService.Timer.AVG_TOTAL]);
+    assertEquals(json.get("avgOwn"), values[InstrumentationService.Timer.AVG_OWN]);
   }
 
   @Test
@@ -239,34 +244,34 @@ public class TestInstrumentationService 
 
     InstrumentationService.Sampler sampler = new InstrumentationService.Sampler();
     sampler.init(4, var);
-    Assert.assertEquals(sampler.getRate(), 0f, 0.0001);
+    assertEquals(sampler.getRate(), 0f, 0.0001);
     sampler.sample();
-    Assert.assertEquals(sampler.getRate(), 0f, 0.0001);
+    assertEquals(sampler.getRate(), 0f, 0.0001);
     value[0] = 1;
     sampler.sample();
-    Assert.assertEquals(sampler.getRate(), (0d + 1) / 2, 0.0001);
+    assertEquals(sampler.getRate(), (0d + 1) / 2, 0.0001);
     value[0] = 2;
     sampler.sample();
-    Assert.assertEquals(sampler.getRate(), (0d + 1 + 2) / 3, 0.0001);
+    assertEquals(sampler.getRate(), (0d + 1 + 2) / 3, 0.0001);
     value[0] = 3;
     sampler.sample();
-    Assert.assertEquals(sampler.getRate(), (0d + 1 + 2 + 3) / 4, 0.0001);
+    assertEquals(sampler.getRate(), (0d + 1 + 2 + 3) / 4, 0.0001);
     value[0] = 4;
     sampler.sample();
-    Assert.assertEquals(sampler.getRate(), (4d + 1 + 2 + 3) / 4, 0.0001);
+    assertEquals(sampler.getRate(), (4d + 1 + 2 + 3) / 4, 0.0001);
 
     JSONObject json = (JSONObject) new JSONParser().parse(sampler.toJSONString());
-    Assert.assertEquals(json.size(), 2);
-    Assert.assertEquals(json.get("sampler"), sampler.getRate());
-    Assert.assertEquals(json.get("size"), 4L);
+    assertEquals(json.size(), 2);
+    assertEquals(json.get("sampler"), sampler.getRate());
+    assertEquals(json.get("size"), 4L);
 
     StringWriter writer = new StringWriter();
     sampler.writeJSONString(writer);
     writer.close();
     json = (JSONObject) new JSONParser().parse(writer.toString());
-    Assert.assertEquals(json.size(), 2);
-    Assert.assertEquals(json.get("sampler"), sampler.getRate());
-    Assert.assertEquals(json.get("size"), 4L);
+    assertEquals(json.size(), 2);
+    assertEquals(json.get("sampler"), sampler.getRate());
+    assertEquals(json.get("size"), 4L);
   }
 
   @Test
@@ -282,15 +287,15 @@ public class TestInstrumentationService 
     };
 
     JSONObject json = (JSONObject) new JSONParser().parse(variableHolder.toJSONString());
-    Assert.assertEquals(json.size(), 1);
-    Assert.assertEquals(json.get("value"), "foo");
+    assertEquals(json.size(), 1);
+    assertEquals(json.get("value"), "foo");
 
     StringWriter writer = new StringWriter();
     variableHolder.writeJSONString(writer);
     writer.close();
     json = (JSONObject) new JSONParser().parse(writer.toString());
-    Assert.assertEquals(json.size(), 1);
-    Assert.assertEquals(json.get("value"), "foo");
+    assertEquals(json.size(), 1);
+    assertEquals(json.get("value"), "foo");
   }
 
   @Test
@@ -305,7 +310,7 @@ public class TestInstrumentationService 
     server.init();
 
     Instrumentation instrumentation = server.get(Instrumentation.class);
-    Assert.assertNotNull(instrumentation);
+    assertNotNull(instrumentation);
     instrumentation.incr("g", "c", 1);
     instrumentation.incr("g", "c", 2);
     instrumentation.incr("g", "c1", 2);
@@ -338,27 +343,27 @@ public class TestInstrumentationService 
     instrumentation.addSampler("g", "s", 10, varToSample);
 
     Map<String, ?> snapshot = instrumentation.getSnapshot();
-    Assert.assertNotNull(snapshot.get("os-env"));
-    Assert.assertNotNull(snapshot.get("sys-props"));
-    Assert.assertNotNull(snapshot.get("jvm"));
-    Assert.assertNotNull(snapshot.get("counters"));
-    Assert.assertNotNull(snapshot.get("timers"));
-    Assert.assertNotNull(snapshot.get("variables"));
-    Assert.assertNotNull(snapshot.get("samplers"));
-    Assert.assertNotNull(((Map<String, String>) snapshot.get("os-env")).get("PATH"));
-    Assert.assertNotNull(((Map<String, String>) snapshot.get("sys-props")).get("java.version"));
-    Assert.assertNotNull(((Map<String, ?>) snapshot.get("jvm")).get("free.memory"));
-    Assert.assertNotNull(((Map<String, ?>) snapshot.get("jvm")).get("max.memory"));
-    Assert.assertNotNull(((Map<String, ?>) snapshot.get("jvm")).get("total.memory"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("counters")).get("g"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("timers")).get("g"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("variables")).get("g"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("samplers")).get("g"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("counters")).get("g").get("c"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("counters")).get("g").get("c1"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("timers")).get("g").get("t"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("variables")).get("g").get("v"));
-    Assert.assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("samplers")).get("g").get("s"));
+    assertNotNull(snapshot.get("os-env"));
+    assertNotNull(snapshot.get("sys-props"));
+    assertNotNull(snapshot.get("jvm"));
+    assertNotNull(snapshot.get("counters"));
+    assertNotNull(snapshot.get("timers"));
+    assertNotNull(snapshot.get("variables"));
+    assertNotNull(snapshot.get("samplers"));
+    assertNotNull(((Map<String, String>) snapshot.get("os-env")).get("PATH"));
+    assertNotNull(((Map<String, String>) snapshot.get("sys-props")).get("java.version"));
+    assertNotNull(((Map<String, ?>) snapshot.get("jvm")).get("free.memory"));
+    assertNotNull(((Map<String, ?>) snapshot.get("jvm")).get("max.memory"));
+    assertNotNull(((Map<String, ?>) snapshot.get("jvm")).get("total.memory"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("counters")).get("g"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("timers")).get("g"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("variables")).get("g"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("samplers")).get("g"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("counters")).get("g").get("c"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("counters")).get("g").get("c1"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("timers")).get("g").get("t"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("variables")).get("g").get("v"));
+    assertNotNull(((Map<String, Map<String, Object>>) snapshot.get("samplers")).get("g").get("s"));
 
     StringWriter writer = new StringWriter();
     JSONObject.writeJSONString(snapshot, writer);
@@ -391,12 +396,12 @@ public class TestInstrumentationService 
 
     sleep(2000);
     int i = count.get();
-    Assert.assertTrue(i > 0);
+    assertTrue(i > 0);
 
     Map<String, Map<String, ?>> snapshot = instrumentation.getSnapshot();
     Map<String, Map<String, Object>> samplers = (Map<String, Map<String, Object>>) snapshot.get("samplers");
     InstrumentationService.Sampler sampler = (InstrumentationService.Sampler) samplers.get("g").get("s");
-    Assert.assertTrue(sampler.getRate() > 0);
+    assertTrue(sampler.getRate() > 0);
 
     server.destroy();
   }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/scheduler/TestSchedulerService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/scheduler/TestSchedulerService.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/scheduler/TestSchedulerService.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/scheduler/TestSchedulerService.java Fri Aug  3 19:00:15 2012
@@ -18,7 +18,10 @@
 
 package org.apache.hadoop.lib.service.scheduler;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Arrays;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.lib.server.Server;
 import org.apache.hadoop.lib.service.Scheduler;
@@ -29,8 +32,6 @@ import org.apache.hadoop.test.TestDirHel
 import org.apache.hadoop.util.StringUtils;
 import org.junit.Test;
 
-import java.util.Arrays;
-
 public class TestSchedulerService extends HTestCase {
 
   @Test
@@ -42,7 +43,7 @@ public class TestSchedulerService extend
                                                                     SchedulerService.class.getName())));
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
-    Assert.assertNotNull(server.get(Scheduler.class));
+    assertNotNull(server.get(Scheduler.class));
     server.destroy();
   }
 

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java Fri Aug  3 19:00:15 2012
@@ -17,14 +17,14 @@
  */
 package org.apache.hadoop.lib.service.security;
 
-import org.apache.hadoop.security.GroupMappingServiceProvider;
-import org.apache.hadoop.test.HadoopUsersConfTestHelper;
-
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.security.GroupMappingServiceProvider;
+import org.apache.hadoop.test.HadoopUsersConfTestHelper;
+
 public class DummyGroupMapping implements GroupMappingServiceProvider {
 
   @Override

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestGroupsService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestGroupsService.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestGroupsService.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestGroupsService.java Fri Aug  3 19:00:15 2012
@@ -18,7 +18,12 @@
 
 package org.apache.hadoop.lib.service.security;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.lib.server.Server;
 import org.apache.hadoop.lib.service.Groups;
@@ -28,9 +33,6 @@ import org.apache.hadoop.test.TestDirHel
 import org.apache.hadoop.util.StringUtils;
 import org.junit.Test;
 
-import java.util.Arrays;
-import java.util.List;
-
 public class TestGroupsService extends HTestCase {
 
   @Test
@@ -42,9 +44,9 @@ public class TestGroupsService extends H
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     Groups groups = server.get(Groups.class);
-    Assert.assertNotNull(groups);
+    assertNotNull(groups);
     List<String> g = groups.getGroups(System.getProperty("user.name"));
-    Assert.assertNotSame(g.size(), 0);
+    assertNotSame(g.size(), 0);
     server.destroy();
   }
 

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestProxyUserService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestProxyUserService.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestProxyUserService.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/TestProxyUserService.java Fri Aug  3 19:00:15 2012
@@ -18,7 +18,12 @@
 
 package org.apache.hadoop.lib.service.security;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertNotNull;
+
+import java.security.AccessControlException;
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.lib.server.Server;
 import org.apache.hadoop.lib.server.ServiceException;
@@ -31,10 +36,6 @@ import org.apache.hadoop.test.TestExcept
 import org.apache.hadoop.util.StringUtils;
 import org.junit.Test;
 
-import java.security.AccessControlException;
-import java.util.Arrays;
-import java.util.List;
-
 public class TestProxyUserService extends HTestCase {
 
   @Test
@@ -47,7 +48,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     server.destroy();
   }
 
@@ -103,7 +104,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("foo", "localhost", "bar");
     server.destroy();
   }
@@ -120,7 +121,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("bar", "localhost", "foo");
     server.destroy();
   }
@@ -137,7 +138,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("foo", "localhost", "bar");
     server.destroy();
   }
@@ -166,7 +167,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("foo", "localhost", System.getProperty("user.name"));
     server.destroy();
   }
@@ -184,7 +185,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("foo", "unknownhost.bar.foo", "bar");
     server.destroy();
   }
@@ -201,7 +202,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("foo", "www.yahoo.com", "bar");
     server.destroy();
   }
@@ -218,7 +219,7 @@ public class TestProxyUserService extend
     Server server = new Server("server", dir, dir, dir, dir, conf);
     server.init();
     ProxyUser proxyUser = server.get(ProxyUser.class);
-    Assert.assertNotNull(proxyUser);
+    assertNotNull(proxyUser);
     proxyUser.validate("foo", "localhost", System.getProperty("user.name"));
     server.destroy();
   }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestHostnameFilter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestHostnameFilter.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestHostnameFilter.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestHostnameFilter.java Fri Aug  3 19:00:15 2012
@@ -18,18 +18,21 @@
 
 package org.apache.hadoop.lib.servlet;
 
-import junit.framework.Assert;
-import org.apache.hadoop.test.HTestCase;
-import org.junit.Test;
-import org.mockito.Mockito;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import java.io.IOException;
-import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.hadoop.test.HTestCase;
+import org.junit.Test;
+import org.mockito.Mockito;
 
 
 public class TestHostnameFilter extends HTestCase {
@@ -47,17 +50,17 @@ public class TestHostnameFilter extends 
       @Override
       public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
         throws IOException, ServletException {
-        Assert.assertTrue(HostnameFilter.get().contains("localhost"));
+        assertTrue(HostnameFilter.get().contains("localhost"));
         invoked.set(true);
       }
     };
 
     Filter filter = new HostnameFilter();
     filter.init(null);
-    Assert.assertNull(HostnameFilter.get());
+    assertNull(HostnameFilter.get());
     filter.doFilter(request, response, chain);
-    Assert.assertTrue(invoked.get());
-    Assert.assertNull(HostnameFilter.get());
+    assertTrue(invoked.get());
+    assertNull(HostnameFilter.get());
     filter.destroy();
   }
 

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestMDCFilter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestMDCFilter.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestMDCFilter.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestMDCFilter.java Fri Aug  3 19:00:15 2012
@@ -18,11 +18,13 @@
 
 package org.apache.hadoop.lib.servlet;
 
-import junit.framework.Assert;
-import org.apache.hadoop.test.HTestCase;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.slf4j.MDC;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -30,9 +32,11 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.security.Principal;
-import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.hadoop.test.HTestCase;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.MDC;
 
 
 public class TestMDCFilter extends HTestCase {
@@ -52,10 +56,10 @@ public class TestMDCFilter extends HTest
       @Override
       public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
         throws IOException, ServletException {
-        Assert.assertEquals(MDC.get("hostname"), null);
-        Assert.assertEquals(MDC.get("user"), null);
-        Assert.assertEquals(MDC.get("method"), "METHOD");
-        Assert.assertEquals(MDC.get("path"), "/pathinfo");
+        assertEquals(MDC.get("hostname"), null);
+        assertEquals(MDC.get("user"), null);
+        assertEquals(MDC.get("method"), "METHOD");
+        assertEquals(MDC.get("path"), "/pathinfo");
         invoked.set(true);
       }
     };
@@ -65,11 +69,11 @@ public class TestMDCFilter extends HTest
     filter.init(null);
 
     filter.doFilter(request, response, chain);
-    Assert.assertTrue(invoked.get());
-    Assert.assertNull(MDC.get("hostname"));
-    Assert.assertNull(MDC.get("user"));
-    Assert.assertNull(MDC.get("method"));
-    Assert.assertNull(MDC.get("path"));
+    assertTrue(invoked.get());
+    assertNull(MDC.get("hostname"));
+    assertNull(MDC.get("user"));
+    assertNull(MDC.get("method"));
+    assertNull(MDC.get("path"));
 
     Mockito.when(request.getUserPrincipal()).thenReturn(new Principal() {
       @Override
@@ -83,15 +87,15 @@ public class TestMDCFilter extends HTest
       @Override
       public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
         throws IOException, ServletException {
-        Assert.assertEquals(MDC.get("hostname"), null);
-        Assert.assertEquals(MDC.get("user"), "name");
-        Assert.assertEquals(MDC.get("method"), "METHOD");
-        Assert.assertEquals(MDC.get("path"), "/pathinfo");
+        assertEquals(MDC.get("hostname"), null);
+        assertEquals(MDC.get("user"), "name");
+        assertEquals(MDC.get("method"), "METHOD");
+        assertEquals(MDC.get("path"), "/pathinfo");
         invoked.set(true);
       }
     };
     filter.doFilter(request, response, chain);
-    Assert.assertTrue(invoked.get());
+    assertTrue(invoked.get());
 
     HostnameFilter.HOSTNAME_TL.set("HOST");
 
@@ -100,15 +104,15 @@ public class TestMDCFilter extends HTest
       @Override
       public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
         throws IOException, ServletException {
-        Assert.assertEquals(MDC.get("hostname"), "HOST");
-        Assert.assertEquals(MDC.get("user"), "name");
-        Assert.assertEquals(MDC.get("method"), "METHOD");
-        Assert.assertEquals(MDC.get("path"), "/pathinfo");
+        assertEquals(MDC.get("hostname"), "HOST");
+        assertEquals(MDC.get("user"), "name");
+        assertEquals(MDC.get("method"), "METHOD");
+        assertEquals(MDC.get("path"), "/pathinfo");
         invoked.set(true);
       }
     };
     filter.doFilter(request, response, chain);
-    Assert.assertTrue(invoked.get());
+    assertTrue(invoked.get());
 
     HostnameFilter.HOSTNAME_TL.remove();
 

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestServerWebApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestServerWebApp.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestServerWebApp.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/servlet/TestServerWebApp.java Fri Aug  3 19:00:15 2012
@@ -18,7 +18,8 @@
 
 package org.apache.hadoop.lib.servlet;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
+
 import org.apache.hadoop.lib.server.Server;
 import org.apache.hadoop.test.HTestCase;
 import org.apache.hadoop.test.TestDir;
@@ -35,10 +36,10 @@ public class TestServerWebApp extends HT
   @Test
   public void getHomeDir() {
     System.setProperty("TestServerWebApp0.home.dir", "/tmp");
-    Assert.assertEquals(ServerWebApp.getHomeDir("TestServerWebApp0"), "/tmp");
-    Assert.assertEquals(ServerWebApp.getDir("TestServerWebApp0", ".log.dir", "/tmp/log"), "/tmp/log");
+    assertEquals(ServerWebApp.getHomeDir("TestServerWebApp0"), "/tmp");
+    assertEquals(ServerWebApp.getDir("TestServerWebApp0", ".log.dir", "/tmp/log"), "/tmp/log");
     System.setProperty("TestServerWebApp0.log.dir", "/tmplog");
-    Assert.assertEquals(ServerWebApp.getDir("TestServerWebApp0", ".log.dir", "/tmp/log"), "/tmplog");
+    assertEquals(ServerWebApp.getDir("TestServerWebApp0", ".log.dir", "/tmp/log"), "/tmplog");
   }
 
   @Test
@@ -52,11 +53,11 @@ public class TestServerWebApp extends HT
     ServerWebApp server = new ServerWebApp("TestServerWebApp1") {
     };
 
-    Assert.assertEquals(server.getStatus(), Server.Status.UNDEF);
+    assertEquals(server.getStatus(), Server.Status.UNDEF);
     server.contextInitialized(null);
-    Assert.assertEquals(server.getStatus(), Server.Status.NORMAL);
+    assertEquals(server.getStatus(), Server.Status.NORMAL);
     server.contextDestroyed(null);
-    Assert.assertEquals(server.getStatus(), Server.Status.SHUTDOWN);
+    assertEquals(server.getStatus(), Server.Status.SHUTDOWN);
   }
 
   @Test(expected = RuntimeException.class)

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestCheck.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestCheck.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestCheck.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestCheck.java Fri Aug  3 19:00:15 2012
@@ -19,18 +19,19 @@
 package org.apache.hadoop.lib.util;
 
 
-import junit.framework.Assert;
-import org.apache.hadoop.test.HTestCase;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 
+import org.apache.hadoop.test.HTestCase;
+import org.junit.Test;
+
 public class TestCheck extends HTestCase {
 
   @Test
   public void notNullNotNull() {
-    Assert.assertEquals(Check.notNull("value", "name"), "value");
+    assertEquals(Check.notNull("value", "name"), "value");
   }
 
   @Test(expected = IllegalArgumentException.class)
@@ -79,7 +80,7 @@ public class TestCheck extends HTestCase
 
   @Test
   public void notEmptyNotEmtpy() {
-    Assert.assertEquals(Check.notEmpty("value", "name"), "value");
+    assertEquals(Check.notEmpty("value", "name"), "value");
   }
 
   @Test(expected = IllegalArgumentException.class)
@@ -94,10 +95,10 @@ public class TestCheck extends HTestCase
 
   @Test
   public void validIdentifierValid() throws Exception {
-    Assert.assertEquals(Check.validIdentifier("a", 1, ""), "a");
-    Assert.assertEquals(Check.validIdentifier("a1", 2, ""), "a1");
-    Assert.assertEquals(Check.validIdentifier("a_", 3, ""), "a_");
-    Assert.assertEquals(Check.validIdentifier("_", 1, ""), "_");
+    assertEquals(Check.validIdentifier("a", 1, ""), "a");
+    assertEquals(Check.validIdentifier("a1", 2, ""), "a1");
+    assertEquals(Check.validIdentifier("a_", 3, ""), "a_");
+    assertEquals(Check.validIdentifier("_", 1, ""), "_");
   }
 
   @Test(expected = IllegalArgumentException.class)
@@ -117,7 +118,7 @@ public class TestCheck extends HTestCase
 
   @Test
   public void checkGTZeroGreater() {
-    Assert.assertEquals(Check.gt0(120, "test"), 120);
+    assertEquals(Check.gt0(120, "test"), 120);
   }
 
   @Test(expected = IllegalArgumentException.class)
@@ -132,8 +133,8 @@ public class TestCheck extends HTestCase
 
   @Test
   public void checkGEZero() {
-    Assert.assertEquals(Check.ge0(120, "test"), 120);
-    Assert.assertEquals(Check.ge0(0, "test"), 0);
+    assertEquals(Check.ge0(120, "test"), 120);
+    assertEquals(Check.ge0(0, "test"), 0);
   }
 
   @Test(expected = IllegalArgumentException.class)

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestConfigurationUtils.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestConfigurationUtils.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestConfigurationUtils.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/util/TestConfigurationUtils.java Fri Aug  3 19:00:15 2012
@@ -18,27 +18,29 @@
 
 package org.apache.hadoop.lib.util;
 
-import junit.framework.Assert;
-import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Test;
+
 public class TestConfigurationUtils {
 
   @Test
   public void constructors() throws Exception {
     Configuration conf = new Configuration(false);
-    Assert.assertEquals(conf.size(), 0);
+    assertEquals(conf.size(), 0);
 
     byte[] bytes = "<configuration><property><name>a</name><value>A</value></property></configuration>".getBytes();
     InputStream is = new ByteArrayInputStream(bytes);
     conf = new Configuration(false);
     ConfigurationUtils.load(conf, is);
-    Assert.assertEquals(conf.size(), 1);
-    Assert.assertEquals(conf.get("a"), "A");
+    assertEquals(conf.size(), 1);
+    assertEquals(conf.get("a"), "A");
   }
 
 
@@ -62,9 +64,9 @@ public class TestConfigurationUtils {
 
     ConfigurationUtils.copy(srcConf, targetConf);
 
-    Assert.assertEquals("valueFromSource", targetConf.get("testParameter1"));
-    Assert.assertEquals("valueFromSource", targetConf.get("testParameter2"));
-    Assert.assertEquals("valueFromTarget", targetConf.get("testParameter3"));
+    assertEquals("valueFromSource", targetConf.get("testParameter1"));
+    assertEquals("valueFromSource", targetConf.get("testParameter2"));
+    assertEquals("valueFromTarget", targetConf.get("testParameter3"));
   }
 
   @Test
@@ -80,13 +82,13 @@ public class TestConfigurationUtils {
 
     ConfigurationUtils.injectDefaults(srcConf, targetConf);
 
-    Assert.assertEquals("valueFromSource", targetConf.get("testParameter1"));
-    Assert.assertEquals("originalValueFromTarget", targetConf.get("testParameter2"));
-    Assert.assertEquals("originalValueFromTarget", targetConf.get("testParameter3"));
-
-    Assert.assertEquals("valueFromSource", srcConf.get("testParameter1"));
-    Assert.assertEquals("valueFromSource", srcConf.get("testParameter2"));
-    Assert.assertNull(srcConf.get("testParameter3"));
+    assertEquals("valueFromSource", targetConf.get("testParameter1"));
+    assertEquals("originalValueFromTarget", targetConf.get("testParameter2"));
+    assertEquals("originalValueFromTarget", targetConf.get("testParameter3"));
+
+    assertEquals("valueFromSource", srcConf.get("testParameter1"));
+    assertEquals("valueFromSource", srcConf.get("testParameter2"));
+    assertNull(srcConf.get("testParameter3"));
   }
 
 
@@ -95,11 +97,11 @@ public class TestConfigurationUtils {
     Configuration conf = new Configuration(false);
     conf.set("a", "A");
     conf.set("b", "${a}");
-    Assert.assertEquals(conf.getRaw("a"), "A");
-    Assert.assertEquals(conf.getRaw("b"), "${a}");
+    assertEquals(conf.getRaw("a"), "A");
+    assertEquals(conf.getRaw("b"), "${a}");
     conf = ConfigurationUtils.resolve(conf);
-    Assert.assertEquals(conf.getRaw("a"), "A");
-    Assert.assertEquals(conf.getRaw("b"), "A");
+    assertEquals(conf.getRaw("a"), "A");
+    assertEquals(conf.getRaw("b"), "A");
   }
 
   @Test
@@ -110,16 +112,16 @@ public class TestConfigurationUtils {
     conf.set("b", "${a}");
     conf.set("c", "${user.name}");
     conf.set("d", "${aaa}");
-    Assert.assertEquals(conf.getRaw("a"), "A");
-    Assert.assertEquals(conf.getRaw("b"), "${a}");
-    Assert.assertEquals(conf.getRaw("c"), "${user.name}");
-    Assert.assertEquals(conf.get("a"), "A");
-    Assert.assertEquals(conf.get("b"), "A");
-    Assert.assertEquals(conf.get("c"), userName);
-    Assert.assertEquals(conf.get("d"), "${aaa}");
+    assertEquals(conf.getRaw("a"), "A");
+    assertEquals(conf.getRaw("b"), "${a}");
+    assertEquals(conf.getRaw("c"), "${user.name}");
+    assertEquals(conf.get("a"), "A");
+    assertEquals(conf.get("b"), "A");
+    assertEquals(conf.get("c"), userName);
+    assertEquals(conf.get("d"), "${aaa}");
 
     conf.set("user.name", "foo");
-    Assert.assertEquals(conf.get("user.name"), "foo");
+    assertEquals(conf.get("user.name"), "foo");
   }
 
 }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestInputStreamEntity.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestInputStreamEntity.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestInputStreamEntity.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestInputStreamEntity.java Fri Aug  3 19:00:15 2012
@@ -18,13 +18,14 @@
 
 package org.apache.hadoop.lib.wsrs;
 
-import junit.framework.Assert;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 
+import org.junit.Test;
+
 public class TestInputStreamEntity {
 
   @Test
@@ -34,14 +35,14 @@ public class TestInputStreamEntity {
     InputStreamEntity i = new InputStreamEntity(is);
     i.write(baos);
     baos.close();
-    Assert.assertEquals(new String(baos.toByteArray()), "abc");
+    assertEquals(new String(baos.toByteArray()), "abc");
 
     is = new ByteArrayInputStream("abc".getBytes());
     baos = new ByteArrayOutputStream();
     i = new InputStreamEntity(is, 1, 1);
     i.write(baos);
     baos.close();
-    Assert.assertEquals(baos.toByteArray()[0], 'b');
+    assertEquals(baos.toByteArray()[0], 'b');
   }
 
 }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONMapProvider.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONMapProvider.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONMapProvider.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONMapProvider.java Fri Aug  3 19:00:15 2012
@@ -18,28 +18,31 @@
 
 package org.apache.hadoop.lib.wsrs;
 
-import junit.framework.Assert;
-import org.json.simple.JSONObject;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayOutputStream;
 import java.util.Map;
 
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
 public class TestJSONMapProvider {
 
   @Test
   @SuppressWarnings("unchecked")
   public void test() throws Exception {
     JSONMapProvider p = new JSONMapProvider();
-    Assert.assertTrue(p.isWriteable(Map.class, null, null, null));
-    Assert.assertFalse(p.isWriteable(this.getClass(), null, null, null));
-    Assert.assertEquals(p.getSize(null, null, null, null, null), -1);
+    assertTrue(p.isWriteable(Map.class, null, null, null));
+    assertFalse(p.isWriteable(this.getClass(), null, null, null));
+    assertEquals(p.getSize(null, null, null, null, null), -1);
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     JSONObject json = new JSONObject();
     json.put("a", "A");
     p.writeTo(json, JSONObject.class, null, null, null, null, baos);
     baos.close();
-    Assert.assertEquals(new String(baos.toByteArray()).trim(), "{\"a\":\"A\"}");
+    assertEquals(new String(baos.toByteArray()).trim(), "{\"a\":\"A\"}");
   }
 
 }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONProvider.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONProvider.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONProvider.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestJSONProvider.java Fri Aug  3 19:00:15 2012
@@ -18,27 +18,30 @@
 
 package org.apache.hadoop.lib.wsrs;
 
-import junit.framework.Assert;
-import org.json.simple.JSONObject;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayOutputStream;
 
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
 public class TestJSONProvider {
 
   @Test
   @SuppressWarnings("unchecked")
   public void test() throws Exception {
     JSONProvider p = new JSONProvider();
-    Assert.assertTrue(p.isWriteable(JSONObject.class, null, null, null));
-    Assert.assertFalse(p.isWriteable(this.getClass(), null, null, null));
-    Assert.assertEquals(p.getSize(null, null, null, null, null), -1);
+    assertTrue(p.isWriteable(JSONObject.class, null, null, null));
+    assertFalse(p.isWriteable(this.getClass(), null, null, null));
+    assertEquals(p.getSize(null, null, null, null, null), -1);
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     JSONObject json = new JSONObject();
     json.put("a", "A");
     p.writeTo(json, JSONObject.class, null, null, null, null, baos);
     baos.close();
-    Assert.assertEquals(new String(baos.toByteArray()).trim(), "{\"a\":\"A\"}");
+    assertEquals(new String(baos.toByteArray()).trim(), "{\"a\":\"A\"}");
   }
 
 }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestParam.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestParam.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestParam.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestParam.java Fri Aug  3 19:00:15 2012
@@ -18,41 +18,43 @@
 
 package org.apache.hadoop.lib.wsrs;
 
-import junit.framework.Assert;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import java.util.regex.Pattern;
 
+import org.junit.Test;
+
 public class TestParam {
 
   private <T> void test(Param<T> param, String name,
                    String domain, T defaultValue, T validValue,
                    String invalidStrValue, String outOfRangeValue) throws Exception {
 
-    Assert.assertEquals(name, param.getName());
-    Assert.assertEquals(domain, param.getDomain());
-    Assert.assertEquals(defaultValue, param.value());
-    Assert.assertEquals(defaultValue, param.parseParam(""));
-    Assert.assertEquals(defaultValue, param.parseParam(null));
-    Assert.assertEquals(validValue, param.parseParam(validValue.toString()));
+    assertEquals(name, param.getName());
+    assertEquals(domain, param.getDomain());
+    assertEquals(defaultValue, param.value());
+    assertEquals(defaultValue, param.parseParam(""));
+    assertEquals(defaultValue, param.parseParam(null));
+    assertEquals(validValue, param.parseParam(validValue.toString()));
     if (invalidStrValue != null) {
       try {
         param.parseParam(invalidStrValue);
-        Assert.fail();
+        fail();
       } catch (IllegalArgumentException ex) {
         //NOP
       } catch (Exception ex) {
-        Assert.fail();
+        fail();
       }
     }
     if (outOfRangeValue != null) {
       try {
         param.parseParam(outOfRangeValue);
-        Assert.fail();
+        fail();
       } catch (IllegalArgumentException ex) {
         //NOP
       } catch (Exception ex) {
-        Assert.fail();
+        fail();
       }
     }
    }
@@ -81,7 +83,7 @@ public class TestParam {
     param = new ShortParam("S", (short) 1, 8) {
     };
 
-    Assert.assertEquals(new Short((short)01777), param.parse("01777"));
+    assertEquals(new Short((short)01777), param.parse("01777"));
   }
 
   @Test

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestUserProvider.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestUserProvider.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestUserProvider.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/wsrs/TestUserProvider.java Fri Aug  3 19:00:15 2012
@@ -18,16 +18,20 @@
 
 package org.apache.hadoop.lib.wsrs;
 
-import com.sun.jersey.api.core.HttpContext;
-import com.sun.jersey.api.core.HttpRequestContext;
-import com.sun.jersey.core.spi.component.ComponentScope;
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.security.Principal;
+
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.slf4j.MDC;
 
-import javax.ws.rs.core.MultivaluedMap;
-import java.security.Principal;
+import com.sun.jersey.api.core.HttpContext;
+import com.sun.jersey.api.core.HttpRequestContext;
+import com.sun.jersey.core.spi.component.ComponentScope;
 
 public class TestUserProvider {
 
@@ -43,8 +47,8 @@ public class TestUserProvider {
     HttpContext context = Mockito.mock(HttpContext.class);
     Mockito.when(context.getRequest()).thenReturn(request);
     UserProvider up = new UserProvider();
-    Assert.assertNull(up.getValue(context));
-    Assert.assertNull(MDC.get("user"));
+    assertNull(up.getValue(context));
+    assertNull(MDC.get("user"));
   }
 
   @Test
@@ -59,8 +63,8 @@ public class TestUserProvider {
     HttpContext context = Mockito.mock(HttpContext.class);
     Mockito.when(context.getRequest()).thenReturn(request);
     UserProvider up = new UserProvider();
-    Assert.assertEquals(up.getValue(context).getName(), "foo");
-    Assert.assertEquals(MDC.get("user"), "foo");
+    assertEquals(up.getValue(context).getName(), "foo");
+    assertEquals(MDC.get("user"), "foo");
   }
 
   @Test
@@ -77,15 +81,15 @@ public class TestUserProvider {
     HttpContext context = Mockito.mock(HttpContext.class);
     Mockito.when(context.getRequest()).thenReturn(request);
     UserProvider up = new UserProvider();
-    Assert.assertEquals(up.getValue(context).getName(), "bar");
-    Assert.assertEquals(MDC.get("user"), "bar");
+    assertEquals(up.getValue(context).getName(), "bar");
+    assertEquals(MDC.get("user"), "bar");
   }
 
   @Test
   public void getters() {
     UserProvider up = new UserProvider();
-    Assert.assertEquals(up.getScope(), ComponentScope.PerRequest);
-    Assert.assertEquals(up.getInjectable(null, null, Principal.class), up);
-    Assert.assertNull(up.getInjectable(null, null, String.class));
+    assertEquals(up.getScope(), ComponentScope.PerRequest);
+    assertEquals(up.getInjectable(null, null, Principal.class), up);
+    assertNull(up.getInjectable(null, null, String.class));
   }
 }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HTestCase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HTestCase.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HTestCase.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HTestCase.java Fri Aug  3 19:00:15 2012
@@ -17,12 +17,14 @@
  */
 package org.apache.hadoop.test;
 
-import junit.framework.Assert;
-import org.junit.Rule;
-import org.junit.rules.MethodRule;
+import static org.junit.Assert.fail;
 
 import java.text.MessageFormat;
 
+import org.apache.hadoop.util.Time;
+import org.junit.Rule;
+import org.junit.rules.MethodRule;
+
 public abstract class HTestCase {
 
   public static final String TEST_WAITFOR_RATIO_PROP = "test.waitfor.ratio";
@@ -142,29 +144,29 @@ public abstract class HTestCase {
    *         to <code>true</code>.
    */
   protected long waitFor(int timeout, boolean failIfTimeout, Predicate predicate) {
-    long started = System.currentTimeMillis();
-    long mustEnd = System.currentTimeMillis() + (long) (getWaitForRatio() * timeout);
+    long started = Time.now();
+    long mustEnd = Time.now() + (long) (getWaitForRatio() * timeout);
     long lastEcho = 0;
     try {
-      long waiting = mustEnd - System.currentTimeMillis();
+      long waiting = mustEnd - Time.now();
       System.out.println(MessageFormat.format("Waiting up to [{0}] msec", waiting));
       boolean eval;
-      while (!(eval = predicate.evaluate()) && System.currentTimeMillis() < mustEnd) {
-        if ((System.currentTimeMillis() - lastEcho) > 5000) {
-          waiting = mustEnd - System.currentTimeMillis();
+      while (!(eval = predicate.evaluate()) && Time.now() < mustEnd) {
+        if ((Time.now() - lastEcho) > 5000) {
+          waiting = mustEnd - Time.now();
           System.out.println(MessageFormat.format("Waiting up to [{0}] msec", waiting));
-          lastEcho = System.currentTimeMillis();
+          lastEcho = Time.now();
         }
         Thread.sleep(100);
       }
       if (!eval) {
         if (failIfTimeout) {
-          Assert.fail(MessageFormat.format("Waiting timed out after [{0}] msec", timeout));
+          fail(MessageFormat.format("Waiting timed out after [{0}] msec", timeout));
         } else {
           System.out.println(MessageFormat.format("Waiting timed out after [{0}] msec", timeout));
         }
       }
-      return (eval) ? System.currentTimeMillis() - started : -1;
+      return (eval) ? Time.now() - started : -1;
     } catch (Exception ex) {
       throw new RuntimeException(ex);
     }

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HadoopUsersConfTestHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HadoopUsersConfTestHelper.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HadoopUsersConfTestHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/HadoopUsersConfTestHelper.java Fri Aug  3 19:00:15 2012
@@ -17,12 +17,12 @@
  */
 package org.apache.hadoop.test;
 
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.UserGroupInformation;
-
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.UserGroupInformation;
+
 /**
  * Helper to configure FileSystemAccess user/group and proxyuser
  * configuration for testing using Java System properties.

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestDirHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestDirHelper.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestDirHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestDirHelper.java Fri Aug  3 19:00:15 2012
@@ -17,16 +17,16 @@
  */
 package org.apache.hadoop.test;
 
-import org.junit.Test;
-import org.junit.rules.MethodRule;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
 import java.io.File;
 import java.io.IOException;
 import java.text.MessageFormat;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.junit.Test;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
 public class TestDirHelper implements MethodRule {
 
   @Test
@@ -73,7 +73,7 @@ public class TestDirHelper implements Me
         System.exit(-1);
       }
 
-      TEST_DIR_ROOT = new File(TEST_DIR_ROOT, "testdir").getAbsolutePath();
+      TEST_DIR_ROOT = new File(TEST_DIR_ROOT, "test-dir").getAbsolutePath();
       System.setProperty(TEST_DIR_PROP, TEST_DIR_ROOT);
 
       File dir = new File(TEST_DIR_ROOT);
@@ -83,8 +83,6 @@ public class TestDirHelper implements Me
         System.exit(-1);
       }
 
-      System.setProperty("test.circus", "true");
-
       System.out.println(">>> " + TEST_DIR_PROP + "        : " + System.getProperty(TEST_DIR_PROP));
     } catch (IOException ex) {
       throw new RuntimeException(ex);

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestExceptionHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestExceptionHelper.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestExceptionHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestExceptionHelper.java Fri Aug  3 19:00:15 2012
@@ -17,14 +17,15 @@
  */
 package org.apache.hadoop.test;
 
-import junit.framework.Assert;
+import static org.junit.Assert.fail;
+
+import java.util.regex.Pattern;
+
 import org.junit.Test;
 import org.junit.rules.MethodRule;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
 
-import java.util.regex.Pattern;
-
 public class TestExceptionHelper implements MethodRule {
 
   @Test
@@ -41,7 +42,7 @@ public class TestExceptionHelper impleme
           statement.evaluate();
           if (testExceptionAnnotation != null) {
             Class<? extends Throwable> klass = testExceptionAnnotation.exception();
-            Assert.fail("Expected Exception: " + klass.getSimpleName());
+            fail("Expected Exception: " + klass.getSimpleName());
           }
         } catch (Throwable ex) {
           if (testExceptionAnnotation != null) {
@@ -50,10 +51,10 @@ public class TestExceptionHelper impleme
               String regExp = testExceptionAnnotation.msgRegExp();
               Pattern pattern = Pattern.compile(regExp);
               if (!pattern.matcher(ex.getMessage()).find()) {
-                Assert.fail("Expected Exception Message pattern: " + regExp + " got message: " + ex.getMessage());
+                fail("Expected Exception Message pattern: " + regExp + " got message: " + ex.getMessage());
               }
             } else {
-              Assert.fail("Expected Exception: " + klass.getSimpleName() + " got: " + ex.getClass().getSimpleName());
+              fail("Expected Exception: " + klass.getSimpleName() + " got: " + ex.getClass().getSimpleName());
             }
           } else {
             throw ex;

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHFSTestCase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHFSTestCase.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHFSTestCase.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHFSTestCase.java Fri Aug  3 19:00:15 2012
@@ -18,18 +18,9 @@
 
 package org.apache.hadoop.test;
 
-import junit.framework.Assert;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -38,6 +29,19 @@ import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
 
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.util.Time;
+import org.junit.Test;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.Context;
+
 public class TestHFSTestCase extends HFSTestCase {
 
   @Test(expected = IllegalStateException.class)
@@ -68,66 +72,66 @@ public class TestHFSTestCase extends HFS
   @Test
   @TestDir
   public void testDirAnnotation() throws Exception {
-    Assert.assertNotNull(TestDirHelper.getTestDir());
+    assertNotNull(TestDirHelper.getTestDir());
   }
 
   @Test
   public void waitFor() {
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     long waited = waitFor(1000, new Predicate() {
       public boolean evaluate() throws Exception {
         return true;
       }
     });
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(waited, 0, 50);
-    Assert.assertEquals(end - start - waited, 0, 50);
+    long end = Time.now();
+    assertEquals(waited, 0, 50);
+    assertEquals(end - start - waited, 0, 50);
   }
 
   @Test
   public void waitForTimeOutRatio1() {
     setWaitForRatio(1);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     long waited = waitFor(200, new Predicate() {
       public boolean evaluate() throws Exception {
         return false;
       }
     });
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(waited, -1);
-    Assert.assertEquals(end - start, 200, 50);
+    long end = Time.now();
+    assertEquals(waited, -1);
+    assertEquals(end - start, 200, 50);
   }
 
   @Test
   public void waitForTimeOutRatio2() {
     setWaitForRatio(2);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     long waited = waitFor(200, new Predicate() {
       public boolean evaluate() throws Exception {
         return false;
       }
     });
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(waited, -1);
-    Assert.assertEquals(end - start, 200 * getWaitForRatio(), 50 * getWaitForRatio());
+    long end = Time.now();
+    assertEquals(waited, -1);
+    assertEquals(end - start, 200 * getWaitForRatio(), 50 * getWaitForRatio());
   }
 
   @Test
   public void sleepRatio1() {
     setWaitForRatio(1);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     sleep(100);
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(end - start, 100, 50);
+    long end = Time.now();
+    assertEquals(end - start, 100, 50);
   }
 
   @Test
   public void sleepRatio2() {
     setWaitForRatio(1);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     sleep(100);
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(end - start, 100 * getWaitForRatio(), 50 * getWaitForRatio());
+    long end = Time.now();
+    assertEquals(end - start, 100 * getWaitForRatio(), 50 * getWaitForRatio());
   }
 
   @Test
@@ -140,8 +144,8 @@ public class TestHFSTestCase extends HFS
       os.write(new byte[]{1});
       os.close();
       InputStream is = fs.open(new Path(TestHdfsHelper.getHdfsTestDir(), "foo"));
-      Assert.assertEquals(is.read(), 1);
-      Assert.assertEquals(is.read(), -1);
+      assertEquals(is.read(), 1);
+      assertEquals(is.read(), -1);
       is.close();
     } finally {
       fs.close();
@@ -166,9 +170,9 @@ public class TestHFSTestCase extends HFS
     server.start();
     URL url = new URL(TestJettyHelper.getJettyURL(), "/bar");
     HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-    Assert.assertEquals(conn.getResponseCode(), HttpURLConnection.HTTP_OK);
+    assertEquals(conn.getResponseCode(), HttpURLConnection.HTTP_OK);
     BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-    Assert.assertEquals(reader.readLine(), "foo");
+    assertEquals(reader.readLine(), "foo");
     reader.close();
   }
 

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHTestCase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHTestCase.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHTestCase.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHTestCase.java Fri Aug  3 19:00:15 2012
@@ -18,21 +18,25 @@
 
 package org.apache.hadoop.test;
 
-import junit.framework.Assert;
-import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URL;
 
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.hadoop.util.Time;
+import org.junit.Test;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.Context;
+
 public class TestHTestCase extends HTestCase {
 
   @Test(expected = IllegalStateException.class)
@@ -53,66 +57,66 @@ public class TestHTestCase extends HTest
   @Test
   @TestDir
   public void testDirAnnotation() throws Exception {
-    Assert.assertNotNull(TestDirHelper.getTestDir());
+    assertNotNull(TestDirHelper.getTestDir());
   }
 
   @Test
   public void waitFor() {
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     long waited = waitFor(1000, new Predicate() {
       public boolean evaluate() throws Exception {
         return true;
       }
     });
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(waited, 0, 50);
-    Assert.assertEquals(end - start - waited, 0, 50);
+    long end = Time.now();
+    assertEquals(waited, 0, 50);
+    assertEquals(end - start - waited, 0, 50);
   }
 
   @Test
   public void waitForTimeOutRatio1() {
     setWaitForRatio(1);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     long waited = waitFor(200, new Predicate() {
       public boolean evaluate() throws Exception {
         return false;
       }
     });
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(waited, -1);
-    Assert.assertEquals(end - start, 200, 50);
+    long end = Time.now();
+    assertEquals(waited, -1);
+    assertEquals(end - start, 200, 50);
   }
 
   @Test
   public void waitForTimeOutRatio2() {
     setWaitForRatio(2);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     long waited = waitFor(200, new Predicate() {
       public boolean evaluate() throws Exception {
         return false;
       }
     });
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(waited, -1);
-    Assert.assertEquals(end - start, 200 * getWaitForRatio(), 50 * getWaitForRatio());
+    long end = Time.now();
+    assertEquals(waited, -1);
+    assertEquals(end - start, 200 * getWaitForRatio(), 50 * getWaitForRatio());
   }
 
   @Test
   public void sleepRatio1() {
     setWaitForRatio(1);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     sleep(100);
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(end - start, 100, 50);
+    long end = Time.now();
+    assertEquals(end - start, 100, 50);
   }
 
   @Test
   public void sleepRatio2() {
     setWaitForRatio(1);
-    long start = System.currentTimeMillis();
+    long start = Time.now();
     sleep(100);
-    long end = System.currentTimeMillis();
-    Assert.assertEquals(end - start, 100 * getWaitForRatio(), 50 * getWaitForRatio());
+    long end = Time.now();
+    assertEquals(end - start, 100 * getWaitForRatio(), 50 * getWaitForRatio());
   }
 
   public static class MyServlet extends HttpServlet {
@@ -133,9 +137,9 @@ public class TestHTestCase extends HTest
     server.start();
     URL url = new URL(TestJettyHelper.getJettyURL(), "/bar");
     HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-    Assert.assertEquals(conn.getResponseCode(), HttpURLConnection.HTTP_OK);
+    assertEquals(conn.getResponseCode(), HttpURLConnection.HTTP_OK);
     BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-    Assert.assertEquals(reader.readLine(), "foo");
+    assertEquals(reader.readLine(), "foo");
     reader.close();
   }
 

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHdfsHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHdfsHelper.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHdfsHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestHdfsHelper.java Fri Aug  3 19:00:15 2012
@@ -17,6 +17,9 @@
  */
 package org.apache.hadoop.test;
 
+import java.io.File;
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -26,9 +29,6 @@ import org.junit.Test;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
 
-import java.io.File;
-import java.util.concurrent.atomic.AtomicInteger;
-
 public class TestHdfsHelper extends TestDirHelper {
 
   @Test

Modified: hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java?rev=1369164&r1=1369163&r2=1369164&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java Fri Aug  3 19:00:15 2012
@@ -17,17 +17,19 @@
  */
 package org.apache.hadoop.test;
 
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.net.UnknownHostException;
+
 import org.junit.Test;
 import org.junit.rules.MethodRule;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
 import org.mortbay.jetty.Server;
 
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.ServerSocket;
-import java.net.URL;
-
 public class TestJettyHelper implements MethodRule {
 
   @Test
@@ -65,9 +67,9 @@ public class TestJettyHelper implements 
 
   private Server createJettyServer() {
     try {
-
-      String host = InetAddress.getLocalHost().getHostName();
-      ServerSocket ss = new ServerSocket(0);
+      InetAddress localhost = InetAddress.getByName("localhost");
+      String host = "localhost";
+      ServerSocket ss = new ServerSocket(0, 50, localhost);
       int port = ss.getLocalPort();
       ss.close();
       Server server = new Server(0);
@@ -80,6 +82,23 @@ public class TestJettyHelper implements 
   }
 
   /**
+   * Returns the authority (hostname & port) used by the JettyServer.
+   *
+   * @return an <code>InetSocketAddress</code> with the corresponding authority.
+   */
+  public static InetSocketAddress getAuthority() {
+    Server server = getJettyServer();
+    try {
+      InetAddress add =
+        InetAddress.getByName(server.getConnectors()[0].getHost());
+      int port = server.getConnectors()[0].getPort();
+      return new InetSocketAddress(add, port);
+    } catch (UnknownHostException ex) {
+      throw new RuntimeException(ex);
+    }
+  }
+
+  /**
    * Returns a Jetty server ready to be configured and the started. This server
    * is only available when the test method has been annotated with
    * {@link TestJetty}. Refer to {@link HTestCase} header for details.



Mime
View raw message