Skip to content

Commit

Permalink
project: upgrade wiremock
Browse files Browse the repository at this point in the history
  • Loading branch information
ibodrov committed Apr 6, 2024
1 parent faa158a commit cd38a76
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 70 deletions.
4 changes: 2 additions & 2 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
import com.walmartlabs.concord.ApiClient;
import com.walmartlabs.concord.sdk.Constants;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Disabled("due to wiremock compatibility issues with jetty 12")
@WireMockTest
public class SecretClientTest {

Expand Down
4 changes: 2 additions & 2 deletions client2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Disabled("due to wiremock compatibility issues with jetty 12")
@WireMockTest
public class SecretClientTest {

Expand Down
4 changes: 2 additions & 2 deletions it/runtime-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.walmartlabs.concord.common.IOUtils;
import com.walmartlabs.concord.sdk.Constants;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.Testcontainers;
Expand All @@ -51,7 +50,6 @@
import static com.walmartlabs.concord.common.IOUtils.createTempFile;
import static com.walmartlabs.concord.it.common.ITUtils.randomString;

@Disabled("due to wiremock compatibility issues with jetty 12")
public class TemplateIT extends AbstractTest {

@RegisterExtension
Expand Down
4 changes: 2 additions & 2 deletions it/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.walmartlabs.concord.client2.StartProcessResponse;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -39,7 +38,6 @@
import static com.walmartlabs.concord.it.common.ServerClient.assertLog;
import static com.walmartlabs.concord.it.common.ServerClient.waitForStatus;

@Disabled("due to wiremock compatibility issues with jetty 12")
public class DependencyManagerIT extends AbstractServerIT {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.walmartlabs.concord.client2.StartProcessResponse;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -49,7 +48,6 @@
import static com.walmartlabs.concord.it.common.ServerClient.waitForCompletion;
import static org.junit.jupiter.api.Assertions.assertEquals;

@Disabled("due to wiremock compatibility issues with jetty 12")
public class HttpTaskIT extends AbstractServerIT {

private static final String mockHttpBaseUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,22 @@
import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
import com.walmartlabs.concord.client2.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static com.walmartlabs.concord.it.common.ITUtils.archive;
import static com.walmartlabs.concord.it.common.ServerClient.assertLog;
import static com.walmartlabs.concord.it.common.ServerClient.waitForCompletion;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@Disabled("due to wiremock compatibility issues with jetty 12")
public class NodeRosterIT extends AbstractServerIT {

@RegisterExtension
Expand Down
4 changes: 2 additions & 2 deletions plugins/tasks/http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ protected void stubForJsonResponse() {
.withHeader("Content-Type", "application/json")
.withHeader("Accept", "application/json")
.withBody("[\n" +
" {\n" +
" \"id\": 1,\n" +
" \"version\": \"1.0\"\n" +
" },\n" +
" {\n" +
" \"id\": 2,\n" +
" \"test\": \"1.1\"\n" +
" }\n" +
"]"))
" {\n" +
" \"id\": 1,\n" +
" \"version\": \"1.0\"\n" +
" },\n" +
" {\n" +
" \"id\": 2,\n" +
" \"test\": \"1.1\"\n" +
" }\n" +
"]"))
);
}

Expand Down Expand Up @@ -153,8 +153,8 @@ protected void stubForPostRequest() {
.withHeader("Content-Type", "application/json")
.withHeader("Accept", "application/json")
.withBody("{\n" +
" \"message\": \"Success\"\n" +
"}"))
" \"message\": \"Success\"\n" +
"}"))
);
}

Expand Down Expand Up @@ -192,11 +192,11 @@ protected void stubForPostRequestForRequestTypeFile() {
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody("{\n" +
" \"testObject\": {\n" +
" \"testString\": \"hello\",\n" +
" \"testInteger\": \"2\"\n" +
" }\n" +
"}"))
" \"testObject\": {\n" +
" \"testString\": \"hello\",\n" +
" \"testInteger\": \"2\"\n" +
" }\n" +
"}"))
);
}

Expand Down Expand Up @@ -247,8 +247,8 @@ protected void stubForDeleteRequest() {
.withHeader("Content-Type", "application/json")
.withHeader("Accept", "application/json")
.withBody("{\n" +
" \"message\": \"Success\"\n" +
"}"))
" \"message\": \"Success\"\n" +
"}"))
);
}

Expand All @@ -259,8 +259,8 @@ protected void stubForPatchRequest() {
.withHeader("Content-Type", "application/json")
.withHeader("Accept", "application/json")
.withBody("{\n" +
" \"message\": \"Success\"\n" +
"}"))
" \"message\": \"Success\"\n" +
"}"))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import com.walmartlabs.concord.plugins.http.exception.RequestTimeoutException;
import com.walmartlabs.concord.sdk.Context;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

Expand All @@ -38,7 +37,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@Disabled("due to wiremock compatibility issues with jetty 12")
public class HttpTaskTest extends AbstractHttpTaskTest {

private final Context mockContext = mock(Context.class);
Expand Down Expand Up @@ -133,7 +131,7 @@ public void testExecutePostRequestForMultipart(WireMockRuntimeInfo wmRuntimeInfo

@Test
public void testExecuteForException(WireMockRuntimeInfo wmRuntimeInfo) throws Exception {
assertThrows(Exception.class, () -> {
assertThrows(Exception.class, () -> {
initCxtForRequest(mockContext, "GET", "string", "string",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/fault", false, 0, true);
task.execute(mockContext);
Expand Down Expand Up @@ -183,7 +181,7 @@ public void testExecutePostRequestWithFollowRedirect(WireMockRuntimeInfo wmRunti

@Test
public void testIllegalArgumentExceptionForRequest() {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
task.execute(mockContext);
});
}
Expand Down Expand Up @@ -228,7 +226,7 @@ public void testFilePostRequest(WireMockRuntimeInfo wmRuntimeInfo) throws Except

@Test
public void testForMissingWorkDirForFileGetRequest(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
// Working directory is mandatory for response type file
initCxtForRequest(mockContext, "GET", "json", "file",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/stringFile", false, 0, true);
Expand Down Expand Up @@ -279,7 +277,7 @@ public void testFileGetWithResponseTypeJSON(WireMockRuntimeInfo wmRuntimeInfo, @

@Test
public void testPostJsonRequestForIncompatibleBody(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "POST", "json", "string",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/post", false, 0, true);
when(mockContext.getVariable("body")).thenReturn("src/test/resources/__files/file.bin");
Expand All @@ -289,7 +287,7 @@ public void testPostJsonRequestForIncompatibleBody(WireMockRuntimeInfo wmRuntime

@Test
public void testPostStringRequestForIncompatibleComplexBody(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "POST", "string", "string",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/post", false, 0, true);
when(mockContext.getVariable("body")).thenReturn(new HashMap<>());
Expand All @@ -299,7 +297,7 @@ public void testPostStringRequestForIncompatibleComplexBody(WireMockRuntimeInfo

@Test
public void testPostFileRequestForIncompatibleComplexBody(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "POST", "file", "string",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/post", false, 0, true);
when(mockContext.getVariable("body")).thenReturn(new HashMap<>());
Expand All @@ -309,7 +307,7 @@ public void testPostFileRequestForIncompatibleComplexBody(WireMockRuntimeInfo wm

@Test
public void testInvalidRequestMethodType(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "GET1", "json", "file",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/file", false, 0, true);
task.execute(mockContext);
Expand All @@ -318,7 +316,7 @@ public void testInvalidRequestMethodType(WireMockRuntimeInfo wmRuntimeInfo) {

@Test
public void testInvalidRequestType(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "GET", "json1", "file",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/file", false, 0, true);
task.execute(mockContext);
Expand All @@ -327,7 +325,7 @@ public void testInvalidRequestType(WireMockRuntimeInfo wmRuntimeInfo) {

@Test
public void testInvalidResponseType(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "GET", "json", "file1",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/file", false, 0, true);
task.execute(mockContext);
Expand Down Expand Up @@ -366,7 +364,7 @@ public void testPatch(WireMockRuntimeInfo wmRuntimeInfo) throws Exception {

@Test
public void testRequestTimeoutException(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(RequestTimeoutException.class, () -> {
assertThrows(RequestTimeoutException.class, () -> {
initCxtForRequest(mockContext, "GET", "string", "string",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/requestTimeout", false, 5000, true);
task.execute(mockContext);
Expand All @@ -375,7 +373,7 @@ public void testRequestTimeoutException(WireMockRuntimeInfo wmRuntimeInfo) {

@Test
public void testInvalidJsonResponse(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(RuntimeException.class, () -> {
assertThrows(RuntimeException.class, () -> {
initCxtForRequest(mockContext, "GET", "json", "json",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/invalid/json", false, 0, true);
task.execute(mockContext);
Expand All @@ -384,7 +382,7 @@ public void testInvalidJsonResponse(WireMockRuntimeInfo wmRuntimeInfo) {

@Test
public void testInvalidRequestMethod(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, 123, "json", "json",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/json", false, 0, true);
task.execute(mockContext);
Expand All @@ -393,7 +391,7 @@ public void testInvalidRequestMethod(WireMockRuntimeInfo wmRuntimeInfo) {

@Test
public void testInvalidRequest(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "GET", 123, "json",
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/json", false, 0, true);
task.execute(mockContext);
Expand All @@ -402,7 +400,7 @@ public void testInvalidRequest(WireMockRuntimeInfo wmRuntimeInfo) {

@Test
public void testInvalidResponse(WireMockRuntimeInfo wmRuntimeInfo) {
assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalArgumentException.class, () -> {
initCxtForRequest(mockContext, "GET", "json", 123,
"http://localhost:" + wmRuntimeInfo.getHttpPort() + "/json", false, 0, true);
task.execute(mockContext);
Expand Down
Loading

0 comments on commit cd38a76

Please sign in to comment.