You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by rd...@apache.org on 2011/02/15 22:26:19 UTC

svn commit: r1071073 - in /pig/trunk/test/org/apache/pig/test: TestJobSubmission.java TestNativeMapReduce.java

Author: rding
Date: Tue Feb 15 21:26:18 2011
New Revision: 1071073

URL: http://svn.apache.org/viewvc?rev=1071073&view=rev
Log:
fix a couple of unit tests caught by PIG-1854

Modified:
    pig/trunk/test/org/apache/pig/test/TestJobSubmission.java
    pig/trunk/test/org/apache/pig/test/TestNativeMapReduce.java

Modified: pig/trunk/test/org/apache/pig/test/TestJobSubmission.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestJobSubmission.java?rev=1071073&r1=1071072&r2=1071073&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestJobSubmission.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestJobSubmission.java Tue Feb 15 21:26:18 2011
@@ -18,6 +18,7 @@
 package org.apache.pig.test;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.Random;
 
@@ -47,6 +48,7 @@ import org.apache.pig.test.utils.Logical
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -68,8 +70,8 @@ public class TestJobSubmission extends j
     String golDir;
     static MiniCluster cluster = MiniCluster.buildCluster();
     
-    static {
-
+    @BeforeClass
+    public static void onetimeSetUp() throws Exception {
         pc = new PigContext(ExecType.MAPREDUCE, cluster.getProperties());
         try {
             pc.connect();
@@ -78,8 +80,9 @@ public class TestJobSubmission extends j
             e.printStackTrace();
         }
         GenPhyOp.setPc(pc);
-        
+        Util.copyFromLocalToCluster(cluster, "test/org/apache/pig/test/data/passwd", "/passwd");
     }
+    
     @Before
     public void setUp() throws Exception{
         curDir = System.getProperty("user.dir");
@@ -549,7 +552,6 @@ public class TestJobSubmission extends j
     public void testReducerNumEstimation() throws Exception{
        // use the estimation
         LogicalPlanTester planTester = new LogicalPlanTester(pc) ;
-        Util.copyFromLocalToCluster(cluster, "test/org/apache/pig/test/data/passwd", "/passwd");
         planTester.buildPlan("a = load '/passwd';");
         LogicalPlan lp = planTester.buildPlan("b = group a by $0;");
         PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
@@ -614,7 +616,7 @@ public class TestJobSubmission extends j
         pc.getProperties().setProperty("pig.exec.reducers.max", "10");
         
         LogicalPlanTester planTester = new LogicalPlanTester(pc) ;
-        Util.copyFromLocalToCluster(cluster, "test/org/apache/pig/test/data/passwd", "/passwd");
+
         planTester.buildPlan("a = load '/passwd';");
         LogicalPlan lp = planTester.buildPlan("b = order a by $0;");
         PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);

Modified: pig/trunk/test/org/apache/pig/test/TestNativeMapReduce.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestNativeMapReduce.java?rev=1071073&r1=1071072&r2=1071073&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestNativeMapReduce.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestNativeMapReduce.java Tue Feb 15 21:26:18 2011
@@ -197,8 +197,6 @@ public class TestNativeMapReduce  {
             results.add("(two,2)");
             results.add("(three,3)");
 
-            Util.copyFromLocalToCluster(cluster, INPUT_FILE, INPUT_FILE);
-            
             pigServer.setBatchOn();
             pigServer.registerQuery("A = load '" + INPUT_FILE + "';");
             pigServer.registerQuery("B = mapreduce '" + jarFileName + "' " +
@@ -206,8 +204,7 @@ public class TestNativeMapReduce  {
                     "Load 'table_testNativeMRJobSimple_output' "+
             "`org.apache.pig.test.utils.WordCount table_testNativeMRJobSimple_input " + INPUT_FILE + "`;");
             pigServer.registerQuery("Store B into 'table_testNativeMRJobSimpleDir';");
-//            List<ExecJob> execJobs = pigServer.executeBatch();
-
+            pigServer.executeBatch();
 
             assertTrue("job failed", PigStats.get().getReturnCode() != 0);