Skip to content

Commit

Permalink
Remove dependency on Wiremock
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Nov 6, 2024
1 parent c8a4344 commit e75c9ec
Show file tree
Hide file tree
Showing 7 changed files with 679 additions and 120 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:

- name: Run Unit Test
run: ./gradlew clean unitTest

- name: Upload Reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-reports-java${{ matrix.java }}-${{ runner.os }}
path: java-client/build/reports/
retention-days: 7

test-java8:
runs-on: ${{ matrix.os }}
Expand All @@ -48,3 +56,11 @@ jobs:

- name: Run Unit Test
run: ./gradlew clean unitTest -D"runtime.java=8"

- name: Upload Reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-reports-java8-${{ runner.os }}
path: java-client/build/reports/
retention-days: 7
41 changes: 28 additions & 13 deletions java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ sourceSets {
}

tasks.withType<ProcessResources> {
expand(
"version" to version,
"git_revision" to (if (rootProject.extra.has("gitHashFull")) rootProject.extra["gitHashFull"] else "unknown")
)
filesMatching("**/*.properties") {
expand(
"version" to version,
"git_revision" to (if (rootProject.extra.has("gitHashFull")) rootProject.extra["gitHashFull"] else "unknown")
)
}
}

tasks.withType<Javadoc>().configureEach{
Expand Down Expand Up @@ -137,6 +139,27 @@ tasks.build {
dependsOn("spotlessJavaCheck")
}

tasks.compileTestJava {
options.compilerArgs.add("-XDenableSunApiLintControl")
if (runtimeJavaVersion >= JavaVersion.VERSION_1_9) {
options.compilerArgs.addAll(
listOf(
"--add-exports=java.base/sun.security.util=ALL-UNNAMED",
"--add-exports=java.base/sun.security.x509=ALL-UNNAMED"
)
)
}
}

tasks.withType<Test> {
if (runtimeJavaVersion >= JavaVersion.VERSION_1_9) {
jvmArgs(
"--add-exports=java.base/sun.security.util=ALL-UNNAMED",
"--add-exports=java.base/sun.security.x509=ALL-UNNAMED"
)
}
}

tasks.test {
systemProperty("tests.security.manager", "false")

Expand Down Expand Up @@ -366,9 +389,6 @@ if (runtimeJavaVersion >= JavaVersion.VERSION_11) {
testImplementation("org.opensearch.test", "framework", opensearchVersion) {
exclude(group = "org.hamcrest")
}

// Apache 2.0
testImplementation("org.wiremock", "wiremock", "3.9.2")
}

tasks.named<JavaCompile>("compileJava11Java") {
Expand All @@ -381,12 +401,7 @@ if (runtimeJavaVersion >= JavaVersion.VERSION_11) {
sourceCompatibility = JavaVersion.VERSION_11.toString()
}

tasks.named<Test>("integrationTest") {
testClassesDirs += java11.output.classesDirs
classpath = sourceSets["java11"].runtimeClasspath
}

tasks.named<Test>("unitTest") {
tasks.withType<Test> {
testClassesDirs += java11.output.classesDirs
classpath = sourceSets["java11"].runtimeClasspath
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import jakarta.json.stream.JsonGenerator;
import java.util.List;
import java.util.function.Function;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch._types.ErrorResponse;
Expand All @@ -28,11 +28,11 @@
*/
public class DeletePitRequest extends RequestBase implements PlainJsonSerializable {

@Nullable
private List<String> pitId;
@Nonnull
private final List<String> pitId;

public DeletePitRequest(Builder builder) {
this.pitId = builder.pitId;
this.pitId = ApiTypeHelper.unmodifiable(builder.pitId);
}

public static DeletePitRequest of(Function<Builder, ObjectBuilder<DeletePitRequest>> fn) {
Expand All @@ -44,7 +44,7 @@ public static DeletePitRequest of(Function<Builder, ObjectBuilder<DeletePitReque
* <p>
* API name - {@code pit_id}
*/
@Nullable
@Nonnull
public final List<String> pitId() {
return this.pitId;
}
Expand Down Expand Up @@ -78,13 +78,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<DeletePitRequest> {
private List<String> pitId;

public final Builder pitId(@Nonnull String value, @Nonnull String... values) {
this.pitId = _listAdd(this.pitId, value, values);
return this;
}

/**
* A list of Pit IDs to be deleted
* <p>
* API name - {@code pit_id}
*/
public final Builder pitId(@Nullable List<String> pitId) {
this.pitId = pitId;
public final Builder pitId(@Nonnull List<String> pitId) {
this.pitId = _listAddAll(this.pitId, pitId);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public class AwsSdk2Transport implements OpenSearchTransport {
private final String signingServiceName;
private final Region signingRegion;
private final JsonpMapper defaultMapper;
@Nonnull
private final AwsSdk2TransportOptions transportOptions;

/**
Expand Down
Loading

0 comments on commit e75c9ec

Please sign in to comment.