Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/9106#discussion_r42060363
--- Diff:
core/src/test/scala/org/apache/spark/util/MutableURLClassLoaderSuite.scala ---
@@ -68,6 +79,33 @@ class MutableURLClassLoaderSuite extends SparkFunSuite {
}
}
+ test("default JDK classloader get resources") {
+ val parentLoader = new URLClassLoader(fileUrlsParent, null)
+ val classLoader = new URLClassLoader(fileUrlsChild, parentLoader)
+ assert(classLoader.getResources("resource1").asScala.size == 2)
+ assert(classLoader.getResources("resource2").asScala.size == 1)
+ }
+
+ test("parent first get resources") {
+ val parentLoader = new URLClassLoader(fileUrlsParent, null)
+ val classLoader = new MutableURLClassLoader(fileUrlsChild,
parentLoader)
+ assert(classLoader.getResources("resource1").asScala.size == 2)
+ assert(classLoader.getResources("resource2").asScala.size == 1)
+ }
+
+ test("child first get resources") {
+ val parentLoader = new URLClassLoader(fileUrlsParent, null)
+ val classLoader = new ChildFirstURLClassLoader(fileUrlsChild,
parentLoader)
+
+ val res1 = classLoader.getResources("resource1").asScala.toList
+ assert(res1.size == 2)
+ assert(classLoader.getResources("resource2").asScala.size == 1)
--- End diff --
ah, missed this before, but tests should use `===`. Other than that, patch
looks good.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]