From 8e1d91ae7d69885b823c4263c72b759c9367fd83 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 1 Nov 2024 17:06:33 +1300 Subject: [PATCH] Move test under Java 11 Signed-off-by: Thomas Farr --- java-client/build.gradle.kts | 70 +++++++++---------- .../transport/aws/AwsSdk2TransportTests.java | 0 2 files changed, 35 insertions(+), 35 deletions(-) rename java-client/src/test/{java => java11}/org/opensearch/client/transport/aws/AwsSdk2TransportTests.java (100%) diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index d82d57bf72..1bc692ab97 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -239,9 +239,6 @@ dependencies { testImplementation("junit", "junit" , "4.13.2") { exclude(group = "org.hamcrest") } - - // Apache 2.0 - testImplementation("org.wiremock", "wiremock", "3.9.2") } licenseReport { @@ -354,40 +351,43 @@ publishing { } if (runtimeJavaVersion >= JavaVersion.VERSION_11) { - val java11: SourceSet = sourceSets.create("java11") { - java { - compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output - runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output - srcDir("src/test/java11") + val java11: SourceSet = sourceSets.create("java11") { + java { + compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output + runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output + srcDir("src/test/java11") + } } - } - configurations[java11.implementationConfigurationName].extendsFrom(configurations.testImplementation.get()) - configurations[java11.runtimeOnlyConfigurationName].extendsFrom(configurations.testRuntimeOnly.get()) + configurations[java11.implementationConfigurationName].extendsFrom(configurations.testImplementation.get()) + configurations[java11.runtimeOnlyConfigurationName].extendsFrom(configurations.testRuntimeOnly.get()) + + dependencies { + testImplementation("org.opensearch.test", "framework", opensearchVersion) { + exclude(group = "org.hamcrest") + } + + // Apache 2.0 + testImplementation("org.wiremock", "wiremock", "3.9.2") + } + + tasks.named("compileJava11Java") { + targetCompatibility = JavaVersion.VERSION_11.toString() + sourceCompatibility = JavaVersion.VERSION_11.toString() + } + + tasks.named("compileTestJava") { + targetCompatibility = JavaVersion.VERSION_11.toString() + sourceCompatibility = JavaVersion.VERSION_11.toString() + } + + tasks.named("integrationTest") { + testClassesDirs += java11.output.classesDirs + classpath = sourceSets["java11"].runtimeClasspath + } - dependencies { - testImplementation("org.opensearch.test", "framework", opensearchVersion) { - exclude(group = "org.hamcrest") + tasks.named("unitTest") { + testClassesDirs += java11.output.classesDirs + classpath = sourceSets["java11"].runtimeClasspath } - } - - tasks.named("compileJava11Java") { - targetCompatibility = JavaVersion.VERSION_11.toString() - sourceCompatibility = JavaVersion.VERSION_11.toString() - } - - tasks.named("compileTestJava") { - targetCompatibility = JavaVersion.VERSION_11.toString() - sourceCompatibility = JavaVersion.VERSION_11.toString() - } - - tasks.named("integrationTest") { - testClassesDirs += java11.output.classesDirs - classpath = sourceSets["java11"].runtimeClasspath - } - - tasks.named("unitTest") { - testClassesDirs += java11.output.classesDirs - classpath = sourceSets["java11"].runtimeClasspath - } } diff --git a/java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportTests.java b/java-client/src/test/java11/org/opensearch/client/transport/aws/AwsSdk2TransportTests.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportTests.java rename to java-client/src/test/java11/org/opensearch/client/transport/aws/AwsSdk2TransportTests.java