bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ofle...@apache.org
Subject [08/51] [abbrv] bigtop git commit: BIGTOP-2434. Change Spark test to unpack jar file and retrieve resources
Date Fri, 29 Jul 2016 17:02:49 GMT
BIGTOP-2434. Change Spark test to unpack jar file and retrieve resources


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/5e4bf8e2
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/5e4bf8e2
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/5e4bf8e2

Branch: refs/heads/BIGTOP-2253
Commit: 5e4bf8e23f4f220fe7247df9ee4126fa72bb0557
Parents: d00485a
Author: Dasha Boudnik <dasha@wandisco.com>
Authored: Sun May 22 12:49:05 2016 -0700
Committer: Dasha Boudnik <dasha@wandisco.com>
Committed: Sun May 22 12:49:05 2016 -0700

----------------------------------------------------------------------
 bigtop-tests/smoke-tests/spark/TestSpark.groovy | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/5e4bf8e2/bigtop-tests/smoke-tests/spark/TestSpark.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/spark/TestSpark.groovy b/bigtop-tests/smoke-tests/spark/TestSpark.groovy
index b8bd26a..4a715b3 100644
--- a/bigtop-tests/smoke-tests/spark/TestSpark.groovy
+++ b/bigtop-tests/smoke-tests/spark/TestSpark.groovy
@@ -20,6 +20,10 @@ package org.apache.bigtop.itest.spark
 
 import org.junit.BeforeClass
 import org.junit.AfterClass
+
+import java.util.jar.JarFile
+import java.util.zip.ZipInputStream
+
 import static org.junit.Assert.assertNotNull
 import org.apache.bigtop.itest.shell.Shell
 import static org.junit.Assert.assertTrue
@@ -42,7 +46,16 @@ class TestSpark {
   @BeforeClass
   static void setUp() {
     sh.exec("rm -f " + TEST_SPARKSQL_LOG)
-    sh.exec("hdfs dfs -put " + SPARK_HOME + "/examples examples")
+    // create HDFS examples/src/main/resources
+    sh.exec("hdfs dfs -mkdir -p examples/src/main/resources")
+    // extract people.txt file into it
+    String examplesJar = JarContent.getJarName("$SPARK_HOME/lib", 'spark-examples.*jar')
+    assertNotNull(examplesJar, "spark-examples.jar file wasn't found")
+    ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream("$SPARK_HOME/lib/$examplesJar"))
+    File examplesDir = new File('examples')
+    examplesDir.mkdirs()
+    zipInputStream.unzip(examplesDir.getName(), 'people')
+    sh.exec("hdfs dfs -put examples/* examples/src/main/resources")
     logError(sh)
   }
 


Mime
View raw message