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

Method testPositive

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

Verify that ASSERT operator works @throws Exception

()

Source from the content-addressed store, hash-verified

40 * @throws Exception
41 */
42 @Test
43 public void testPositive() throws Exception {
44 PigServer pigServer = new PigServer(Util.getLocalTestMode());
45 Data data = resetData(pigServer);
46
47 data.set("foo",
48 tuple(1),
49 tuple(2),
50 tuple(3)
51 );
52
53 pigServer.setBatchOn();
54 pigServer.registerQuery("A = LOAD 'foo' USING mock.Storage() AS (i:int);");
55 pigServer.registerQuery("ASSERT A BY i > 0;");
56 pigServer.registerQuery("STORE A INTO 'bar' USING mock.Storage();");
57
58 pigServer.executeBatch();
59
60 List<Tuple> out = data.get("bar");
61 assertEquals(3, out.size());
62 assertEquals(tuple(1), out.get(0));
63 assertEquals(tuple(2), out.get(1));
64 assertEquals(tuple(3), out.get(2));
65 }
66
67 /**
68 * Verify that ASSERT operator works in a Pig script

Callers

nothing calls this directly

Calls 11

getLocalTestModeMethod · 0.95
setMethod · 0.95
setBatchOnMethod · 0.95
registerQueryMethod · 0.95
executeBatchMethod · 0.95
getMethod · 0.95
resetDataMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
tupleMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected