Skip to content

Commit a28b1b7

Browse files
committed
[SPARK-52135] Remove powermock-core dependency
### What changes were proposed in this pull request? This PR aims to remove `powermock-core` dependency. ### Why are the changes needed? We had better minimize the dependency list by reducing old dependency like `powermock` which was released on 2020-11-01. - https://github.com/powermock/powermock/releases/tag/powermock-2.0.9 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#198 from dongjoon-hyun/SPARK-52135. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 76c4317 commit a28b1b7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

gradle/libs.versions.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ log4j = "2.24.3"
2727
junit = "5.12.2"
2828
jacoco = "0.8.13"
2929
mockito = "5.17.0"
30-
powermock = "2.0.9"
3130

3231
# Build Analysis
3332
checkstyle = "10.17.0"
@@ -64,7 +63,6 @@ mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mo
6463
junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit"}
6564
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit"}
6665
junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher"}
67-
powermock-core = { group = "org.powermock", name = "powermock-core", version.ref = "powermock"}
6866
spotbugs-gradle-plugin = { group = "com.github.spotbugs.snom", name = "spotbugs-gradle-plugin", version.ref = "spotbugs-plugin" }
6967
spotless-plugin-gradle = { group = "com.diffplug.spotless", name = "spotless-plugin-gradle", version.ref = "spotless-plugin" }
7068
shadow = { group = "com.gradleup.shadow", name = "shadow-gradle-plugin", version.ref = "shadow-jar-plugin"}

spark-operator/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ dependencies {
7777
testImplementation(libs.mockwebserver)
7878
testImplementation platform(libs.junit.bom)
7979
testImplementation(libs.junit.jupiter)
80-
testImplementation(libs.powermock.core)
8180
testRuntimeOnly(libs.junit.platform.launcher)
8281

8382
testImplementation(libs.mockito.core)

spark-operator/src/test/java/org/apache/spark/k8s/operator/utils/TestUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.Map;
2727

2828
import io.fabric8.kubernetes.api.model.ObjectMeta;
29-
import org.powermock.reflect.Whitebox;
29+
import org.apache.commons.lang3.reflect.FieldUtils;
3030

3131
import org.apache.spark.k8s.operator.Constants;
3232
import org.apache.spark.k8s.operator.SparkApplication;
@@ -67,6 +67,10 @@ public static long calculateElapsedTimeInMills(long startTime) {
6767
}
6868

6969
public static <T> void setConfigKey(ConfigOption<T> configKey, T newValue) {
70-
Whitebox.setInternalState(configKey, "defaultValue", newValue);
70+
try {
71+
FieldUtils.writeField(configKey, "defaultValue", newValue, true);
72+
} catch (IllegalAccessException e) {
73+
throw new UnsupportedOperationException(e);
74+
}
7175
}
7276
}

0 commit comments

Comments
 (0)