import java.io.IOException;
import org.junit.Test;
import org.apache.pig.pigunit.PigTest;
import org.apache.pig.tools.parameters.ParseException;

public class TestAlexaTop1mGroupBySite {
    private PigTest test;
    private static final String SCRIPT = "alexa_top1m_group_by_site.pig";

    @Test public void testSampleData() throws IOException, ParseException {
	PigTest test = new PigTest(SCRIPT);
	
	String[] input = {
	    "foo.example.com\t1\t2012-12-16",
	    "foo.example.com\t1\t2012-12-15",
	    "foo.example.com\t1\t2012-12-14",
	    "bar.example.com\t2\t2012-12-16",
	    "bar.example.com\t2\t2012-12-15",
	    "bar.example.com\t2\t2012-12-14",
	};

	String[] output = {
	    "(foo.example.com,{(2012-12-16,1),(2012-12-15,1),(2012-12-14,1)})",
	    "(bar.example.com,{(2012-12-16,2),(2012-12-15,2),(2012-12-14,2)})",
	};

	test.assertOutput("top1m", input, "row", output);

    }
}
@@ -683,19 +683,19 @@
 %0A%09    %22(
-foo
+bar
 .example
@@ -712,17 +712,17 @@
 2-12-16,
-1
+2
 ),(2012-
@@ -727,17 +727,17 @@
 2-12-15,
-1
+2
 ),(2012-
@@ -742,17 +742,17 @@
 2-12-14,
-1
+2
 )%7D)%22,%0A%09 
@@ -748,35 +748,35 @@
 4,2)%7D)%22,%0A%09    %22(
-bar
+foo
 .example.com,%7B(2
@@ -777,33 +777,33 @@
 om,%7B(2012-12-16,
-2
+1
 ),(2012-12-15,2)
@@ -792,33 +792,33 @@
 ,1),(2012-12-15,
-2
+1
 ),(2012-12-14,2)
@@ -811,25 +811,25 @@
 (2012-12-14,
-2
+1
 )%7D)%22,%0A%09%7D;%0A%0A%09

order seems important