From 65704b58ded44c412898622678b926751e946354 Mon Sep 17 00:00:00 2001 From: holomekc <30546982+holomekc@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:57:35 +0200 Subject: [PATCH] feat: WireMock 3.8.0 - Update to WireMock 3.8.0 - Update dependencies, which were stuck due to breaking changes - Fix issues in code editor and entry to improve performance - Drop old vkbeautify library. Instead, use JSON and xml-formatter - Update eslint config and setup, which was a pain --- .run/Build WireMock.run.xml | 4 +- .run/WebApp lint --fix.run.xml | 4 +- .run/WebApp lint.run.xml | 4 +- .run/WebApp start.run.xml | 2 +- .snyk | 22 + build.gradle | 115 +- gradle.properties | 2 +- .../wiremock/admin/AdminRoutes.java | 4 +- ...tubFilesTask.java => GetStubFileTask.java} | 34 +- .../wiremock/client/BasicMappingBuilder.java | 17 +- .../wiremock/client/MappingBuilder.java | 10 +- .../tomakehurst/wiremock/client/WireMock.java | 25 +- .../wiremock/common/AbstractFileSource.java | 36 +- .../common/DefaultNetworkAddressRules.java | 16 +- .../tomakehurst/wiremock/common/KeyLocks.java | 65 + .../wiremock/common/NetworkAddressRange.java | 4 +- .../wiremock/common/NetworkAddressRules.java | 10 +- .../tomakehurst/wiremock/common/Urls.java | 18 +- .../wiremock/common/xml/XmlDocument.java | 21 +- .../wiremock/common/xml/XmlDomNode.java | 131 + .../wiremock/common/xml/XmlNode.java | 129 +- .../wiremock/common/xml/XmlPrimitiveNode.java | 39 + .../tomakehurst/wiremock/core/Options.java | 15 +- .../wiremock/core/WireMockApp.java | 26 +- .../wiremock/core/WireMockConfiguration.java | 36 +- .../wiremock/extension/Extension.java | 6 +- .../wiremock/extension/Extensions.java | 17 +- .../extension/ServeEventListenerUtils.java | 48 + .../LazyTemplateEngine.java | 7 + .../responsetemplating/RequestLine.java | 20 +- .../RequestPartTemplateModel.java | 66 + .../RequestTemplateModel.java | 60 +- .../ResponseTemplateTransformer.java | 15 +- .../responsetemplating/TemplateEngine.java | 87 +- .../responsetemplating/TemplatedUrlPath.java | 6 +- .../helpers/AbstractArrayHelper.java | 38 + .../helpers/ArrayAddHelper.java | 60 + .../helpers/ArrayRemoveHelper.java | 46 + .../helpers/JoinHelper.java | 88 + .../helpers/MathsHelper.java | 7 +- .../responsetemplating/helpers/ValHelper.java | 35 + .../helpers/WireMockHelpers.java | 61 +- .../tomakehurst/wiremock/http/Body.java | 2 +- .../wiremock/http/ContentTypeHeader.java | 2 +- .../wiremock/http/HttpClientFactory.java | 22 +- ...etworkAddressRulesAdheringDnsResolver.java | 10 +- .../tomakehurst/wiremock/http/Request.java | 17 +- .../wiremock/http/RequestIdDecorator.java | 176 + .../http/RequestPathParamsDecorator.java | 181 + .../wiremock/http/StubRequestHandler.java | 34 +- .../http/client/ApacheBackedHttpClient.java | 20 +- .../http/client/ApacheHttpClientFactory.java | 4 +- .../http/multipart/FileItemPartAdapter.java | 9 +- .../wiremock/junit5/WireMockExtension.java | 59 +- .../matching/AbstractDateTimeMatchResult.java | 3 + .../wiremock/matching/EagerMatchResult.java | 9 +- .../wiremock/matching/EqualToXmlPattern.java | 37 +- .../wiremock/matching/MatchResult.java | 44 +- .../matching/MemoizingMatchResult.java | 5 + .../wiremock/matching/RequestPattern.java | 2 + .../matching/RequestPatternBuilder.java | 9 +- .../StringValuePatternJsonDeserializer.java | 5 +- .../WeightedAggregateMatchResult.java | 9 + .../wiremock/servlet/WarConfiguration.java | 20 + .../WireMockHttpServletRequestAdapter.java | 2 +- .../standalone/CommandLineOptions.java | 56 +- .../wiremock/store/DefaultStores.java | 25 +- .../wiremock/store/InMemoryObjectStore.java | 98 + .../wiremock/store/ObjectStore.java | 28 + .../tomakehurst/wiremock/store/Stores.java | 17 +- .../wiremock/store/StubMappingStore.java | 2 +- .../files/FileSourceJsonObjectStore.java | 121 + .../stubbing/AbstractStubMappings.java | 50 +- .../stubbing/InMemoryStubMappings.java | 5 +- .../wiremock/stubbing/ServeEvent.java | 20 +- .../stubbing/StoreBackedStubMappings.java | 9 +- .../wiremock/verification/LoggedRequest.java | 22 + .../wiremock/verification/diff/Diff.java | 91 +- .../diff/DiffDescriptionLine.java | 46 + .../wiremock/verification/diff/DiffLine.java | 17 + .../diff/NamedCustomMatcherLine.java | 10 +- .../java/org/wiremock/webhooks/Webhooks.java | 34 +- .../resources/swagger/wiremock-admin-api.json | 2 +- .../resources/swagger/wiremock-admin-api.yaml | 2 +- src/main/resources/version.properties | 2 +- .../tomakehurst/wiremock/AdminApiTest.java | 17 + .../CustomMatchingAcceptanceTest.java | 62 +- .../wiremock/FailingWebhookTest.java | 113 +- .../MultipartBodyMatchingAcceptanceTest.java | 79 + .../MultipartTemplatingAcceptanceTest.java | 182 + .../wiremock/ProxyAcceptanceTest.java | 47 +- ...DefinitionTransformerV2AcceptanceTest.java | 52 +- .../ResponseTemplatingAcceptanceTest.java | 19 +- .../wiremock/StubbingAcceptanceTest.java | 28 + .../wiremock/WebhooksAcceptanceTest.java | 87 + ...hooksAcceptanceViaPostServeActionTest.java | 81 +- .../WebhooksAcceptanceViaServeEventTest.java | 149 +- .../wiremock/client/HttpAdminClientTest.java | 27 +- .../common/ServletContextFileSourceTest.java | 7 +- .../common/SingleRootFileSourceTest.java | 55 +- .../tomakehurst/wiremock/common/UrlsTest.java | 17 +- .../core/WireMockConfigurationTest.java | 9 +- .../ExtensionLifeCycleAcceptanceTest.java | 102 + .../ResponseTemplateTransformerTest.java | 252 + .../helpers/ArrayAddHelperTest.java | 111 + .../helpers/ArrayRemoveHelperTest.java | 71 + .../helpers/HandlebarsHelperTestBase.java | 16 +- .../helpers/HandlebarsXPathHelperTest.java | 31 +- .../helpers/MathsHelperTest.java | 7 +- .../helpers/ValHelperTest.java | 70 + ...rkAddressRulesAdheringDnsResolverTest.java | 14 +- .../http/ProxyResponseRendererTest.java | 4 +- .../matching/EqualToDateTimePatternTest.java | 42 + .../matching/EqualToXmlPatternTest.java | 50 +- .../wiremock/matching/MockRequest.java | 12 + .../standalone/CommandLineOptionsTest.java | 51 + .../store/InMemoryObjectStoreTest.java | 117 + .../files/FileSourceJsonObjectStoreTest.java | 185 + .../diff/PlainTextDiffRendererTest.java | 115 +- src/test/java/ignored/Examples.java | 5 +- .../frozen/do-not-throw-generic-exception | 2 - ...-matchers-self-describing-named-custom.txt | 17 + ...e_mixed-matchers-weighted-named-custom.txt | 18 + ...-weighted-self-describing-named-custom.txt | 16 + ...-diff-sample_no_path_parameter_message.txt | 17 + ...-found-diff-sample_url-path-parameters.txt | 2 +- .../WireMockScalaAcceptanceTest.scala | 23 +- .../testsupport/MockWireMockServices.java | 4 +- .../wiremock/testsupport/TestNotifier.java | 4 +- .../wiremock/testsupport/WireMatchers.java | 1 + ui/package.json | 2 +- webapp/wiremock/.eslintrc.json | 67 - webapp/wiremock/angular.json | 2 +- webapp/wiremock/eslint.config.js | 78 + webapp/wiremock/package-lock.json | 7879 ++++++++--------- webapp/wiremock/package.json | 54 +- .../code-editor/code-editor.component.ts | 11 +- .../code-entry/code-entry.component.html | 2 +- .../code-entry/code-entry.component.ts | 4 +- .../mapping-test/mapping-test.component.ts | 3 - .../mappings/mapping-helper.service.ts | 12 +- .../mappings/mappings.component.html | 6 +- .../components/mappings/mappings.component.ts | 1 - .../separated/separated.component.html | 6 +- .../separated/separated.component.ts | 1 - .../model/wiremock/get-serve-events-result.ts | 1 - .../wiremock/list-stub-mappings-result.ts | 1 - .../src/app/model/wiremock/logged-request.ts | 6 +- .../src/app/model/wiremock/logged-response.ts | 4 +- .../src/app/model/wiremock/record-spec.ts | 19 +- .../model/wiremock/recording-status-result.ts | 1 - .../src/app/model/wiremock/request-pattern.ts | 12 +- .../app/model/wiremock/response-definition.ts | 18 +- .../serve-event-listener-definition.ts | 3 - .../src/app/model/wiremock/stub-mapping.ts | 4 +- .../src/app/pipes/is-no-object.pipe.ts | 1 - .../wiremock/src/app/pipes/is-object.pipe.ts | 1 - webapp/wiremock/src/app/pipes/keys.pipe.ts | 4 +- .../wiremock/src/app/pipes/prettify.pipe.ts | 5 +- .../src/app/pipes/split-camel-case.pipe.ts | 1 - .../wiremock/src/app/services/util.service.ts | 49 +- .../src/app/services/web-socket.service.ts | 1 - .../src/app/services/wiremock.service.ts | 33 +- webapp/wiremock/src/test.ts | 1 - 164 files changed, 8312 insertions(+), 5165 deletions(-) create mode 100644 .snyk rename src/main/java/com/github/tomakehurst/wiremock/admin/tasks/{GetStubFilesTask.java => GetStubFileTask.java} (52%) create mode 100644 src/main/java/com/github/tomakehurst/wiremock/common/KeyLocks.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/common/xml/XmlDomNode.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/common/xml/XmlPrimitiveNode.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/ServeEventListenerUtils.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/RequestPartTemplateModel.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/AbstractArrayHelper.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/ArrayAddHelper.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/ArrayRemoveHelper.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/JoinHelper.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/ValHelper.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/http/RequestIdDecorator.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/http/RequestPathParamsDecorator.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/store/InMemoryObjectStore.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/store/ObjectStore.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/store/files/FileSourceJsonObjectStore.java create mode 100644 src/main/java/com/github/tomakehurst/wiremock/verification/diff/DiffDescriptionLine.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/MultipartTemplatingAcceptanceTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/WebhooksAcceptanceTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/extension/ExtensionLifeCycleAcceptanceTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/ArrayAddHelperTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/ArrayRemoveHelperTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/ValHelperTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/store/InMemoryObjectStoreTest.java create mode 100644 src/test/java/com/github/tomakehurst/wiremock/store/files/FileSourceJsonObjectStoreTest.java create mode 100644 src/test/resources/not-found-diff-sample_mixed-matchers-self-describing-named-custom.txt create mode 100644 src/test/resources/not-found-diff-sample_mixed-matchers-weighted-named-custom.txt create mode 100644 src/test/resources/not-found-diff-sample_mixed-matchers-weighted-self-describing-named-custom.txt create mode 100644 src/test/resources/not-found-diff-sample_no_path_parameter_message.txt delete mode 100644 webapp/wiremock/.eslintrc.json create mode 100644 webapp/wiremock/eslint.config.js diff --git a/.run/Build WireMock.run.xml b/.run/Build WireMock.run.xml index 95941180cd..54a3f19cdf 100644 --- a/.run/Build WireMock.run.xml +++ b/.run/Build WireMock.run.xml @@ -19,7 +19,7 @@ true true false - false + false - + \ No newline at end of file diff --git a/.run/WebApp lint --fix.run.xml b/.run/WebApp lint --fix.run.xml index 9239f30f53..4634f94ace 100644 --- a/.run/WebApp lint --fix.run.xml +++ b/.run/WebApp lint --fix.run.xml @@ -5,9 +5,9 @@