You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2015/02/26 04:31:16 UTC

svn commit: r1662348 - in /pig/trunk: CHANGES.txt test/org/apache/pig/test/pigunit/TestPigTest.java

Author: daijy
Date: Thu Feb 26 03:31:16 2015
New Revision: 1662348

URL: http://svn.apache.org/r1662348
Log:
PIG-4385: testDefaultBootup fails because it cannot find "pig.properties"

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/test/org/apache/pig/test/pigunit/TestPigTest.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1662348&r1=1662347&r2=1662348&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Thu Feb 26 03:31:16 2015
@@ -50,6 +50,8 @@ PIG-4333: Split BigData tests into multi
  
 BUG FIXES
 
+PIG-4385: testDefaultBootup fails because it cannot find "pig.properties" (mkudlej via daijy)
+
 PIG-4397: CSVExcelStorage incorrect output if last field value is null (daijy)
 
 PIG-4431: ReadToEndLoader does not close the record reader for the last input split (rdsr via daijy)

Modified: pig/trunk/test/org/apache/pig/test/pigunit/TestPigTest.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/pigunit/TestPigTest.java?rev=1662348&r1=1662347&r2=1662348&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/pigunit/TestPigTest.java (original)
+++ pig/trunk/test/org/apache/pig/test/pigunit/TestPigTest.java Thu Feb 26 03:31:16 2015
@@ -26,6 +26,7 @@ import java.io.PrintWriter;
 import java.lang.String;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Properties;
 
 import junit.framework.ComparisonFailure;
 
@@ -38,6 +39,7 @@ import org.apache.pig.pigunit.PigTest;
 import org.apache.pig.pigunit.pig.PigServer;
 import org.apache.pig.test.Util;
 import org.apache.pig.tools.parameters.ParseException;
+import org.apache.pig.impl.util.PropertiesUtil;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -378,16 +380,13 @@ public class TestPigTest {
 
     @Test
     public void testDefaultBootup() throws Exception {
-        // Test with properties file
-        String pigProps = "pig.properties";
+        // Test with properties object
+        Properties pigProps = PropertiesUtil.loadDefaultProperties();
         String bootupPath = "/tmp/.temppigbootup";
-        File propertyFile = new File(pigProps);
-        PrintWriter out = new PrintWriter(new FileWriter(propertyFile));
-        out.println("pig.load.default.statements=" + bootupPath);
-        out.close();
+        pigProps.setProperty("pig.load.default.statements", bootupPath);
 
         File bootupFile = new File(bootupPath);
-        out = new PrintWriter(new FileWriter(bootupFile));
+        PrintWriter out = new PrintWriter(new FileWriter(bootupFile));
         out.println("data = LOAD 'top_queries_input_data.txt' AS (query:CHARARRAY, count:INT);");
         out.close();
 
@@ -420,7 +419,7 @@ public class TestPigTest {
 
         // Create a pigunit.pig.PigServer and Cluster to run this test.
         PigServer pig = null;
-        pig = new PigServer(Util.getLocalTestMode());
+        pig = new PigServer(Util.getLocalTestMode(), pigProps);
 
         final Cluster cluster = new Cluster(pig.getPigContext());
 
@@ -434,7 +433,6 @@ public class TestPigTest {
 
         test.assertOutput("queries_limit", output);
 
-        propertyFile.delete();
         scriptFile.delete();
         bootupFile.delete();
     }