Clean up http-client changes (#295)

* pkl-excutor tests: symlink 0.25.0 distribution into pkl-executable/build
* Use `IoUtils.getPklHomeDir` in HttpClientBuilder
* Simplify Exceptions.java
* Enable testing for older pkl-executor distribution
This commit is contained in:
Daniel Chao
2024-03-07 10:43:04 -08:00
committed by GitHub
parent 3fb1f03780
commit 9defe868c0
7 changed files with 84 additions and 66 deletions

View File

@@ -39,7 +39,7 @@ class EmbeddedExecutorTest {
// This context has a pkl-executor version that is lower than the distribution version.
// It can be enabled once there is a distribution that includes pkl-executor.
//ExecutionContext(executor1_2.value, ::convertToOptions1, "Options1, Executor1, Distribution2"),
ExecutionContext(executor1_2.value, ::convertToOptions1, "Options1, Executor1, Distribution2"),
ExecutionContext(executor2_1.value, ::convertToOptions1, "Options1, Executor2, Distribution1"),
ExecutionContext(executor2_1.value, ::convertToOptions2, "Options2, Executor2, Distribution1"),
@@ -70,7 +70,7 @@ class EmbeddedExecutorTest {
}
// A pkl-executor library that supports ExecutorSpiOptions up to v2
// and a Pkl distribution that supports ExecutorSpiOptions up to v.
// and a Pkl distribution that supports ExecutorSpiOptions up to v2.
private val executor2_2: Lazy<Executor> = lazy {
EmbeddedExecutor(listOf(pklDistribution2), pklExecutorClassLoader2)
}
@@ -98,28 +98,22 @@ class EmbeddedExecutorTest {
if (executor.isInitialized()) executor.value.close()
}
}
// a Pkl distribution that supports ExecutorSpiOptions up to v1
private val pklDistribution1: Path by lazy {
val path = System.getProperty("pklDistribution025")?.toPath() ?:
// can get rid of this path by switching to IntelliJ's Gradle test runner
System.getProperty("user.home").toPath()
.resolve(".gradle/caches/modules-2/files-2.1/org.pkl-lang/pkl-config-java-all/" +
"0.25.0/e9451dda554f1659e49ff5bdd30accd26be7bf0f/pkl-config-java-all-0.25.0.jar")
path.apply {
if (!exists()) throw AssertionError("Missing test fixture. " +
FileTestUtils.rootProjectDir.resolve("pkl-executor/build/pklHistoricalDistributions/pkl-config-java-all-0.25.0.jar").apply {
if (!exists()) {
throw AssertionError("Missing test fixture. " +
"To fix this problem, run `./gradlew :pkl-executor:prepareTest`.")
}
}
}
// a Pkl distribution that supports ExecutorSpiOptions up to v2
private val pklDistribution2: Path by lazy {
val path = System.getProperty("pklDistributionCurrent")?.toPath() ?:
// can get rid of this path by switching to IntelliJ's Gradle test runner
FileTestUtils.rootProjectDir
.resolve("pkl-config-java/build/libs/pkl-config-java-all-" +
"${Release.current().version().withBuild(null).toString().replaceFirst("dev", "SNAPSHOT")}.jar")
path.apply {
FileTestUtils.rootProjectDir
.resolve("pkl-config-java/build/libs/pkl-config-java-all-" +
"${Release.current().version().withBuild(null).toString().replaceFirst("dev", "SNAPSHOT")}.jar").apply {
if (!exists()) throw AssertionError("Missing test fixture. " +
"To fix this problem, run `./gradlew :pkl-executor:prepareTest`.")
}