From faedc39b0dc49deee5bb962068eecf61128cf74b Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 11 Nov 2024 15:45:42 +0100 Subject: [PATCH] refactor: removed deprecated `io.fabric8:openshift-server-mock` artifact Signed-off-by: Marc Nuri --- CHANGELOG.md | 1 + doc/MIGRATION-v7.md | 9 ++ junit/openshift-server-mock/pom.xml | 60 ---------- .../mock/EnableOpenShiftMockClient.java | 44 -------- .../server/mock/OpenShiftMockServer.java | 69 ------------ .../mock/OpenShiftMockServerExtension.java | 102 ----------------- .../client/server/mock/OpenShiftServer.java | 103 ------------------ ...erExtensionClientAndServerStaticTests.java | 35 ------ ...ckServerExtensionClientAndServerTests.java | 35 ------ ...enShiftMockServerExtensionStaticTests.java | 42 ------- .../OpenShiftMockServerExtensionTests.java | 42 ------- kubernetes-tests/pom.xml | 6 - pom.xml | 6 - uberjar/pom.xml | 8 -- 14 files changed, 10 insertions(+), 552 deletions(-) delete mode 100644 junit/openshift-server-mock/pom.xml delete mode 100644 junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/EnableOpenShiftMockClient.java delete mode 100644 junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServer.java delete mode 100644 junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtension.java delete mode 100644 junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftServer.java delete mode 100644 junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerStaticTests.java delete mode 100644 junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerTests.java delete mode 100644 junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java delete mode 100644 junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java diff --git a/CHANGELOG.md b/CHANGELOG.md index d97e2b5ee57..c1a25f0bb46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ * Fix #5264: `Config.errorMessages` has been removed. Please use Kubernetes status messages directly. * Fix #6081: Moved Java baseline from 8 (1.8) to 11 * Fix #6138: Removed unused `io:fabric8:kubernetes-model` artifact +* Fix #5351: Removed deprecated `io.fabric8:openshift-server-mock` artifact * Fix #6156: Removed deprecated extension `io:fabric8:service-catalog` * Fix #6158: Removed deprecated methods from `io.fabric8.kubernetes.client.utils.IOHelpers` * Fix #6361: Renamed SettableBeanPropertyDelegate to SettableBeanPropertyDelegating diff --git a/doc/MIGRATION-v7.md b/doc/MIGRATION-v7.md index 15bf82f23e2..975b98fdbed 100644 --- a/doc/MIGRATION-v7.md +++ b/doc/MIGRATION-v7.md @@ -22,6 +22,7 @@ - [SSL/TLS certificates](#mockwebserver-ssl-tls-certificates) - [Deprecations and Removals](#deprecations-and-removals) - [Apache Felix SCR Annotations removed](#apache-felix-scr-annotations) + - [OpenShift Server Mock removed](#openshift-server-mock-removed) - [Service Catalog API (extension) removed](#service-catalog-extension) @@ -226,6 +227,14 @@ If you need the certificates (public and private), you can retrieve them by usin Declarative Services. Fabric8 Kubernetes Client is now using official OSGi annotations instead. If you're using Apache Felix SCR annotations, you need to switch to [Official OSGi Component annotations](https://docs.osgi.org/javadoc/r6/cmpn/org/osgi/service/component/annotations/package-summary.html). +### OpenShift Server Mock removed + +The `io.fabric8:openshift-server-mock` module has been removed from the project after being deprecated for a long time. + +The usage of the `@EnableOpenShiftMockClient` annotation should be replaced with the `@EnableKubernetesMockClient` annotation. + +The use of the `OpenShiftMockServer` class should be replaced with the `KubernetesMockServer` class. + ### Service Catalog API (extension) removed The Service Catalog API extension has been removed. diff --git a/junit/openshift-server-mock/pom.xml b/junit/openshift-server-mock/pom.xml deleted file mode 100644 index 4f98748e8ba..00000000000 --- a/junit/openshift-server-mock/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - 4.0.0 - - io.fabric8 - kubernetes-client-project - 7.0-SNAPSHOT - ../../pom.xml - - - openshift-server-mock - Fabric8 :: Openshift :: Server Mock - - - - io.fabric8 - kubernetes-server-mock - - - - io.fabric8 - openshift-client - - - - org.assertj - assertj-core - test - - - - junit - junit - provided - - - - org.junit.jupiter - junit-jupiter-api - provided - - - diff --git a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/EnableOpenShiftMockClient.java b/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/EnableOpenShiftMockClient.java deleted file mode 100644 index 16f9de430a3..00000000000 --- a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/EnableOpenShiftMockClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; -import org.junit.jupiter.api.extension.ExtendWith; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.ANNOTATION_TYPE; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Annotation that is used for enabling OpenShiftMockServerExtension JUnit5 extension. - * You may set here two parameters of `OpenShiftServer`: crudMode and https - * - * @deprecated use {@link EnableKubernetesMockClient} instead - */ -@Deprecated -@Target({ TYPE, METHOD, ANNOTATION_TYPE }) -@Retention(RUNTIME) -@ExtendWith(OpenShiftMockServerExtension.class) -public @interface EnableOpenShiftMockClient { - - boolean https() default true; - - boolean crud() default false; -} diff --git a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServer.java b/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServer.java deleted file mode 100644 index 3f31342618a..00000000000 --- a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServer.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; -import io.fabric8.mockwebserver.Context; -import io.fabric8.mockwebserver.MockWebServer; -import io.fabric8.mockwebserver.ServerRequest; -import io.fabric8.mockwebserver.ServerResponse; -import io.fabric8.mockwebserver.http.Dispatcher; -import io.fabric8.openshift.client.NamespacedOpenShiftClient; -import io.fabric8.openshift.client.OpenShiftConfig; - -import java.util.Map; -import java.util.Queue; - -/** - * @deprecated use {@link KubernetesMockServer} instead - */ -@Deprecated -public class OpenShiftMockServer extends KubernetesMockServer { - private boolean disableApiGroupCheck = true; - - public OpenShiftMockServer() { - super(); - } - - public OpenShiftMockServer(boolean useHttps) { - super(useHttps); - } - - public OpenShiftMockServer(Context context, MockWebServer server, Map> responses, - Dispatcher dispatcher, boolean useHttps) { - super(context, server, responses, dispatcher, useHttps); - } - - @Override - public String[] getRootPaths() { - return new String[] { "/api", "/oapi" }; - } - - @SuppressWarnings("java:S2095") - public NamespacedOpenShiftClient createOpenShiftClient() { - final NamespacedOpenShiftClient client = createClient().adapt(NamespacedOpenShiftClient.class); - ((OpenShiftConfig) client.getConfiguration()).setDisableApiGroupCheck(disableApiGroupCheck); - return client; - } - - public boolean isDisableApiGroupCheck() { - return disableApiGroupCheck; - } - - public void setDisableApiGroupCheck(boolean disableApiGroupCheck) { - this.disableApiGroupCheck = disableApiGroupCheck; - } -} diff --git a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtension.java b/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtension.java deleted file mode 100644 index dd775f655a6..00000000000 --- a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtension.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.server.mock.KubernetesMixedDispatcher; -import io.fabric8.kubernetes.client.server.mock.KubernetesMockServerExtension; -import io.fabric8.mockwebserver.Context; -import io.fabric8.mockwebserver.MockWebServer; -import io.fabric8.mockwebserver.ServerRequest; -import io.fabric8.mockwebserver.ServerResponse; -import io.fabric8.openshift.client.NamespacedOpenShiftClient; -import io.fabric8.openshift.client.OpenShiftClient; -import org.junit.jupiter.api.extension.ExtensionContext; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.Queue; - -/** - * The class that implements JUnit5 extension mechanism. You can use it directly in your JUnit test - * by annotating it with @ExtendWith(OpenShiftMockServerExtension.class) or through - * @EnableOpenShiftMockClient annotation - */ -public class OpenShiftMockServerExtension extends KubernetesMockServerExtension { - - private OpenShiftMockServer staticOpenShiftMockServer; - private NamespacedOpenShiftClient staticOpenShiftClient; - private OpenShiftMockServer instantOpenShiftMockServer; - private NamespacedOpenShiftClient instantOpenShiftClient; - - @Override - protected void destroyStatic() { - staticOpenShiftMockServer.destroy(); - staticOpenShiftClient.close(); - } - - @Override - protected void destroy() { - if (instantOpenShiftMockServer != null) { - instantOpenShiftMockServer.destroy(); - } - if (instantOpenShiftClient != null) { - instantOpenShiftClient.close(); - } - } - - @Override - protected Class getKubernetesMockServerType() { - return OpenShiftMockServer.class; - } - - @Override - protected void initializeKubernetesClientAndMockServer(Class testClass, boolean isStatic) { - EnableOpenShiftMockClient a = testClass.getAnnotation(EnableOpenShiftMockClient.class); - final Map> responses = new HashMap<>(); - OpenShiftMockServer openShiftMockServer = a.crud() - ? new OpenShiftMockServer(new Context(), new MockWebServer(), responses, new KubernetesMixedDispatcher(responses), - a.https()) - : new OpenShiftMockServer(a.https()); - openShiftMockServer.init(); - NamespacedOpenShiftClient openShiftClient = openShiftMockServer.createOpenShiftClient(); - - if (isStatic) { - staticOpenShiftMockServer = openShiftMockServer; - staticOpenShiftClient = openShiftClient; - } else { - instantOpenShiftMockServer = openShiftMockServer; - instantOpenShiftClient = openShiftClient; - } - } - - @Override - protected void setFieldIfKubernetesClientOrMockServer(ExtensionContext context, boolean isStatic, Field field) - throws IllegalAccessException { - final NamespacedOpenShiftClient openShiftClient; - final OpenShiftMockServer openShiftMockServer; - if (isStatic) { - openShiftClient = staticOpenShiftClient; - openShiftMockServer = staticOpenShiftMockServer; - } else { - openShiftClient = instantOpenShiftClient; - openShiftMockServer = instantOpenShiftMockServer; - } - setFieldIfEqualsToProvidedType(context, isStatic, field, OpenShiftClient.class, (i, f) -> f.set(i, openShiftClient)); - setFieldIfEqualsToProvidedType(context, isStatic, field, getKubernetesMockServerType(), - (i, f) -> f.set(i, openShiftMockServer)); - } -} diff --git a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftServer.java b/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftServer.java deleted file mode 100644 index c2a1bdd1d35..00000000000 --- a/junit/openshift-server-mock/src/main/java/io/fabric8/openshift/client/server/mock/OpenShiftServer.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.KubernetesClient; -import io.fabric8.kubernetes.client.server.mock.KubernetesMixedDispatcher; -import io.fabric8.mockwebserver.Context; -import io.fabric8.mockwebserver.MockWebServer; -import io.fabric8.mockwebserver.ServerRequest; -import io.fabric8.mockwebserver.ServerResponse; -import io.fabric8.mockwebserver.dsl.MockServerExpectation; -import io.fabric8.mockwebserver.http.RecordedRequest; -import io.fabric8.openshift.client.NamespacedOpenShiftClient; -import org.junit.rules.ExternalResource; - -import java.util.HashMap; -import java.util.Map; -import java.util.Queue; - -public class OpenShiftServer extends ExternalResource { - - protected OpenShiftMockServer mock; - private NamespacedOpenShiftClient client; - - private final boolean https; - // In this mode the mock web server will store, read, update and delete - // kubernetes resources using an in memory map and will appear as a real api - // server. - private final boolean crudMode; - - public OpenShiftServer() { - this(true, false); - } - - public OpenShiftServer(boolean https) { - this(https, false); - } - - public OpenShiftServer(boolean https, boolean crudMode) { - this.https = https; - this.crudMode = crudMode; - } - - @Override - public void before() { - final Map> responses = new HashMap<>(); - mock = crudMode - ? new OpenShiftMockServer(new Context(), new MockWebServer(), responses, new KubernetesMixedDispatcher(responses), - https) - : new OpenShiftMockServer(https); - mock.init(); - client = mock.createOpenShiftClient(); - } - - @Override - public void after() { - mock.destroy(); - client.close(); - } - - public KubernetesClient getKubernetesClient() { - return client; - } - - public NamespacedOpenShiftClient getOpenshiftClient() { - return client; - } - - public MockServerExpectation expect() { - return mock.expect(); - } - - @Deprecated - public void expectAndReturnAsJson(String path, int code, T body) { - expect().withPath(path).andReturn(code, body).always(); - } - - @Deprecated - public void expectAndReturnAsString(String path, int code, String body) { - expect().withPath(path).andReturn(code, body).always(); - } - - public OpenShiftMockServer getOpenShiftMockServer() { - return mock; - } - - public RecordedRequest getLastRequest() throws InterruptedException { - return mock.getLastRequest(); - } -} diff --git a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerStaticTests.java b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerStaticTests.java deleted file mode 100644 index b7b6953887f..00000000000 --- a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerStaticTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; -import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; -import io.fabric8.openshift.client.OpenShiftClient; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@EnableKubernetesMockClient -class OpenShiftMockServerExtensionClientAndServerStaticTests { - private static KubernetesMockServer openShiftMockServer; - private static OpenShiftClient openShiftClient; - - @Test - void testMockServerAndClientAreInitialized() { - assertNotNull(openShiftMockServer); - assertNotNull(openShiftClient); - } -} diff --git a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerTests.java b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerTests.java deleted file mode 100644 index 71e24ab1556..00000000000 --- a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionClientAndServerTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; -import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; -import io.fabric8.openshift.client.OpenShiftClient; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@EnableKubernetesMockClient -class OpenShiftMockServerExtensionClientAndServerTests { - KubernetesMockServer openShiftMockServer; - OpenShiftClient openShiftClient; - - @Test - void testMockServerAndClientAreInitialized() { - assertNotNull(openShiftMockServer); - assertNotNull(openShiftClient); - } -} diff --git a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java deleted file mode 100644 index 974251cbecc..00000000000 --- a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionStaticTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; -import io.fabric8.openshift.client.OpenShiftClient; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -@EnableKubernetesMockClient(crud = true) -class OpenShiftMockServerExtensionStaticTests { - static OpenShiftClient openShiftClient; - - @Test - void testStaticOpenShiftClientGetsInitialized() { - assertThat(openShiftClient) - .isNotNull() - .extracting(Client::getConfiguration) - .hasFieldOrPropertyWithValue("oauthToken", "secret") - .hasFieldOrPropertyWithValue("username", "fabric8-mock-server-user") - .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mock-server-context") - .hasFieldOrPropertyWithValue("currentContext.context.namespace", "test") - .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mock-server-user") - .satisfies(c -> assertThat(c.getCurrentContext().getContext().getCluster()).startsWith("localhost:")) - .satisfies(c -> assertThat(c.getContexts()).hasSize(1)); - } -} diff --git a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java b/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java deleted file mode 100644 index fc2e9657f67..00000000000 --- a/junit/openshift-server-mock/src/test/java/io/fabric8/openshift/client/server/mock/OpenShiftMockServerExtensionTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.server.mock; - -import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; -import io.fabric8.openshift.client.OpenShiftClient; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -@EnableKubernetesMockClient(crud = true) -class OpenShiftMockServerExtensionTests { - OpenShiftClient client; - - @Test - void testOpenShiftClientGetsInitialized() { - assertThat(client) - .isNotNull() - .extracting(Client::getConfiguration) - .hasFieldOrPropertyWithValue("oauthToken", "secret") - .hasFieldOrPropertyWithValue("username", "fabric8-mock-server-user") - .hasFieldOrPropertyWithValue("currentContext.name", "fabric8-mock-server-context") - .hasFieldOrPropertyWithValue("currentContext.context.namespace", "test") - .hasFieldOrPropertyWithValue("currentContext.context.user", "fabric8-mock-server-user") - .satisfies(c -> assertThat(c.getCurrentContext().getContext().getCluster()).startsWith("localhost:")) - .satisfies(c -> assertThat(c.getContexts()).hasSize(1)); - } -} diff --git a/kubernetes-tests/pom.xml b/kubernetes-tests/pom.xml index fd77e1ec3c7..700160cf209 100644 --- a/kubernetes-tests/pom.xml +++ b/kubernetes-tests/pom.xml @@ -62,12 +62,6 @@ test - - io.fabric8 - openshift-server-mock - test - - io.fabric8 mockwebserver diff --git a/pom.xml b/pom.xml index 4275b39021a..811e5feb0ea 100644 --- a/pom.xml +++ b/pom.xml @@ -223,7 +223,6 @@ openshift-client-api openshift-client extensions - junit/openshift-server-mock platforms kubernetes-tests uberjar @@ -525,11 +524,6 @@ kubernetes-server-mock ${project.version} - - io.fabric8 - openshift-server-mock - ${project.version} - io.fabric8 knative-model diff --git a/uberjar/pom.xml b/uberjar/pom.xml index ae1a515a0b5..4d90b77d005 100644 --- a/uberjar/pom.xml +++ b/uberjar/pom.xml @@ -194,12 +194,6 @@ openshift-client - - io.fabric8 - openshift-server-mock - ${project.version} - - io.fabric8 zjsonpatch @@ -303,7 +297,6 @@ io.fabric8:kubernetes-client io.fabric8:kubernetes-server-mock io.fabric8:openshift-client - io.fabric8:openshift-server-mock @@ -364,7 +357,6 @@ io.fabric8:kubernetes-client io.fabric8:kubernetes-server-mock io.fabric8:openshift-client - io.fabric8:openshift-server-mock