Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fix jar path and add missing ones for spark jobs #14020

Merged
merged 4 commits into from
Feb 15, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ trait SharedSparkContext extends FunSuite with BeforeAndAfterEach with BeforeAnd
System.getProperty("user.dir")
}

private def getJarFilePath(root: String): String = {
val jarFiles = new File(s"$root/target/").listFiles(new FileFilter {
private def findJars(root: String): Array[File] = {
val excludedSuffixes = List("bundle", "src", "javadoc", "sources")
new File(root).listFiles(new FileFilter {
override def accept(pathname: File) = {
pathname.getAbsolutePath.endsWith(".jar") &&
!pathname.getAbsolutePath.contains("bundle") &&
!pathname.getAbsolutePath.contains("src")
excludedSuffixes.map(!pathname.getAbsolutePath.contains(_)).forall(identity)
ashutosh-dwivedi-e3502 marked this conversation as resolved.
Show resolved Hide resolved
}
})
}

private def getJarFilePath(root: String): String = {
val jarFiles = findJars(s"$root/target/")
if (jarFiles != null && jarFiles.nonEmpty) {
jarFiles.head.getAbsolutePath
} else {
Expand All @@ -96,13 +100,7 @@ trait SharedSparkContext extends FunSuite with BeforeAndAfterEach with BeforeAnd
}

private def getSparkJar: String = {
val jarFiles = new File(s"$composeWorkingDirPath/target/").listFiles(new FileFilter {
override def accept(pathname: File) = {
pathname.getAbsolutePath.endsWith(".jar") &&
!pathname.getAbsolutePath.contains("javadoc") &&
!pathname.getAbsolutePath.contains("sources")
}
})
val jarFiles = findJars(s"$composeWorkingDirPath/target/")
if (jarFiles != null && jarFiles.nonEmpty) {
jarFiles.head.getAbsolutePath
} else {
Expand Down