Updated Branches: refs/heads/master 8b52cb2e5 -> 243fe032f
BIGTOP-719. Add TestTextSnappy to test hadoop fs -text with snappy compressed files (Stephen Chu via rvs) Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/243fe032 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/243fe032 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/243fe032 Branch: refs/heads/master Commit: 243fe032f14e72990003bbad822f7bce91a0b77e Parents: 8b52cb2 Author: Roman Shaposhnik <[email protected]> Authored: Fri Jun 21 17:07:03 2013 -0700 Committer: Roman Shaposhnik <[email protected]> Committed: Fri Jun 21 17:07:12 2013 -0700 ---------------------------------------------------------------------- .../itest/hadoop/hdfs/TestTextSnappy.groovy | 59 ++++++++++++++++++++ 1 file changed, 59 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/243fe032/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy new file mode 100644 index 0000000..12e655e --- /dev/null +++ b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.bigtop.itest.hadoop.hdfs + +import org.apache.bigtop.itest.shell.Shell +import org.junit.AfterClass +import org.junit.BeforeClass +import org.junit.Test +import static org.junit.Assert.assertEquals +import static org.apache.bigtop.itest.LogErrorsUtils.logError + +class TestTextSnappy { + static Shell sh = new Shell("/bin/bash -s") + static String testDir = "testtextsnappy." + (new Date().getTime()) + static String snappyFile = "part-00001.snappy" + + @BeforeClass + static void setUp() throws IOException { + sh.exec( + "hadoop fs -mkdir ${testDir}", + "hadoop fs -put ${snappyFile} ${testDir}/${snappyFile}", + ) + logError(sh) + } + + @AfterClass + static void tearDown() { + sh.exec("hadoop fs -rm -r -skipTrash ${testDir}") + } + + @Test + void testTextSnappy() { + String cmd = "hadoop fs -text ${testDir}/${snappyFile}" + System.out.println(cmd) + sh.exec(cmd) + String output = sh.getOut().join("\n") + logError(sh) + String expected = "1\trafferty\t31\n2\tjones\t33\n3\tsteinberg\t33" + System.out.println("Expected output:\n${expected}") + System.out.println("Actual output:\n${output}") + assertEquals("Incorrect output", output, expected) + } + +}
