You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by th...@apache.org on 2010/05/07 02:24:57 UTC

svn commit: r941976 [3/3] - in /hadoop/pig/trunk: ./ test/org/apache/pig/test/ test/org/apache/pig/test/utils/

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestUnion.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestUnion.java?rev=941976&r1=941975&r2=941976&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestUnion.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestUnion.java Fri May  7 00:24:55 2010
@@ -47,8 +47,11 @@ import org.apache.pig.backend.hadoop.exe
 import org.apache.pig.test.utils.GenPhyOp;
 import org.apache.pig.test.utils.TestHelper;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
 
 /**
  *  Start Plan - --4430968173902769765
@@ -76,10 +79,12 @@ import org.junit.Test;
  *  conversion from DataByteArray to native types for computation
  *  and back to DataByteArray for comparison with input.
  */
+
+@RunWith(JUnit4.class)
 public class TestUnion extends junit.framework.TestCase {
     POUnion sp;
     DataBag expBag;
-    MiniCluster cluster = MiniCluster.buildCluster();
+    static MiniCluster cluster = MiniCluster.buildCluster();
     PigContext pc = new PigContext();
     @Before
     public void setUp() throws Exception {
@@ -152,6 +157,11 @@ public class TestUnion extends junit.fra
     public void tearDown() throws Exception {
     }
     
+    @AfterClass
+    public static void oneTimeTearDown() throws Exception {
+        cluster.shutDown();
+    }
+    
     private Tuple castToDBA(Tuple in) throws ExecException{
         Tuple res = new DefaultTuple();
         for (int i=0;i<in.size();i++) {

Modified: hadoop/pig/trunk/test/org/apache/pig/test/Util.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/Util.java?rev=941976&r1=941975&r2=941976&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/Util.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/Util.java Fri May  7 00:24:55 2010
@@ -295,6 +295,22 @@ public class Util {
     }
     
     /**
+     * Helper to create an empty temp file on local file system
+     *  which will be deleted on exit
+     * @param prefix
+     * @param suffix
+     * @return File denoting a newly-created empty file 
+     * @throws IOException
+     */
+    static public File createTempFileDelOnExit(String prefix, String suffix)
+        throws IOException {
+        File tmpFile = File.createTempFile(prefix, suffix);
+        tmpFile.deleteOnExit();
+        return tmpFile;
+    }
+
+    
+    /**
      * Helper to remove a dfs file from the minicluster DFS
      * 
      * @param miniCluster reference to the Minicluster where the file should be deleted

Modified: hadoop/pig/trunk/test/org/apache/pig/test/utils/GenPhyOp.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/utils/GenPhyOp.java?rev=941976&r1=941975&r2=941976&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/utils/GenPhyOp.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/utils/GenPhyOp.java Fri May  7 00:24:55 2010
@@ -60,7 +60,6 @@ public class GenPhyOp{
     };
     
     public static PigContext pc;
-//    public static MiniCluster cluster = MiniCluster.buildCluster();
     
     public static ConstantExpression exprConst() {
         ConstantExpression ret = new ConstantExpression(new OperatorKey("", r