aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests/test_includeJAR.R
diff options
context:
space:
mode:
authorcafreeman <cfreeman@alteryx.com>2015-06-26 17:06:02 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-06-26 17:06:16 -0700
commit9d11817765e2817b11b73c61bae3b32c9f119cfd (patch)
treef18c3613ffadddb0c509ede94820966cd59ff4c0 /R/pkg/inst/tests/test_includeJAR.R
parenta56516fc9280724db8fdef8e7d109ed7e28e427d (diff)
downloadspark-9d11817765e2817b11b73c61bae3b32c9f119cfd.tar.gz
spark-9d11817765e2817b11b73c61bae3b32c9f119cfd.tar.bz2
spark-9d11817765e2817b11b73c61bae3b32c9f119cfd.zip
[SPARK-8607] SparkR -- jars not being added to application classpath correctly
Add `getStaticClass` method in SparkR's `RBackendHandler` This is a fix for the problem referenced in [SPARK-5185](https://issues.apache.org/jira/browse/SPARK-5185). cc shivaram Author: cafreeman <cfreeman@alteryx.com> Closes #7001 from cafreeman/branch-1.4 and squashes the following commits: 8f81194 [cafreeman] Add missing license 31aedcf [cafreeman] Refactor test to call an external R script 2c22073 [cafreeman] Merge branch 'branch-1.4' of github.com:apache/spark into branch-1.4 0bea809 [cafreeman] Fixed relative path issue and added smaller JAR ee25e60 [cafreeman] Merge branch 'branch-1.4' of github.com:apache/spark into branch-1.4 9a5c362 [cafreeman] test for including JAR when launching sparkContext 9101223 [cafreeman] Merge branch 'branch-1.4' of github.com:apache/spark into branch-1.4 5a80844 [cafreeman] Fix style nits 7c6bd0c [cafreeman] [SPARK-8607] SparkR (cherry picked from commit 2579948bf5d89ac2d822ace605a6a4afce5258d6) Signed-off-by: Shivaram Venkataraman <shivaram@cs.berkeley.edu>
Diffstat (limited to 'R/pkg/inst/tests/test_includeJAR.R')
-rw-r--r--R/pkg/inst/tests/test_includeJAR.R37
1 files changed, 37 insertions, 0 deletions
diff --git a/R/pkg/inst/tests/test_includeJAR.R b/R/pkg/inst/tests/test_includeJAR.R
new file mode 100644
index 0000000000..8bc693be20
--- /dev/null
+++ b/R/pkg/inst/tests/test_includeJAR.R
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+context("include an external JAR in SparkContext")
+
+runScript <- function() {
+ sparkHome <- Sys.getenv("SPARK_HOME")
+ jarPath <- paste("--jars",
+ shQuote(file.path(sparkHome, "R/lib/SparkR/test_support/sparktestjar_2.10-1.0.jar")))
+ scriptPath <- file.path(sparkHome, "R/lib/SparkR/tests/jarTest.R")
+ submitPath <- file.path(sparkHome, "bin/spark-submit")
+ res <- system2(command = submitPath,
+ args = c(jarPath, scriptPath),
+ stdout = TRUE)
+ tail(res, 2)
+}
+
+test_that("sparkJars tag in SparkContext", {
+ testOutput <- runScript()
+ helloTest <- testOutput[1]
+ expect_true(helloTest == "Hello, Dave")
+ basicFunction <- testOutput[2]
+ expect_true(basicFunction == 4L)
+})