From a47f377e5c455462d991af307e80d1288e705067 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 21 Oct 2024 15:03:19 +0200 Subject: [PATCH] chore(mockwebserver): migration guide entry Signed-off-by: Marc Nuri --- CHANGELOG.md | 1 + doc/MIGRATION-v7.md | 37 +++++++++++++++++++ .../MockWebServerWebSocketTest.groovy | 2 + 3 files changed, 40 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f610c2002..d68f557025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ #### New Features * Fix #6150: Config uses `proxy-url` in kubeconfig's cluster configuration +* Fix #5719: io.fabric8:mockwebserver is now based on Vert.x #### _**Note**_: Breaking changes * Check detailed migration documentation for breaking changes in [7.0.0](./doc/MIGRATION-v7.md) diff --git a/doc/MIGRATION-v7.md b/doc/MIGRATION-v7.md index 0cddd3abe4..429fbaa3f5 100644 --- a/doc/MIGRATION-v7.md +++ b/doc/MIGRATION-v7.md @@ -13,6 +13,9 @@ - [Renamed machineconfig to machineconfiguration](#openshift-machineconfig-to-machineconfiguration) - [Tekton Extension](#tekton-extension) - [Vertical Pod Autoscaler Extension](#vertical-pod-autoscaler-extension) +- [MockWebServer is based on Vert.x](#mockwebserver-vertx) + - [OkHttp class replacements](#mockwebserver-okhttp-replacements) + - [SSL/TLS certificates](#mockwebserver-ssl-tls-certificates) - [Deprecations and Removals](#deprecations-and-removals) - [Service Catalog API (extension) removed](#service-catalog-extension) @@ -132,6 +135,40 @@ The module `verticalpodautoscaler-model-v1` has been renamed to `verticalpodauto The package containing the Vertical Pod Autoscaler classes has also been renamed from `io.fabric8.verticalpodautoscaler.api.model` to `io.fabric8.autoscaling.api.model.v1`. +## MockWebServer is based on Vert.x + +MockWebServer is no longer based on OkHttp, but on Vert.x instead. + +### OkHttp class replacements + +As part of this change, the OkHttp dependency has been completely removed from all the MockWebServer related modules. + +The `okhttp3`, `okhttp3.mockwebserver` and `okio` package classes have been replaced by equivalent classes. +The following table contains the mapping of the classes: + +| OkHttp Class Name | New Class Name | +|-----------------------------------------|---------------------------------------------------| +| `okhttp3.Headers` | `io.fabric8.mockwebserver.http.Headers` | +| `okhttp3.HttpUrl` | `io.fabric8.mockwebserver.http.HttpUrl` | +| `okhttp3.MediaType` | `io.fabric8.mockwebserver.http.MediaType` | +| `okhttp3.Protocol` | `io.fabric8.mockwebserver.vertx.Protocol` | +| `okhttp3.Response` | `io.fabric8.mockwebserver.http.Response` | +| `okhttp3.WebSocket` | `io.fabric8.mockwebserver.http.WebSocket` | +| `okhttp3.WebSocketListener` | `io.fabric8.mockwebserver.http.WebSocketListener` | +| `okhttp3.mockwebserver.Dispatcher` | `io.fabric8.mockwebserver.http.Dispatcher` | +| `okhttp3.mockwebserver.MockResponse` | `io.fabric8.mockwebserver.http.MockResponse` | +| `okhttp3.mockwebserver.MockWebServer` | `io.fabric8.mockwebserver.MockWebServer` | +| `okhttp3.mockwebserver.QueueDispatcher` | `io.fabric8.mockwebserver.http.QueueDispatcher` | +| `okhttp3.mockwebserver.RecordedRequest` | `io.fabric8.mockwebserver.http.RecordedRequest` | +| `okio.Buffer` | `io.fabric8.mockwebserver.http.Buffer` | +| `okio.ByteString` | `io.fabric8.mockwebserver.http.ByteString` | + +### SSL/TLS certificates + +The MockWebServer will now use self-signed certificates that are generated each time the server is started. +In the prior version, the MockWebServer used a set of hardcoded certificates that were distributed with the `io.fabric8:mockwebserver` module artifact. +If you need the certificates (public and private), you can retrieve them by using the new `MockWebServer#getSelfSignedCertificate` method. + ## Deprecations and Removals ### Service Catalog API (extension) removed diff --git a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/MockWebServerWebSocketTest.groovy b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/MockWebServerWebSocketTest.groovy index d6f2cab926..a3238f63fe 100644 --- a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/MockWebServerWebSocketTest.groovy +++ b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/MockWebServerWebSocketTest.groovy @@ -220,6 +220,8 @@ class MockWebServerWebSocketTest extends Specification { when: "The connection completes" condition.eventually { assert wsReq.isComplete() + assert wsReq.result() != null + assert wsReq.result().closeReason() != null } then: "The received message should be the expected one"