Pārlūkot izejas kodu

HDFS-713. Need to properly check the type of the test class from an aspect. Contributed by Konstantin Boudnik

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@826823 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Boudnik 16 gadi atpakaļ
vecāks
revīzija
ec4dda87bb

+ 3 - 0
CHANGES.txt

@@ -288,6 +288,9 @@ Release 0.21.0 - Unreleased
     tests and changed SleepAction to support uniform random sleeping over an
     tests and changed SleepAction to support uniform random sleeping over an
     interval.  (szetszwo)
     interval.  (szetszwo)
 
 
+    HDFS-713. Need to properly check the type of the test class from an aspect
+    (cos)
+
   BUG FIXES
   BUG FIXES
 
 
     HDFS-76. Better error message to users when commands fail because of 
     HDFS-76. Better error message to users when commands fail because of 

+ 7 - 4
src/test/aop/org/apache/hadoop/hdfs/HFlushAspects.aj

@@ -23,6 +23,7 @@ import java.io.IOException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fi.DataTransferTestUtil;
 import org.apache.hadoop.fi.DataTransferTestUtil;
+import org.apache.hadoop.fi.PipelineTest;
 import org.apache.hadoop.fi.FiHFlushTestUtil.HFlushTest;
 import org.apache.hadoop.fi.FiHFlushTestUtil.HFlushTest;
 import org.apache.hadoop.hdfs.DFSClient.DFSOutputStream;
 import org.apache.hadoop.hdfs.DFSClient.DFSOutputStream;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
@@ -46,12 +47,14 @@ public aspect HFlushAspects {
         LOG.info("No pipeline is built");
         LOG.info("No pipeline is built");
         return;
         return;
     }
     }
-    if (DataTransferTestUtil.getPipelineTest() == null) {
+    PipelineTest pt = DataTransferTestUtil.getPipelineTest();
+    if (pt == null) {
         LOG.info("No test has been initialized");    
         LOG.info("No test has been initialized");    
         return;
         return;
     }
     }
-    for (int i=0; i<nodes.length; i++) {
-        ((HFlushTest)DataTransferTestUtil.getPipelineTest()).fiCallHFlush.run(nodes[i]);
-    }
+    if (pt instanceof HFlushTest)
+      for (int i=0; i<nodes.length; i++) {
+        ((HFlushTest)pt).fiCallHFlush.run(nodes[i]);
+      }
   }
   }
 }
 }