incubator-bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
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 GMT
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
+ * <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.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());
+    }
+  }
+}



Mime
View raw message