MCPcopy Create free account
hub / github.com/apache/pig / firstTest

Method firstTest

test/org/apache/pig/test/TestScriptLanguage.java:109–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107 }
108
109 @Test
110 public void firstTest() throws Exception {
111 String[] script = {
112 "#!/usr/bin/python",
113 "from org.apache.pig.scripting import *",
114 "Pig.fs(\"rmr simple_out\")",
115 "input = 'simple_table'",
116 "output = 'simple_out'",
117 "P = Pig.compile(\"\"\"a = load '$input';store a into '$output';\"\"\")",
118 "Q = P.bind({'input':input, 'output':output})",
119 "stats = Q.runSingle()",
120 "if stats.isSuccessful():",
121 "\tprint 'success!'",
122 "else:",
123 "\traise 'failed'"
124 };
125 String[] input = {
126 "1\t3",
127 "2\t4",
128 "3\t5"
129 };
130
131 Util.deleteFile(cluster, "simple_table");
132 Util.createInputFile(cluster, "simple_table", input);
133
134 PigStats stats = runSimpleScript("firstTest", script);
135
136 assertEquals(1, stats.getNumberJobs());
137 String name = stats.getOutputNames().get(0);
138 assertEquals("simple_out", name);
139 assertEquals(12, stats.getBytesWritten());
140 assertEquals(3, stats.getRecordWritten());
141 }
142
143 @Test
144 public void secondTest() throws Exception {

Callers

nothing calls this directly

Calls 9

deleteFileMethod · 0.95
createInputFileMethod · 0.95
runSimpleScriptMethod · 0.95
getNumberJobsMethod · 0.95
getOutputNamesMethod · 0.95
getBytesWrittenMethod · 0.95
getRecordWrittenMethod · 0.95
getMethod · 0.65
assertEqualsMethod · 0.45

Tested by

no test coverage detected