Modified: pig/trunk/test/org/apache/pig/test/TestRegisteredJarVisibility.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestRegisteredJarVisibility.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestRegisteredJarVisibility.java (original) +++ pig/trunk/test/org/apache/pig/test/TestRegisteredJarVisibility.java Mon Dec 8 22:29:31 2014 @@ -45,7 +45,6 @@ import org.apache.log4j.FileAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; -import org.apache.pig.ExecType; import org.apache.pig.PigConfiguration; import org.apache.pig.PigServer; import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler; @@ -137,8 +136,8 @@ public class TestRegisteredJarVisibility } @Test - public void testRegisteredJarVisibilityLocal() throws IOException { - PigServer pigServer = new PigServer(ExecType.LOCAL, new Properties()); + public void testRegisteredJarVisibilityLocal() throws Exception { + PigServer pigServer = new PigServer(Util.getLocalTestMode(), new Properties()); testRegisteredJarVisibility(pigServer, INPUT_FILE.getAbsolutePath()); } @@ -160,13 +159,13 @@ public class TestRegisteredJarVisibility // See PIG-3039 @Test - public void testRegisterJarOverridePigJarPackages() throws IOException, ClassNotFoundException { + public void testRegisterJarOverridePigJarPackages() throws Exception { // When jackson jar is not registered, jackson-core from the first jar in // classpath (pig.jar) should be picked up (version 1.8.8 in this case). String jacksonJar = JarManager.findContainingJar(org.codehaus.jackson.JsonParser.class); Assert.assertTrue(new File(jacksonJar).getName().contains("1.8.8")); - PigServer pigServer = new PigServer(ExecType.LOCAL, new Properties()); + PigServer pigServer = new PigServer(Util.getLocalTestMode(), new Properties()); pigServer.registerJar("test/resources/jackson-core-asl-1.9.9.jar"); pigServer.registerJar("test/resources/jackson-mapper-asl-1.9.9.jar"); jacksonJar = JarManager.findContainingJar(org.codehaus.jackson.JsonParser.class);
Modified: pig/trunk/test/org/apache/pig/test/TestRelationToExprProject.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestRelationToExprProject.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestRelationToExprProject.java (original) +++ pig/trunk/test/org/apache/pig/test/TestRelationToExprProject.java Mon Dec 8 22:29:31 2014 @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.builtin.mock.Storage.Data; import org.apache.pig.data.BagFactory; @@ -66,7 +65,7 @@ public class TestRelationToExprProject { */ @Before public void setUp() throws Exception { - pigServer = new PigServer(ExecType.LOCAL); + pigServer = new PigServer(Util.getLocalTestMode()); } /* (non-Javadoc) Modified: pig/trunk/test/org/apache/pig/test/TestScriptingLanguagePython.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestScriptingLanguagePython.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestScriptingLanguagePython.java (original) +++ pig/trunk/test/org/apache/pig/test/TestScriptingLanguagePython.java Mon Dec 8 22:29:31 2014 @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.scripting.ScriptEngine; import org.apache.pig.tools.pigstats.PigStats; @@ -35,7 +34,7 @@ public class TestScriptingLanguagePython @Test public void varargTest() throws Exception { System.setProperty("python.cachedir", System.getProperty("java.io.tmpdir")); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); String[] script = { "#!/usr/bin/python", Modified: pig/trunk/test/org/apache/pig/test/TestSplit.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestSplit.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestSplit.java (original) +++ pig/trunk/test/org/apache/pig/test/TestSplit.java Mon Dec 8 22:29:31 2014 @@ -22,9 +22,7 @@ import java.io.IOException; import java.util.Iterator; import java.util.List; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; -import org.apache.pig.backend.executionengine.ExecException; import org.apache.pig.data.Tuple; import org.apache.pig.impl.logicalLayer.FrontendException; import org.junit.Before; @@ -42,8 +40,8 @@ public class TestSplit { } @Before - public void setUp() throws ExecException { - pig = new PigServer(ExecType.LOCAL); + public void setUp() throws Exception { + pig = new PigServer(Util.getLocalTestMode()); } @Test Modified: pig/trunk/test/org/apache/pig/test/TestSplitIndex.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestSplitIndex.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestSplitIndex.java (original) +++ pig/trunk/test/org/apache/pig/test/TestSplitIndex.java Mon Dec 8 22:29:31 2014 @@ -26,7 +26,6 @@ import java.util.Properties; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.RecordReader; import org.apache.hadoop.mapreduce.lib.input.FileSplit; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit; import org.apache.pig.builtin.PigStorage; @@ -43,7 +42,7 @@ public class TestSplitIndex { File inputDir; @Before public void setUp() throws Exception{ - pigServer = new PigServer(ExecType.LOCAL, new Properties()); + pigServer = new PigServer(Util.getLocalTestMode(), new Properties()); inputDir = File.createTempFile("tmp", ""); inputDir.delete(); inputDir.mkdir(); Modified: pig/trunk/test/org/apache/pig/test/TestStoreInstances.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestStoreInstances.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestStoreInstances.java (original) +++ pig/trunk/test/org/apache/pig/test/TestStoreInstances.java Mon Dec 8 22:29:31 2014 @@ -41,7 +41,6 @@ import org.apache.pig.backend.executione import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MRConfiguration; import org.apache.pig.data.Tuple; import org.apache.pig.impl.io.FileLocalizer; -import org.apache.pig.parser.ParserException; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -98,8 +97,8 @@ public class TestStoreInstances { * @throws ParseException */ @Test - public void testBackendStoreCommunication() throws IOException, ParserException { - ExecType[] execTypes = { cluster.getExecType(), ExecType.LOCAL}; + public void testBackendStoreCommunication() throws Exception { + ExecType[] execTypes = { cluster.getExecType(), Util.getLocalTestMode()}; PigServer pig = null; for(ExecType execType : execTypes){ Util.resetStateForExecModeSwitch(); Modified: pig/trunk/test/org/apache/pig/test/TestStreamingLocal.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestStreamingLocal.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestStreamingLocal.java (original) +++ pig/trunk/test/org/apache/pig/test/TestStreamingLocal.java Mon Dec 8 22:29:31 2014 @@ -17,8 +17,6 @@ */ package org.apache.pig.test; -import static org.junit.Assert.assertTrue; - import java.io.File; import java.util.ArrayList; import java.util.Iterator; @@ -51,7 +49,7 @@ public class TestStreamingLocal { @Before public void setUp() throws Exception { - pigServer = new PigServer(ExecType.LOCAL); + pigServer = new PigServer(Util.getLocalTestMode()); } @After @@ -330,7 +328,7 @@ public class TestStreamingLocal { @Test public void testLocalNegativeLoadStoreOptimization() throws Exception { - testNegativeLoadStoreOptimization(ExecType.LOCAL); + testNegativeLoadStoreOptimization(Util.getLocalTestMode()); } private void testNegativeLoadStoreOptimization(ExecType execType) Modified: pig/trunk/test/org/apache/pig/test/TestTypedMap.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestTypedMap.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestTypedMap.java (original) +++ pig/trunk/test/org/apache/pig/test/TestTypedMap.java Mon Dec 8 22:29:31 2014 @@ -20,7 +20,6 @@ package org.apache.pig.test; import static org.junit.Assert.assertEquals; import java.io.File; -import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Properties; @@ -29,18 +28,14 @@ import junit.framework.Assert; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.data.DataBag; import org.apache.pig.data.DataByteArray; import org.apache.pig.data.Tuple; import org.apache.pig.impl.io.FileLocalizer; import org.apache.pig.impl.logicalLayer.schema.Schema; -import org.apache.pig.parser.ParserException; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; public class TestTypedMap { @@ -75,8 +70,8 @@ public class TestTypedMap { } @Test - public void testSimpleLoad() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testSimpleLoad() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#1,key2#2]", "[key#2]", @@ -112,8 +107,8 @@ public class TestTypedMap { } @Test - public void testSimpleMapKeyLookup() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testSimpleMapKeyLookup() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#1,key2#2]", "[key#2]", @@ -143,8 +138,8 @@ public class TestTypedMap { } @Test - public void testSimpleMapCast() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testSimpleMapCast() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#1,key2#2]", "[key#2]", @@ -181,8 +176,8 @@ public class TestTypedMap { } @Test - public void testComplexLoad() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testComplexLoad() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#{(1,2),(1,3)},134#]", "[key2#]", @@ -215,8 +210,8 @@ public class TestTypedMap { } @Test - public void testComplexCast() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testComplexCast() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#{(1,2),(1,3)},134#]", "[key2#]", @@ -250,8 +245,8 @@ public class TestTypedMap { } @Test - public void testComplexCast2() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testComplexCast2() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#1,key2#2]", }; @@ -280,8 +275,8 @@ public class TestTypedMap { } @Test - public void testUnTypedMap() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testUnTypedMap() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#1,key2#2]", }; @@ -309,8 +304,8 @@ public class TestTypedMap { } @Test - public void testOrderBy() throws IOException, ParserException { - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + public void testOrderBy() throws Exception { + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] input = { "[key#1,key1#2]", "[key#2,key3#2]", Modified: pig/trunk/test/org/apache/pig/test/TestUDF.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestUDF.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestUDF.java (original) +++ pig/trunk/test/org/apache/pig/test/TestUDF.java Mon Dec 8 22:29:31 2014 @@ -32,7 +32,6 @@ import java.util.List; import java.util.Map; import org.apache.pig.EvalFunc; -import org.apache.pig.ExecType; import org.apache.pig.FuncSpec; import org.apache.pig.PigServer; import org.apache.pig.data.DataType; @@ -77,7 +76,7 @@ public class TestUDF { @Test public void testUDFReturnMap_LocalMode() throws Exception { - PigServer pig = new PigServer(ExecType.LOCAL); + PigServer pig = new PigServer(Util.getLocalTestMode()); pig.registerScript(TempScriptFile.getAbsolutePath()); Iterator<Tuple> iterator = pig.openIterator("B"); @@ -128,7 +127,7 @@ public class TestUDF { public void testEvalFuncGetArgToFunc() throws Exception { String input = "udf_test_jira_2430.txt"; Util.createLocalInputFile(input, new String[]{"1,hey"}); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerQuery("A = LOAD '"+input+"' USING PigStorage(',') AS (x:int,y:chararray);"); pigServer.registerQuery("B = FOREACH A GENERATE org.apache.pig.test.TestUDF$UdfWithFuncSpecWithArgs(x);"); pigServer.registerQuery("C = FOREACH A GENERATE org.apache.pig.test.TestUDF$UdfWithFuncSpecWithArgs(y);"); @@ -152,7 +151,7 @@ public class TestUDF { public void testNormalDefine() throws Exception { String input = "udf_test_jira_2430_2.txt"; Util.createLocalInputFile(input, new String[]{"1"}); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerQuery("A = LOAD '"+input+"' as (x:int);"); pigServer.registerQuery("DEFINE udftest1 org.apache.pig.test.TestUDF$UdfWithFuncSpecWithArgs('1');"); pigServer.registerQuery("DEFINE udftest2 org.apache.pig.test.TestUDF$UdfWithFuncSpecWithArgs('2');"); @@ -186,7 +185,7 @@ public class TestUDF { query += s + "(A),"; } query += udfs[udfs.length - 1] + "(A);"; - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerQuery(query); Iterator<Tuple> it = pigServer.openIterator("B"); while (it.hasNext()) { @@ -202,7 +201,7 @@ public class TestUDF { @Test public void testEnsureProperSchema1() throws Exception { - PigServer pig = new PigServer(ExecType.LOCAL); + PigServer pig = new PigServer(Util.getLocalTestMode()); pig.registerQuery("DEFINE goodSchema1 org.apache.pig.test.TestUDF$MirrorSchema('a:int');"); pig.registerQuery("DEFINE goodSchema2 org.apache.pig.test.TestUDF$MirrorSchema('t:(a:int, b:int, c:int)');"); pig.registerQuery("DEFINE goodSchema3 org.apache.pig.test.TestUDF$MirrorSchema('b:{(a:int, b:int, c:int)}');"); @@ -219,7 +218,7 @@ public class TestUDF { public void testEvalFuncGetVarArgToFunc() throws Exception { String input = "udf_test_jira_3444.txt"; Util.createLocalInputFile(input, new String[]{"dummy"}); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerQuery("A = LOAD '"+input+"' USING PigStorage(',') AS (x:chararray);"); pigServer.registerQuery("B = FOREACH A GENERATE org.apache.pig.test.TestUDF$UdfWithFuncSpecWithVarArgs(3);"); pigServer.registerQuery("C = FOREACH A GENERATE org.apache.pig.test.TestUDF$UdfWithFuncSpecWithVarArgs(1,2,3,4);"); @@ -232,7 +231,7 @@ public class TestUDF { @Test(expected = FrontendException.class) public void testEnsureProperSchema2() throws Exception { - PigServer pig = new PigServer(ExecType.LOCAL); + PigServer pig = new PigServer(Util.getLocalTestMode()); pig.registerQuery("DEFINE badSchema org.apache.pig.test.TestUDF$MirrorSchema('a:int, b:int, c:int');"); pig.registerQuery("a = load 'thing';"); pig.registerQuery("b = foreach a generate badSchema();"); @@ -324,7 +323,7 @@ public class TestUDF { @Test // See PIG-4184 public void testUDFNullInput() throws Exception { - PigServer pig = new PigServer(ExecType.LOCAL); + PigServer pig = new PigServer(Util.getLocalTestMode()); File inputFile = Util.createInputFile("tmp", "", new String[] {"\t", "2\t3"}); pig.registerQuery("a = load '" Modified: pig/trunk/test/org/apache/pig/test/TestUDFContext.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestUDFContext.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestUDFContext.java (original) +++ pig/trunk/test/org/apache/pig/test/TestUDFContext.java Mon Dec 8 22:29:31 2014 @@ -25,7 +25,6 @@ import java.io.FileWriter; import java.util.Iterator; import java.util.Properties; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.builtin.PigStorage; import org.apache.pig.data.Tuple; @@ -40,7 +39,7 @@ public class TestUDFContext { File a = Util.createLocalInputFile("a.txt", new String[] { "dumb" }); File b = Util.createLocalInputFile("b.txt", new String[] { "dumber" }); FileLocalizer.deleteTempFiles(); - PigServer pig = new PigServer(ExecType.LOCAL, new Properties()); + PigServer pig = new PigServer(Util.getLocalTestMode(), new Properties()); String[] statement = { "A = LOAD '" + Util.encodeEscape(a.getAbsolutePath()) + "' USING org.apache.pig.test.utils.UDFContextTestLoader('joe');", "B = LOAD '" + Util.encodeEscape(b.getAbsolutePath()) + @@ -77,7 +76,7 @@ public class TestUDFContext { */ @Test public void testUDFContextReset() throws Exception { - PigServer pig = new PigServer(ExecType.LOCAL); + PigServer pig = new PigServer(Util.getLocalTestMode()); pig.registerQuery(" l = load 'file' as (a :int, b : int, c : int);"); pig.registerQuery(" f = foreach l generate a, b;"); pig.explain("f", System.out); Modified: pig/trunk/test/org/apache/pig/test/TestUDFGroovy.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestUDFGroovy.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestUDFGroovy.java (original) +++ pig/trunk/test/org/apache/pig/test/TestUDFGroovy.java Mon Dec 8 22:29:31 2014 @@ -40,7 +40,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.builtin.mock.Storage.Data; import org.apache.pig.data.DataBag; @@ -280,7 +279,7 @@ public class TestUDFGroovy { } writer.close(); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerCode(tmpScriptFile.getCanonicalPath(), "groovy", "groovyudfs"); @@ -327,7 +326,7 @@ public class TestUDFGroovy { } writer.close(); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerCode(tmpScriptFile.getCanonicalPath(), "groovy", "groovyudfs"); @@ -386,7 +385,7 @@ public class TestUDFGroovy { } writer.close(); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerCode(tmpScriptFile.getCanonicalPath(), "groovy", "groovyudfs"); @@ -442,7 +441,7 @@ public class TestUDFGroovy { } writer.close(); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerCode(tmpScriptFile.getCanonicalPath(), "groovy", "groovyudfs"); @@ -486,7 +485,7 @@ public class TestUDFGroovy { } writer.close(); - PigServer pigServer = new PigServer(ExecType.LOCAL); + PigServer pigServer = new PigServer(Util.getLocalTestMode()); pigServer.registerCode(tmpScriptFile.getCanonicalPath(), "groovy", "groovyudfs"); Modified: pig/trunk/test/org/apache/pig/test/TestUDFWithoutParameter.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestUDFWithoutParameter.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestUDFWithoutParameter.java (original) +++ pig/trunk/test/org/apache/pig/test/TestUDFWithoutParameter.java Mon Dec 8 22:29:31 2014 @@ -49,7 +49,7 @@ public class TestUDFWithoutParameter { @Test public void testUDFWithoutParameter() throws Exception { - PigServer pig = new PigServer(ExecType.LOCAL); + PigServer pig = new PigServer(Util.getLocalTestMode()); pig.registerScript(TempScriptFile.getAbsolutePath()); Iterator<Tuple> iterator=pig.openIterator("B"); Modified: pig/trunk/test/org/apache/pig/test/TestUTF8.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestUTF8.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestUTF8.java (original) +++ pig/trunk/test/org/apache/pig/test/TestUTF8.java Mon Dec 8 22:29:31 2014 @@ -29,7 +29,6 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.Iterator; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.builtin.PigStorage; import org.apache.pig.data.DataType; @@ -43,7 +42,7 @@ public class TestUTF8 { @Before public void setUp() throws Exception { - pigServer = new PigServer(ExecType.LOCAL); + pigServer = new PigServer(Util.getLocalTestMode()); } @Test Modified: pig/trunk/test/org/apache/pig/test/TestUnion.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestUnion.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/TestUnion.java (original) +++ pig/trunk/test/org/apache/pig/test/TestUnion.java Mon Dec 8 22:29:31 2014 @@ -27,7 +27,6 @@ import java.io.IOException; import java.util.Iterator; import java.util.Properties; -import org.apache.pig.ExecType; import org.apache.pig.FuncSpec; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; @@ -88,7 +87,7 @@ public class TestUnion { @Before public void setUp() throws Exception { - pigServer = new PigServer(ExecType.LOCAL, new Properties()); + pigServer = new PigServer(Util.getLocalTestMode(), new Properties()); pc = pigServer.getPigContext(); pc.connect(); GenPhyOp.setPc(pc); @@ -259,7 +258,7 @@ public class TestUnion { File f1 = Util.createInputFile("tmp", "i1.txt", new String[] {"aaa\t111"}); File f2 = Util.createInputFile("tmp", "i2.txt", new String[] {"bbb\t222"}); - PigServer ps = new PigServer(ExecType.LOCAL, new Properties()); + PigServer ps = new PigServer(Util.getLocalTestMode(), new Properties()); ps.registerQuery("A = load '" + Util.encodeEscape(f1.getAbsolutePath()) + "' as (a,b);"); ps.registerQuery("B = load '" + Util.encodeEscape(f2.getAbsolutePath()) + "' as (a,b);"); ps.registerQuery("C = union A,B;"); @@ -288,7 +287,7 @@ public class TestUnion { File f1 = Util.createInputFile("tmp", "i1.txt", new String[] {"1","2","3"}); File f2 = Util.createInputFile("tmp", "i2.txt", new String[] {"a","b","c"}); - PigServer ps = new PigServer(ExecType.LOCAL, new Properties()); + PigServer ps = new PigServer(Util.getLocalTestMode(), new Properties()); //PigStorage and TextLoader have different LoadCasters ps.registerQuery("A = load '" + Util.encodeEscape(f1.getAbsolutePath()) + "' as (a:bytearray);"); ps.registerQuery("B = load '" + Util.encodeEscape(f2.getAbsolutePath()) + "' using TextLoader() as (b:bytearray);"); @@ -320,7 +319,7 @@ public class TestUnion { File f2 = Util.createInputFile("tmp", "i2.txt", new String[] {"a","b","c"}); File f3 = Util.createInputFile("tmp", "i3.txt", new String[] {"1","2","3"}); - PigServer ps = new PigServer(ExecType.LOCAL, new Properties()); + PigServer ps = new PigServer(Util.getLocalTestMode(), new Properties()); ps.registerQuery("A = load '" + Util.encodeEscape(f1.getAbsolutePath()) + "' as (a:bytearray);"); // Using PigStorage() ps.registerQuery("B = load '" + Util.encodeEscape(f2.getAbsolutePath()) + "' using TextLoader() as (i:bytearray);"); ps.registerQuery("C = load '" + Util.encodeEscape(f3.getAbsolutePath()) + "' using TextLoader() as (i:bytearray);"); @@ -344,7 +343,7 @@ public class TestUnion { // Fields coming from different loaders but // having the same LoadCaster. File f1 = Util.createInputFile("tmp", "i1.txt", new String[] {"1\ta","2\tb","3\tc"}); - PigServer ps = new PigServer(ExecType.LOCAL, new Properties()); + PigServer ps = new PigServer(Util.getLocalTestMode(), new Properties()); // PigStorage and PigStorageWithStatistics have the same // LoadCaster(== Utf8StorageConverter) ps.registerQuery("A = load '" + Util.encodeEscape(f1.getAbsolutePath()) + "' as (a:bytearray, b:bytearray);"); Modified: pig/trunk/test/org/apache/pig/test/Util.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/Util.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/Util.java (original) +++ pig/trunk/test/org/apache/pig/test/Util.java Mon Dec 8 22:29:31 2014 @@ -45,8 +45,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Properties; +import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; @@ -650,23 +650,7 @@ public class Util { static public void copyFromLocalToLocal(String fromLocalFileName, String toLocalFileName) throws IOException { - if(Util.WINDOWS){ - fromLocalFileName = fromLocalFileName.replace('\\','/'); - toLocalFileName = toLocalFileName.replace('\\','/'); - } - PigServer ps = new PigServer(ExecType.LOCAL, new Properties()); - String script = getMkDirCommandForHadoop2_0(toLocalFileName) + "fs -cp " + fromLocalFileName + " " + toLocalFileName; - - new File(toLocalFileName).deleteOnExit(); - - GruntParser parser = new GruntParser(new StringReader(script), ps); - parser.setInteractive(false); - try { - parser.parseStopOnError(); - } catch (org.apache.pig.tools.pigscript.parser.ParseException e) { - throw new IOException(e); - } - + FileUtils.copyFile(new File(fromLocalFileName), new File(toLocalFileName)); } static public void copyFromClusterToLocal(MiniGenericCluster cluster, @@ -1385,4 +1369,15 @@ public class Util { appender.close(); logger.removeAppender(appenderName); } + + public static Path getFirstPartFile(Path path) throws Exception { + FileStatus[] parts = FileSystem.get(path.toUri(), new Configuration()).listStatus(path, + new PathFilter() { + @Override + public boolean accept(Path path) { + return path.getName().startsWith("part-"); + } + }); + return parts[0].getPath(); + } } Modified: pig/trunk/test/org/apache/pig/test/pigunit/pig/TestGruntParser.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/pigunit/pig/TestGruntParser.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/test/pigunit/pig/TestGruntParser.java (original) +++ pig/trunk/test/org/apache/pig/test/pigunit/pig/TestGruntParser.java Mon Dec 8 22:29:31 2014 @@ -19,7 +19,6 @@ import java.util.Map; import junit.framework.Assert; -import org.apache.pig.backend.executionengine.ExecException; import org.apache.pig.pigunit.pig.GruntParser; import org.apache.pig.pigunit.pig.PigServer; import org.apache.pig.test.Util; Modified: pig/trunk/test/org/apache/pig/tools/grunt/TestGruntParser.java URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/tools/grunt/TestGruntParser.java?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/org/apache/pig/tools/grunt/TestGruntParser.java (original) +++ pig/trunk/test/org/apache/pig/tools/grunt/TestGruntParser.java Mon Dec 8 22:29:31 2014 @@ -25,8 +25,8 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; -import org.apache.pig.ExecType; import org.apache.pig.PigServer; +import org.apache.pig.test.Util; import org.apache.pig.tools.grunt.GruntParser.ExplainState; import org.junit.Before; import org.junit.Test; @@ -36,8 +36,8 @@ public class TestGruntParser { static PigServer pig; @Before - public void setup() throws IOException { - pig = new PigServer(ExecType.LOCAL); + public void setup() throws Exception { + pig = new PigServer(Util.getLocalTestMode()); } @Test Modified: pig/trunk/test/tez-local-tests URL: http://svn.apache.org/viewvc/pig/trunk/test/tez-local-tests?rev=1643944&r1=1643943&r2=1643944&view=diff ============================================================================== --- pig/trunk/test/tez-local-tests (original) +++ pig/trunk/test/tez-local-tests Mon Dec 8 22:29:31 2014 @@ -4,3 +4,63 @@ **/TestDefaultDateTimeZone.java **/TestHBaseStorage.java **/TestInvokerGenerator.java +**/TestOrcStorage.java +**/TestStreamingUDF.java +**/TestPluckTuple.java +**/TestImplicitSplitOnTuple.java +**/TestMockStorage.java +**/TestLogicalPlanGenerator.java +**/TestOrcStoragePushdown.java +**/TestSchemaResetter.java +**/TestLocationInPhysicalPlan.java +**/TestAlgebraicEvalLocal.java +**/TestAssert.java +**/TestBatchAliases.java +**/TestBlackAndWhitelistValidator.java +**/TestBuiltin.java +**/TestBuiltInBagToTupleOrString.java +**/TestBuiltinInvoker.java +**/TestCase.java +**/TestCommit.java +**/TestDataBagAccess.java +**/TestFilterOpNumeric.java +**/TestFilterOpString.java +**/TestForEachNestedPlanLocal.java +**/TestForEachStar.java +**/TestIn.java +**/TestInfixArithmetic.java +**/TestInputOutputFileValidator.java +**/TestJsonLoaderStorage.java +**/TestLimitSchemaStore.java +**/TestLoad.java +**/TestLocal.java +**/TestLocal2.java +**/TestLOLoadDeterminedSchema.java +**/TestMacroExpansion.java +**/TestNullConstant.java +**/TestOrderBy3.java +**/TestParser.java +**/TestPigContext.java +**/TestPigSplit.java +**/TestPigStorage.java +**/TestPoissonSampleLoader.java +**/TestPONegative.java +**/TestProject.java +**/TestProjectStarExpander.java +**/TestRank1.java +**/TestRank2.java +**/TestRegisteredJarVisibility.java +**/TestRelationToExprProject.java +**/TestScriptingLanguagePython.java +**/TestSplit.java +**/TestSplitIndex.java +**/TestStoreInstances.java +**/TestStreamingLocal.java +**/TestTypedMap.java +**/TestUDF.java +**/TestUDFContext.java +**/TestUDFGroovy.java +**/TestUDFWithoutParameter.java +**/TestUnion.java +**/TestUTF8.java +**/TestGruntParser.java
