Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Dec 7, 2024
1 parent 03922a9 commit d28a7ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ yarn-error.log
src/docs/.vuepress/dist/
.DS_Store
jd-gui.cfg
lib/
bin/
.vscode/
.kotlin
Original file line number Diff line number Diff line change
Expand Up @@ -224,37 +224,37 @@ class SimpleRelocatorTest {
@Test
fun testCanRelocateExcludedSourceFileWithRegex() {
val relocator = SimpleRelocator("org.foo")
relocator.excludeSources("%regex[org/apache/iceberg/.*]")
relocator.excludeSources("%regex[org/apache/spark/.*]")
relocator.exclude("%regex[org/apache/iceberg/.*]")
relocator.exclude("%regex[org/apache/spark/.*]")

assertThat(relocator.canRelocateSourceFile("org/apache/iceberg/spark/parquet/SparkNativeParquet.class")).isFalse()
assertThat(relocator.canRelocateSourceFile("org/apache/iceberg/spark/parquet/SparkNativeParquet\$.class")).isFalse()
assertThat(relocator.canRelocateSourceFile("org/apache/spark/sql/execution/datasources/parquet/v1.class")).isFalse()
assertThat(relocator.canRelocateSourceFile("org/foo/Class.class")).isTrue()
assertThat(relocator.canRelocatePath("org/apache/iceberg/spark/parquet/SparkNativeParquet.class")).isFalse()
assertThat(relocator.canRelocatePath("org/apache/iceberg/spark/parquet/SparkNativeParquet\$.class")).isFalse()
assertThat(relocator.canRelocatePath("org/apache/spark/sql/execution/datasources/parquet/v1.class")).isFalse()
assertThat(relocator.canRelocatePath("org/foo/Class.class")).isTrue()
}

@Test
fun testCanRelocateIncludedSourceFile() {
val relocator = SimpleRelocator("org.foo")
relocator.includeSources("org/apache/iceberg/spark/parquet/**")
relocator.includeSources("org/apache/spark/sql/execution/datasources/parquet/**")
relocator.include("org/apache/iceberg/spark/parquet/**")
relocator.include("org/apache/spark/sql/execution/datasources/parquet/**")

assertThat(relocator.canRelocateSourceFile("org/apache/iceberg/spark/parquet/SparkNativeParquet.class")).isTrue()
assertThat(relocator.canRelocateSourceFile("org/apache/iceberg/spark/parquet/SparkNativeParquet\$.class")).isTrue()
assertThat(relocator.canRelocateSourceFile("org/apache/spark/sql/execution/datasources/parquet/v1.class")).isTrue()
assertThat(relocator.canRelocateSourceFile("org/foo/Class.class")).isFalse()
assertThat(relocator.canRelocatePath("org/apache/iceberg/spark/parquet/SparkNativeParquet.class")).isTrue()
assertThat(relocator.canRelocatePath("org/apache/iceberg/spark/parquet/SparkNativeParquet\$.class")).isTrue()
assertThat(relocator.canRelocatePath("org/apache/spark/sql/execution/datasources/parquet/v1.class")).isTrue()
assertThat(relocator.canRelocatePath("org/foo/Class.class")).isFalse()
}

@Test
fun testCanRelocateIncludedSourceFileWithRegex() {
val relocator = SimpleRelocator("org.foo")
relocator.includeSources("%regex[org/apache/iceberg/.*]")
relocator.includeSources("%regex[org/apache/spark/.*]")
relocator.include("%regex[org/apache/iceberg/.*]")
relocator.include("%regex[org/apache/spark/.*]")

assertThat(relocator.canRelocateSourceFile("org/apache/iceberg/spark/parquet/SparkNativeParquet.class")).isTrue()
assertThat(relocator.canRelocateSourceFile("org/apache/iceberg/spark/parquet/SparkNativeParquet\$.class")).isTrue()
assertThat(relocator.canRelocateSourceFile("org/apache/spark/sql/execution/datasources/parquet/v1.class")).isTrue()
assertThat(relocator.canRelocateSourceFile("org/foo/Class.class")).isFalse()
assertThat(relocator.canRelocatePath("org/apache/iceberg/spark/parquet/SparkNativeParquet.class")).isTrue()
assertThat(relocator.canRelocatePath("org/apache/iceberg/spark/parquet/SparkNativeParquet\$.class")).isTrue()
assertThat(relocator.canRelocatePath("org/apache/spark/sql/execution/datasources/parquet/v1.class")).isTrue()
assertThat(relocator.canRelocatePath("org/foo/Class.class")).isFalse()
}

@Test
Expand Down

0 comments on commit d28a7ed

Please sign in to comment.