Return-Path: X-Original-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F592D4D0 for ; Fri, 28 Sep 2012 18:38:03 +0000 (UTC) Received: (qmail 4994 invoked by uid 500); 28 Sep 2012 18:38:03 -0000 Delivered-To: apmail-incubator-bigtop-commits-archive@incubator.apache.org Received: (qmail 4928 invoked by uid 500); 28 Sep 2012 18:38:02 -0000 Mailing-List: contact bigtop-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bigtop-dev@incubator.apache.org Delivered-To: mailing list bigtop-commits@incubator.apache.org Received: (qmail 4838 invoked by uid 99); 28 Sep 2012 18:38:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2012 18:38:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2012 18:38:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F37B123888E4; Fri, 28 Sep 2012 18:37:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1391585 - /incubator/bigtop/branches/branch-0.3.1/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadooptests/TestTextSnappy.groovy Date: Fri, 28 Sep 2012 18:37:17 -0000 To: bigtop-commits@incubator.apache.org From: schu@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120928183717.F37B123888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: schu Date: Fri Sep 28 18:37:17 2012 New Revision: 1391585 URL: http://svn.apache.org/viewvc?rev=1391585&view=rev Log: BIGTOP-719: Add TestTextSnappy to test hadoop fs -text with snappy compressed files Added: incubator/bigtop/branches/branch-0.3.1/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadooptests/TestTextSnappy.groovy Added: incubator/bigtop/branches/branch-0.3.1/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadooptests/TestTextSnappy.groovy URL: http://svn.apache.org/viewvc/incubator/bigtop/branches/branch-0.3.1/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadooptests/TestTextSnappy.groovy?rev=1391585&view=auto ============================================================================== --- incubator/bigtop/branches/branch-0.3.1/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadooptests/TestTextSnappy.groovy (added) +++ incubator/bigtop/branches/branch-0.3.1/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadooptests/TestTextSnappy.groovy Fri Sep 28 18:37:17 2012 @@ -0,0 +1,67 @@ +/** + * 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 + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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.hadooptests + +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 + +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 -rmr -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) + } + + private static void logError (final Shell sh) { + if (sh.getRet()) { + println ('Failed command: ' + sh.script); + println ('\terror code: ' + sh.getRet()); + println ('\tstdout: ' + sh.getOut()); + println ('\tstderr: ' + sh.getErr()); + } + } +}