Examples of PigTest


Examples of org.apache.pig.pigunit.PigTest

        "n=3",
        "reducers=1",
        "input=top_queries_input_data.txt",
        "output=top_3_queries",
        };
    test = new PigTest(PIG_SCRIPT, args);

    // By default PigUnit removes all the STORE and DUMP
    test.unoverride("STORE");

    test.runScript();
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

        };

    PigServer mockServer = null;
    Cluster mockCluster = null;

    test = new PigTest(PIG_SCRIPT, args, mockServer, mockCluster);

    test.assertOutput(new File("data/top_queries_expected_top_3.txt"));
  }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  @Test
  public void shouldAssertWithMessageOnZero() throws Exception
  {
    try
    {
      PigTest test = createPigTest("datafu/util/assertWithMessageTest.pig");
     
      this.writeLinesToFile("input", "0");
     
      test.runScript();
     
      this.getLinesForAlias(test, "data2");
     
      fail("test should have failed, but it didn't");
    }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  }
 
  @Test
  public void shouldNotAssertWithMessageOnOne() throws Exception
  {
    PigTest test = createPigTest("datafu/util/assertWithMessageTest.pig");
   
    this.writeLinesToFile("input", "1");
   
    test.runScript();
   
    this.getLinesForAlias(test, "data2");
  }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  @Test
  public void shouldAssertWithoutMessageOnZero() throws Exception
  {
    try
    {
      PigTest test = createPigTest("datafu/util/assertWithoutMessageTest.pig");
     
      this.writeLinesToFile("input", "0");
     
      test.runScript();
     
      this.getLinesForAlias(test, "data2");
     
      fail("test should have failed, but it didn't");
    }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  }
 
  @Test
  public void shouldNotAssertWithoutMessageOnOne() throws Exception
  {
    PigTest test = createPigTest("datafu/util/assertWithoutMessageTest.pig");
   
    this.writeLinesToFile("input", "1");
   
    test.runScript();
   
    this.getLinesForAlias(test, "data2");
  }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

public class IntBoolConversionPigTests extends PigTests
{
  @Test
  public void intToBoolTest() throws Exception
  {
    PigTest test = createPigTest("datafu/util/intToBoolTest.pig");
       
    String[] input = {
      "", // null
      "0",
      "1"
    };
   
    String[] output = {
        "(false)",
        "(false)",
        "(true)"
      };
   
    test.assertOutput("data",input,"data2",output);
  }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  }
 
  @Test
  public void intToBoolToIntTest() throws Exception
  {
    PigTest test = createPigTest("datafu/util/intToBoolToIntTest.pig");
       
    String[] input = {
      "", // null
      "0",
      "1",
      "2",
      "-1",
      "-2",
      "0",
      ""
    };
   
    String[] output = {
        "(0)",
        "(0)",
        "(1)",
        "(1)",
        "(1)",
        "(1)",
        "(0)",
        "(0)"
      };
   
    test.assertOutput("data",input,"data3",output);
  }
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

public class WilsonBinConfTests extends PigTests
{
  @Test
  public void wilsonTest() throws Exception
  {
    PigTest test = createPigTest("datafu/stats/wilsonBinConfTests.pig",
                                 "alpha=0.05"); // alpha is 0.05 for 95% confidence
   
    writeLinesToFile("input",
                     "1\t1",
                     "1\t2",
                     "50\t100",
                     "500\t1000",
                     "999\t1000",
                     "1000\t1000",
                     "998\t1000");
       
    test.runScript();
   
    /* Add expected values, computed using R:
     *
     * e.g.
     *
 
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

          lines[i] = lines[i].replaceAll(Pattern.quote("$" + parts[0]), parts[1]);
        }
      }
    }
   
    return new PigTest(lines);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.