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

Method testInScript

test/org/apache/pig/test/TestAssert.java:72–96  ·  view source on GitHub ↗

Verify that ASSERT operator works in a Pig script See PIG-3670 @throws Exception

()

Source from the content-addressed store, hash-verified

70 * @throws Exception
71 */
72 @Test
73 public void testInScript() throws Exception {
74 PigServer pigServer = new PigServer(Util.getLocalTestMode());
75 Data data = resetData(pigServer);
76
77 data.set("foo",
78 tuple(1),
79 tuple(2),
80 tuple(3)
81 );
82
83 StringBuffer query = new StringBuffer();
84 query.append("A = LOAD 'foo' USING mock.Storage() AS (i:int);\n");
85 query.append("ASSERT A BY i > 0;\n");
86 query.append("STORE A INTO 'bar' USING mock.Storage();");
87
88 InputStream is = new ByteArrayInputStream(query.toString().getBytes());
89 pigServer.registerScript(is);
90
91 List<Tuple> out = data.get("bar");
92 assertEquals(3, out.size());
93 assertEquals(tuple(1), out.get(0));
94 assertEquals(tuple(2), out.get(1));
95 assertEquals(tuple(3), out.get(2));
96 }
97
98 /**
99 * Verify that ASSERT operator works

Callers

nothing calls this directly

Calls 12

getLocalTestModeMethod · 0.95
setMethod · 0.95
registerScriptMethod · 0.95
getMethod · 0.95
resetDataMethod · 0.80
appendMethod · 0.65
getBytesMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
tupleMethod · 0.45
toStringMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected