TASTE_MANGO = Map.of("taste", "mango");
-
- @BeforeAll
- static void setup() {
- WireMockServer wireMockServer = new WireMockServer(options().dynamicPort());
-
- wireMockServer.start();
- WireMock.configureFor("localhost", wireMockServer.port());
-
- ApiClient client = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- client.setDebugging(true);
- Configuration.setDefaultApiClient(client);
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- new KubernetesClientConfigMapsCache().discardAll();
- }
-
- /**
- *
- * one configmap deployed with name "red"
- * we search by name, but for the "blue" one, as such not find it
- *
- */
- @Test
- void noMatch() {
- V1ConfigMap redConfigMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(redConfigMap);
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedConfigMapNormalizedSource(BLUE_CONFIG_MAP_NAME, NAMESPACE, true, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.blue.default");
- Assertions.assertEquals(sourceData.sourceData(), Map.of());
-
- }
-
- /**
- *
- * one configmap deployed with name "red"
- * we search by name, for the "red" one, as such we find it
- *
- */
- @Test
- void match() {
-
- V1ConfigMap configMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(configMap);
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedConfigMapNormalizedSource(RED_CONFIG_MAP_NAME, NAMESPACE, true, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.red.default");
- Assertions.assertEquals(sourceData.sourceData(), COLOR_REALLY_RED);
-
- }
-
- /**
- *
- * - two configmaps deployed : "red" and "red-with-profile".
- * - "red" is matched directly, "red-with-profile" is matched because we have an active profile
- * "active-profile"
- *
- */
- @Test
- void matchIncludeSingleProfile() {
-
- V1ConfigMap red = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1ConfigMap redWithProfile = new V1ConfigMapBuilder().withMetadata(
- new V1ObjectMetaBuilder().withName(RED_WITH_PROFILE_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(TASTE_MANGO).build();
-
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(red).addItemsItem(redWithProfile);
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedConfigMapNormalizedSource(RED_CONFIG_MAP_NAME, NAMESPACE, true, true);
- MockEnvironment environment = new MockEnvironment();
- environment.setActiveProfiles("with-profile");
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.red.red-with-profile.default");
- Assertions.assertEquals(sourceData.sourceData().size(), 2);
- Assertions.assertEquals(sourceData.sourceData().get("color"), "really-red");
- Assertions.assertEquals(sourceData.sourceData().get("taste"), "mango");
-
- }
-
- /**
- *
- * - two configmaps deployed : "red" and "red-with-profile".
- * - "red" is matched directly, "red-with-profile" is matched because we have an active profile
- * "active-profile"
- * - This takes into consideration the prefix, that we explicitly specify.
- * Notice that prefix works for profile based config maps as well.
- *
- */
- @Test
- void matchIncludeSingleProfileWithPrefix() {
-
- V1ConfigMap red = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1ConfigMap redWithTaste = new V1ConfigMapBuilder().withMetadata(
- new V1ObjectMetaBuilder().withName(RED_WITH_PROFILE_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(TASTE_MANGO).build();
-
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(red).addItemsItem(redWithTaste);
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- ConfigUtils.Prefix prefix = ConfigUtils.findPrefix("some", false, false, null);
- NormalizedSource source = new NamedConfigMapNormalizedSource(RED_CONFIG_MAP_NAME, NAMESPACE, true, prefix,
- true);
- MockEnvironment environment = new MockEnvironment();
- environment.setActiveProfiles("with-profile");
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.red.red-with-profile.default");
- Assertions.assertEquals(sourceData.sourceData().size(), 2);
- Assertions.assertEquals(sourceData.sourceData().get("some.color"), "really-red");
- Assertions.assertEquals(sourceData.sourceData().get("some.taste"), "mango");
-
- }
-
- /**
- *
- * - three configmaps deployed : "red", "red-with-taste" and "red-with-shape"
- * - "red" is matched directly, the other two are matched because of active profiles
- * - This takes into consideration the prefix, that we explicitly specify.
- * Notice that prefix works for profile based config maps as well.
- *
- */
- @Test
- void matchIncludeTwoProfilesWithPrefix() {
-
- V1ConfigMap red = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1ConfigMap redWithTaste = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME + "-with-taste")
- .withNamespace(NAMESPACE).withResourceVersion("1").build())
- .addToData(TASTE_MANGO).build();
-
- V1ConfigMap redWithShape = new V1ConfigMapBuilder().withMetadata(new V1ObjectMetaBuilder()
- .withName(RED_CONFIG_MAP_NAME + "-with-shape").withNamespace(NAMESPACE).build())
- .addToData("shape", "round").build();
-
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(red).addItemsItem(redWithTaste)
- .addItemsItem(redWithShape);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- ConfigUtils.Prefix prefix = ConfigUtils.findPrefix("some", false, false, null);
- NormalizedSource source = new NamedConfigMapNormalizedSource(RED_CONFIG_MAP_NAME, NAMESPACE, true, prefix,
- true);
- MockEnvironment environment = new MockEnvironment();
- environment.setActiveProfiles("with-taste", "with-shape");
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.red.red-with-shape.red-with-taste.default");
- Assertions.assertEquals(sourceData.sourceData().size(), 3);
- Assertions.assertEquals(sourceData.sourceData().get("some.color"), "really-red");
- Assertions.assertEquals(sourceData.sourceData().get("some.taste"), "mango");
- Assertions.assertEquals(sourceData.sourceData().get("some.shape"), "round");
-
- }
-
- /**
- *
- * proves that an implicit configmap is going to be generated and read, even if
- * we did not provide one
- *
- */
- @Test
- void matchWithName() {
-
- V1ConfigMap red = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("application").withNamespace(NAMESPACE).build())
- .addToData("color", "red").build();
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(red);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- ConfigUtils.Prefix prefix = ConfigUtils.findPrefix("some", false, false, null);
- NormalizedSource source = new NamedConfigMapNormalizedSource("application", NAMESPACE, true, prefix, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.application.default");
- Assertions.assertEquals(sourceData.sourceData(), Collections.singletonMap("some.color", "red"));
- }
-
- /**
- *
- * - NamedSecretContextToSourceDataProvider gets as input a KubernetesClientConfigContext.
- * - This context has a namespace as well as a NormalizedSource, that has a namespace too.
- * - This test makes sure that we use the proper one.
- *
- */
- @Test
- void namespaceMatch() {
-
- V1ConfigMap configMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData(COLOR_REALLY_RED).build();
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(configMap);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- String wrongNamespace = NAMESPACE + "nope";
- NormalizedSource source = new NamedConfigMapNormalizedSource(RED_CONFIG_MAP_NAME, wrongNamespace, true, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.red.default");
- Assertions.assertEquals(sourceData.sourceData(), COLOR_REALLY_RED);
- }
-
- /**
- *
- * - proves that single yaml file gets special treatment
- *
- */
- @Test
- void testSingleYaml() {
- V1ConfigMap singleYaml = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName(RED_CONFIG_MAP_NAME).withNamespace(NAMESPACE).build())
- .addToData("single.yaml", "key: value").build();
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(singleYaml);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedConfigMapNormalizedSource(RED_CONFIG_MAP_NAME, NAMESPACE, true, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.red.default");
- Assertions.assertEquals(sourceData.sourceData(), Map.of("key", "value"));
- }
-
- /**
- *
- * - one configmap is deployed with name "one"
- * - profile is enabled with name "k8s"
- *
- * we assert that the name of the source is "one" and does not contain "one-dev"
- *
- */
- @Test
- void testCorrectNameWithProfile() {
- V1ConfigMap one = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("one").withNamespace(NAMESPACE).build())
- .addToData("key", "value").build();
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(one);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- MockEnvironment environment = new MockEnvironment();
- environment.setActiveProfiles("k8s");
-
- NormalizedSource source = new NamedConfigMapNormalizedSource("one", NAMESPACE, true, true);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "configmap.one.default");
- Assertions.assertEquals(sourceData.sourceData(), Map.of("key", "value"));
- }
-
- /**
- *
- * - one configmap is deployed with name "red"
- * - one configmap is deployed with name "green"
- *
- * - we first search for "red" and find it, and it is retrieved from the cluster via the client.
- * - we then search for the "green" one, and it is retrieved from the cache this time.
- *
- */
- @Test
- void cache(CapturedOutput output) {
- V1ConfigMap red = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("red").withNamespace(NAMESPACE).build())
- .addToData("color", "red").build();
-
- V1ConfigMap green = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green").withNamespace(NAMESPACE).build())
- .addToData("color", "green").build();
-
- V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(red).addItemsItem(green);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- MockEnvironment environment = new MockEnvironment();
-
- NormalizedSource redSource = new NamedConfigMapNormalizedSource("red", NAMESPACE, true, false);
- KubernetesClientConfigContext redContext = new KubernetesClientConfigContext(api, redSource, NAMESPACE,
- environment);
- KubernetesClientContextToSourceData redData = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData redSourceData = redData.apply(redContext);
-
- Assertions.assertEquals(redSourceData.sourceName(), "configmap.red.default");
- Assertions.assertEquals(redSourceData.sourceData(), Map.of("color", "red"));
- Assertions.assertTrue(output.getAll().contains("Loaded all config maps in namespace '" + NAMESPACE + "'"));
-
- NormalizedSource greenSource = new NamedConfigMapNormalizedSource("green", NAMESPACE, true, true);
- KubernetesClientConfigContext greenContext = new KubernetesClientConfigContext(api, greenSource, NAMESPACE,
- environment);
- KubernetesClientContextToSourceData greenData = new NamedConfigMapContextToSourceDataProvider().get();
- SourceData greenSourceData = greenData.apply(greenContext);
-
- Assertions.assertEquals(greenSourceData.sourceName(), "configmap.green.default");
- Assertions.assertEquals(greenSourceData.sourceData(), Map.of("color", "green"));
-
- // meaning there is a single entry with such a log statement
- String[] out = output.getAll().split("Loaded all config maps in namespace");
- Assertions.assertEquals(out.length, 2);
-
- // meaning that the second read was done from the cache
- out = output.getAll().split("Loaded \\(from cache\\) all config maps in namespace");
- Assertions.assertEquals(out.length, 2);
-
- }
-
- private void stubCall(V1ConfigMapList list) {
- stubFor(get("/api/v1/namespaces/default/configmaps")
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(list))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/NamedSecretContextToSourceDataProviderTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/NamedSecretContextToSourceDataProviderTests.java
deleted file mode 100644
index 9cb158b684..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/NamedSecretContextToSourceDataProviderTests.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config;
-
-import java.util.Collections;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.Configuration;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.apis.CoreV1Api;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretBuilder;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.openapi.models.V1SecretListBuilder;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-import org.springframework.boot.test.system.CapturedOutput;
-import org.springframework.boot.test.system.OutputCaptureExtension;
-import org.springframework.cloud.kubernetes.commons.config.ConfigUtils;
-import org.springframework.cloud.kubernetes.commons.config.NamedSecretNormalizedSource;
-import org.springframework.cloud.kubernetes.commons.config.NormalizedSource;
-import org.springframework.cloud.kubernetes.commons.config.SourceData;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-@ExtendWith(OutputCaptureExtension.class)
-class NamedSecretContextToSourceDataProviderTests {
-
- private static final ConfigUtils.Prefix PREFIX = ConfigUtils.findPrefix("some", false, false, "irrelevant");
-
- private static final String NAMESPACE = "default";
-
- private static final Map COLOR_REALLY_RED = Map.of("color", "really-red".getBytes());
-
- @BeforeAll
- static void setup() {
- WireMockServer wireMockServer = new WireMockServer(options().dynamicPort());
-
- wireMockServer.start();
- WireMock.configureFor("localhost", wireMockServer.port());
-
- ApiClient client = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- client.setDebugging(true);
- Configuration.setDefaultApiClient(client);
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- new KubernetesClientSecretsCache().discardAll();
- }
-
- /**
- * we have a single secret deployed. it matched the name in our queries
- */
- @Test
- void singleSecretMatchAgainstLabels() {
-
- V1Secret red = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
- V1SecretList secretList = new V1SecretList().addItemsItem(red);
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- // blue does not match red
- NormalizedSource source = new NamedSecretNormalizedSource("red", NAMESPACE, false, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.red.default");
- Assertions.assertEquals(sourceData.sourceData(), Map.of("color", "really-red"));
-
- }
-
- /**
- * we have three secrets deployed. one of them has a name that matches (red), the
- * other two have different names, thus no match.
- */
- @Test
- void twoSecretMatchAgainstLabels() {
-
- V1Secret red = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1Secret blue = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("blue").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1Secret pink = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("pink").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1SecretList secretList = new V1SecretListBuilder().addToItems(red).addToItems(blue).addToItems(pink).build();
-
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- // blue does not match red, nor pink
- NormalizedSource source = new NamedSecretNormalizedSource("red", NAMESPACE, false, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.red.default");
- Assertions.assertEquals(sourceData.sourceData().size(), 1);
- Assertions.assertEquals(sourceData.sourceData().get("color"), "really-red");
-
- }
-
- /**
- * one secret deployed (pink), does not match our query (blue).
- */
- @Test
- void testSecretNoMatch() {
-
- V1Secret secret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1SecretList secretList = new V1SecretList().addItemsItem(secret);
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- // blue does not match red
- NormalizedSource source = new NamedSecretNormalizedSource("blue", NAMESPACE, false, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.blue.default");
- Assertions.assertEquals(sourceData.sourceData(), Collections.emptyMap());
- }
-
- /**
- *
- * - LabeledSecretContextToSourceDataProvider gets as input a KubernetesClientConfigContext.
- * - This context has a namespace as well as a NormalizedSource, that has a namespace too.
- * - This test makes sure that we use the proper one.
- *
- */
- @Test
- void namespaceMatch() {
-
- V1Secret secret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1SecretList secretList = new V1SecretList().addItemsItem(secret);
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- String wrongNamespace = NAMESPACE + "nope";
- NormalizedSource source = new NamedSecretNormalizedSource("red", wrongNamespace, false, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.red.default");
- Assertions.assertEquals(sourceData.sourceData(), Map.of("color", "really-red"));
- }
-
- /**
- * we have two secrets deployed. one matches the query name. the other matches the
- * active profile + name, thus is taken also.
- */
- @Test
- void matchIncludeSingleProfile() {
-
- V1Secret red = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1Secret mango = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red-with-profile").build())
- .addToData("taste", "mango".getBytes()).build();
-
- V1SecretList secretList = new V1SecretList().addItemsItem(red).addItemsItem(mango);
-
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedSecretNormalizedSource("red", NAMESPACE, false, true);
- MockEnvironment environment = new MockEnvironment();
- environment.addActiveProfile("with-profile");
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.red.red-with-profile.default");
- Assertions.assertEquals(sourceData.sourceData().size(), 2);
- Assertions.assertEquals(sourceData.sourceData().get("color"), "really-red");
- Assertions.assertEquals(sourceData.sourceData().get("taste"), "mango");
-
- }
-
- /**
- * we have two secrets deployed. one matches the query name. the other matches the
- * active profile + name, thus is taken also. This takes into consideration the
- * prefix, that we explicitly specify. Notice that prefix works for profile based
- * secrets as well.
- */
- @Test
- void matchIncludeSingleProfileWithPrefix() {
-
- V1Secret red = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1Secret mango = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red-with-taste").build())
- .addToData("taste", "mango".getBytes()).build();
-
- V1SecretList secretList = new V1SecretList().addItemsItem(red).addItemsItem(mango);
-
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedSecretNormalizedSource("red", NAMESPACE, true, PREFIX, true);
- MockEnvironment environment = new MockEnvironment();
- environment.addActiveProfile("with-taste");
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.red.red-with-taste.default");
- Assertions.assertEquals(sourceData.sourceData().size(), 2);
- Assertions.assertEquals(sourceData.sourceData().get("some.color"), "really-red");
- Assertions.assertEquals(sourceData.sourceData().get("some.taste"), "mango");
-
- }
-
- /**
- * we have three secrets deployed. one matches the query name. the other two match the
- * active profile + name, thus are taken also. This takes into consideration the
- * prefix, that we explicitly specify. Notice that prefix works for profile based
- * config maps as well.
- */
- @Test
- void matchIncludeTwoProfilesWithPrefix() {
-
- V1Secret red = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red").build())
- .addToData(COLOR_REALLY_RED).build();
-
- V1Secret mango = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red-with-taste").build())
- .addToData("taste", "mango".getBytes()).build();
-
- V1Secret shape = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withNamespace(NAMESPACE).withName("red-with-shape").build())
- .addToData("shape", "round".getBytes()).build();
-
- V1SecretList secretList = new V1SecretList().addItemsItem(red).addItemsItem(mango).addItemsItem(shape);
-
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedSecretNormalizedSource("red", NAMESPACE, true, PREFIX, true);
- MockEnvironment environment = new MockEnvironment();
- environment.setActiveProfiles("with-taste", "with-shape");
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment);
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.red.red-with-shape.red-with-taste.default");
-
- Assertions.assertEquals(sourceData.sourceData().size(), 3);
- Assertions.assertEquals(sourceData.sourceData().get("some.color"), "really-red");
- Assertions.assertEquals(sourceData.sourceData().get("some.taste"), "mango");
- Assertions.assertEquals(sourceData.sourceData().get("some.shape"), "round");
-
- }
-
- /**
- *
- * - proves that single yaml file gets special treatment
- *
- */
- @Test
- void testSingleYaml() {
- V1Secret singleYaml = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("single-yaml").withNamespace(NAMESPACE).build())
- .addToData("single.yaml", "key: value".getBytes()).build();
- V1SecretList secretList = new V1SecretList().addItemsItem(singleYaml);
-
- stubCall(secretList);
- CoreV1Api api = new CoreV1Api();
-
- NormalizedSource source = new NamedSecretNormalizedSource("single-yaml", NAMESPACE, true, false);
- KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE,
- new MockEnvironment());
-
- KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
- SourceData sourceData = data.apply(context);
-
- Assertions.assertEquals(sourceData.sourceName(), "secret.single-yaml.default");
- Assertions.assertEquals(sourceData.sourceData(), Map.of("key", "value"));
- }
-
- /**
- *
- * - one secret is deployed with name "red"
- * - one secret is deployed with name "green"
- *
- * - we first search for "red" and find it, and it is retrieved from the cluster via the client.
- * - we then search for the "green" one, and it is retrieved from the cache this time.
- *
- */
- @Test
- void cache(CapturedOutput output) {
- V1Secret red = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("red").withNamespace(NAMESPACE).build())
- .addToData("color", "red".getBytes()).build();
-
- V1Secret green = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green").withNamespace(NAMESPACE).build())
- .addToData("color", "green".getBytes()).build();
-
- V1SecretList configMapList = new V1SecretList().addItemsItem(red).addItemsItem(green);
-
- stubCall(configMapList);
- CoreV1Api api = new CoreV1Api();
-
- MockEnvironment environment = new MockEnvironment();
-
- NormalizedSource redSource = new NamedSecretNormalizedSource("red", NAMESPACE, true, false);
- KubernetesClientConfigContext redContext = new KubernetesClientConfigContext(api, redSource, NAMESPACE,
- environment);
- KubernetesClientContextToSourceData redData = new NamedSecretContextToSourceDataProvider().get();
- SourceData redSourceData = redData.apply(redContext);
-
- Assertions.assertEquals(redSourceData.sourceName(), "secret.red.default");
- Assertions.assertEquals(redSourceData.sourceData(), Map.of("color", "red"));
- Assertions.assertTrue(output.getAll().contains("Loaded all secrets in namespace '" + NAMESPACE + "'"));
-
- NormalizedSource greenSource = new NamedSecretNormalizedSource("green", NAMESPACE, true, true);
- KubernetesClientConfigContext greenContext = new KubernetesClientConfigContext(api, greenSource, NAMESPACE,
- environment);
- KubernetesClientContextToSourceData greenData = new NamedSecretContextToSourceDataProvider().get();
- SourceData greenSourceData = greenData.apply(greenContext);
-
- Assertions.assertEquals(greenSourceData.sourceName(), "secret.green.default");
- Assertions.assertEquals(greenSourceData.sourceData(), Map.of("color", "green"));
-
- // meaning there is a single entry with such a log statement
- String[] out = output.getAll().split("Loaded all secrets in namespace");
- Assertions.assertEquals(out.length, 2);
-
- // meaning that the second read was done from the cache
- out = output.getAll().split("Loaded \\(from cache\\) all secrets in namespace");
- Assertions.assertEquals(out.length, 2);
-
- }
-
- private void stubCall(V1SecretList list) {
- stubFor(get("/api/v1/namespaces/default/secrets")
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(list))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixApp.java
deleted file mode 100644
index d80949f597..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixApp.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.Four;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.Two;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ One.class, Two.class, Three.class, Four.class })
-public class LabeledConfigMapWithPrefixApp {
-
- public static void main(String[] args) {
- SpringApplication.run(LabeledConfigMapWithPrefixApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixBootstrapTests.java
deleted file mode 100644
index c6778d647b..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixBootstrapTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = LabeledConfigMapWithPrefixApp.class,
- properties = { "spring.cloud.bootstrap.name=labeled-configmap-with-prefix",
- "labeled.config.map.with.prefix.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" })
-class LabeledConfigMapWithPrefixBootstrapTests extends LabeledConfigMapWithPrefixTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixConfigDataTests.java
deleted file mode 100644
index c4e0fe404b..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixConfigDataTests.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledConfigMapWithPrefixConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = LabeledConfigMapWithPrefixApp.class,
- properties = { "spring.cloud.application.name=labeled-configmap-with-prefix",
- "labeled.config.map.with.prefix.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./labeled-configmap-with-prefix.yaml" })
-class LabeledConfigMapWithPrefixConfigDataTests extends LabeledConfigMapWithPrefixTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixTests.java
deleted file mode 100644
index 647e3cb6c3..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/LabeledConfigMapWithPrefixTests.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * Stud data is in
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledConfigMapWithPrefixConfigurationStub}
- *
- * @author wind57
- */
-abstract class LabeledConfigMapWithPrefixTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.configmap.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.configmap.sources[0].useNameAsPrefix=false'
- * ("one.property", "one")
- *
- * As such: @ConfigurationProperties("one")
- *
- */
- @Test
- void testOne() {
- this.webClient.get().uri("/labeled-configmap/prefix/one").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("one"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[1].explicitPrefix=two'
- * ("property", "two")
- *
- * As such: @ConfigurationProperties("two")
- *
- */
- @Test
- void testTwo() {
- this.webClient.get().uri("/labeled-configmap/prefix/two").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("two"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[2].labels=letter:c'
- * ("property", "three")
- *
- * We find the configmap by labels, and use it's name as the prefix.
- *
- * As such: @ConfigurationProperties(prefix = "configmap-three")
- *
- */
- @Test
- void testThree() {
- this.webClient.get().uri("/labeled-configmap/prefix/three").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("three"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[3].labels=letter:d'
- * ("property", "four")
- *
- * We find the configmap by labels, and use it's name as the prefix.
- *
- * As such: @ConfigurationProperties(prefix = "configmap-four")
- *
- */
- @Test
- void testFour() {
- this.webClient.get().uri("/labeled-configmap/prefix/four").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("four"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/controller/LabeledConfigMapWithPrefixController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/controller/LabeledConfigMapWithPrefixController.java
deleted file mode 100644
index 5e16b04b38..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/controller/LabeledConfigMapWithPrefixController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.Four;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties.Two;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class LabeledConfigMapWithPrefixController {
-
- private final One one;
-
- private final Two two;
-
- private final Three three;
-
- private final Four four;
-
- public LabeledConfigMapWithPrefixController(One one, Two two, Three three, Four four) {
- this.one = one;
- this.two = two;
- this.three = three;
- this.four = four;
- }
-
- @GetMapping("/labeled-configmap/prefix/one")
- public String one() {
- return one.getProperty();
- }
-
- @GetMapping("/labeled-configmap/prefix/two")
- public String two() {
- return two.getProperty();
- }
-
- @GetMapping("/labeled-configmap/prefix/three")
- public String three() {
- return three.getProperty();
- }
-
- @GetMapping("/labeled-configmap/prefix/four")
- public String four() {
- return four.getProperty();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Four.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Four.java
deleted file mode 100644
index 9e87586053..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Four.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "configmap-four")
-public class Four {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/One.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/One.java
deleted file mode 100644
index 23bbec8696..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/One.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("one")
-public class One {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Three.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Three.java
deleted file mode 100644
index 03ab598e73..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Three.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "configmap-three")
-public class Three {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Two.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Two.java
deleted file mode 100644
index 3f0c26823e..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_prefix/properties/Two.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("two")
-public class Two {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileApp.java
deleted file mode 100644
index 6135608b5d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileApp.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.Blue;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.Green;
-
-/**
- * @author wind57
- */
-@SpringBootApplication
-@EnableConfigurationProperties({ Blue.class, Green.class })
-public class LabeledConfigMapWithProfileApp {
-
- public static void main(String[] args) {
- SpringApplication.run(LabeledConfigMapWithProfileApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileBootstrapTests.java
deleted file mode 100644
index 770f618d15..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileBootstrapTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-
-/**
- * @author wind57
- */
-@ActiveProfiles({ "k8s", "prod" })
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = LabeledConfigMapWithProfileApp.class,
- properties = { "spring.cloud.bootstrap.name=labeled-configmap-with-profile",
- "labeled.config.map.with.profile.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true", "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class LabeledConfigMapWithProfileBootstrapTests extends LabeledConfigMapWithProfileTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileConfigDataTests.java
deleted file mode 100644
index 4e3991b126..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileConfigDataTests.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.test.context.ActiveProfiles;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledConfigMapWithProfileConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@ActiveProfiles({ "k8s", "prod" })
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = LabeledConfigMapWithProfileApp.class,
- properties = { "spring.cloud.application.name=labeled-configmap-with-profile",
- "labeled.config.map.with.profile.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./labeled-configmap-with-profile.yaml" })
-class LabeledConfigMapWithProfileConfigDataTests extends LabeledConfigMapWithProfileTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileTests.java
deleted file mode 100644
index 4a206dab65..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/LabeledConfigMapWithProfileTests.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * Stud data is in
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledConfigMapWithProfileConfigurationStub}
- *
- * @author wind57
- */
-abstract class LabeledConfigMapWithProfileTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * this one is taken from : "blue.one". We find "color-configmap" by labels, and
- * "color-configmap-k8s" exists, but "includeProfileSpecificSources=false", thus not taken.
- * Since "explicitPrefix=blue", we take "blue.one"
- *
- */
- @Test
- void testBlue() {
- this.webClient.get().uri("/labeled-configmap/profile/blue").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("1"));
- }
-
- /**
- *
- * this one is taken from : ""green-configmap.green-configmap-k8s.green-configmap-prod.green-purple-configmap.green-purple-configmap-k8s"".
- * We find "green-configmap" by labels, also "green-configmap-k8s", "green-configmap-prod" exists,
- * because "includeProfileSpecificSources=true" is set. Also "green-purple-configmap" and "green-purple-configmap-k8s"
- * are found.
- *
- */
- @Test
- void testGreen() {
- this.webClient.get().uri("/labeled-configmap/profile/green").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("2#6#7#eight-ish"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/controller/LabeledConfigMapWithProfileController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/controller/LabeledConfigMapWithProfileController.java
deleted file mode 100644
index e81f6678b4..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/controller/LabeledConfigMapWithProfileController.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.Blue;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties.Green;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class LabeledConfigMapWithProfileController {
-
- private final Blue blue;
-
- private final Green green;
-
- public LabeledConfigMapWithProfileController(Blue blue, Green green) {
- this.blue = blue;
- this.green = green;
- }
-
- @GetMapping("/labeled-configmap/profile/blue")
- public String blue() {
- return blue.getOne();
- }
-
- @GetMapping("/labeled-configmap/profile/green")
- public String green() {
- return green.getTwo() + "#" + green.getSix() + "#" + green.getSeven() + "#" + green.getEight();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/properties/Blue.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/properties/Blue.java
deleted file mode 100644
index e1cad9515e..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/properties/Blue.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("blue")
-public class Blue {
-
- private String one;
-
- public String getOne() {
- return one;
- }
-
- public void setOne(String one) {
- this.one = one;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/properties/Green.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/properties/Green.java
deleted file mode 100644
index 7e8807f411..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_config_map_with_profile/properties/Green.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_config_map_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("green-configmap.green-configmap-k8s.green-configmap-prod.green-purple-configmap.green-purple-configmap-k8s")
-public class Green {
-
- private String two;
-
- private String six;
-
- private String seven;
-
- private String eight;
-
- public String getTwo() {
- return two;
- }
-
- public void setTwo(String two) {
- this.two = two;
- }
-
- public String getSix() {
- return six;
- }
-
- public void setSix(String six) {
- this.six = six;
- }
-
- public String getSeven() {
- return seven;
- }
-
- public void setSeven(String seven) {
- this.seven = seven;
- }
-
- public String getEight() {
- return eight;
- }
-
- public void setEight(String eight) {
- this.eight = eight;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixApp.java
deleted file mode 100644
index 28484bcc14..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixApp.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.Four;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.Two;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ One.class, Two.class, Three.class, Four.class })
-public class LabeledSecretWithPrefixApp {
-
- public static void main(String[] args) {
- SpringApplication.run(LabeledSecretWithPrefixApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixBootstrapTests.java
deleted file mode 100644
index 0987907d92..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixBootstrapTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithPrefixApp.class,
- properties = { "spring.cloud.bootstrap.name=labeled-secret-with-prefix", "labeled.secret.with.prefix.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true",
- "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class LabeledSecretWithPrefixBootstrapTests extends LabeledSecretWithPrefixTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixConfigDataTests.java
deleted file mode 100644
index 42cbe38aa6..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixConfigDataTests.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledSecretWithPrefixConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithPrefixApp.class,
- properties = { "spring.cloud.application.name=labeled-secret-with-prefix",
- "labeled.secret.with.prefix.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./labeled-secret-with-prefix.yaml" })
-class LabeledSecretWithPrefixConfigDataTests extends LabeledSecretWithPrefixTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixTests.java
deleted file mode 100644
index 6300f24f2d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/LabeledSecretWithPrefixTests.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledSecretWithPrefixConfigurationStub;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * The stub data for this test is in : {@link LabeledSecretWithPrefixConfigurationStub}
- *
- * @author wind57
- */
-abstract class LabeledSecretWithPrefixTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[0].useNameAsPrefix=false'
- * ("one.property", "one")
- *
- * As such: @ConfigurationProperties("one")
- *
- */
- @Test
- void testOne() {
- this.webClient.get().uri("/labeled-secret/prefix/one").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("one"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[1].explicitPrefix=two'
- * ("property", "two")
- *
- * As such: @ConfigurationProperties("two")
- *
- */
- @Test
- void testTwo() {
- this.webClient.get().uri("/labeled-secret/prefix/two").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("two"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[2].labels=letter:c'
- * ("property", "three")
- *
- * We find the secret by labels, and use it's name as the prefix.
- *
- * As such: @ConfigurationProperties(prefix = "secret-three")
- *
- */
- @Test
- void testThree() {
- this.webClient.get().uri("/labeled-secret/prefix/three").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("three"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[3].labels=letter:d'
- * ("property", "four")
- *
- * We find the secret by labels, and use it's name as the prefix.
- *
- * As such: @ConfigurationProperties(prefix = "secret-four")
- *
- */
- @Test
- void testFour() {
- this.webClient.get().uri("/labeled-secret/prefix/four").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("four"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/controller/LabeledSecretWithPrefixController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/controller/LabeledSecretWithPrefixController.java
deleted file mode 100644
index b6c6066bfb..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/controller/LabeledSecretWithPrefixController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.Four;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties.Two;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class LabeledSecretWithPrefixController {
-
- private final One one;
-
- private final Two two;
-
- private final Three three;
-
- private final Four four;
-
- public LabeledSecretWithPrefixController(One one, Two two, Three three, Four four) {
- this.one = one;
- this.two = two;
- this.three = three;
- this.four = four;
- }
-
- @GetMapping("/labeled-secret/prefix/one")
- public String one() {
- return one.getProperty();
- }
-
- @GetMapping("/labeled-secret/prefix/two")
- public String two() {
- return two.getProperty();
- }
-
- @GetMapping("/labeled-secret/prefix/three")
- public String three() {
- return three.getProperty();
- }
-
- @GetMapping("/labeled-secret/prefix/four")
- public String four() {
- return four.getProperty();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Four.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Four.java
deleted file mode 100644
index aefd225d21..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Four.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "secret-four")
-public class Four {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/One.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/One.java
deleted file mode 100644
index 6ad8b4346d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/One.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("one")
-public class One {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Three.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Three.java
deleted file mode 100644
index ca661c7c77..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Three.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "secret-three")
-public class Three {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Two.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Two.java
deleted file mode 100644
index 265b17e5be..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_prefix/properties/Two.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("two")
-public class Two {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileApp.java
deleted file mode 100644
index eae8cd695a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileApp.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.properties.Blue;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.properties.Green;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ Blue.class, Green.class })
-public class LabeledSecretWithProfileApp {
-
- public static void main(String[] args) {
- SpringApplication.run(LabeledSecretWithProfileApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileBootstrapTests.java
deleted file mode 100644
index 76ac55925a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileBootstrapTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-
-/**
- * @author wind57
- */
-@ActiveProfiles({ "k8s", "prod" })
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithProfileApp.class,
- properties = { "spring.cloud.bootstrap.name=labeled-secret-with-profile",
- "labeled.secret.with.profile.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true", "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class LabeledSecretWithProfileBootstrapTests extends LabeledSecretWithProfileTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileConfigDataTests.java
deleted file mode 100644
index 14cff5d216..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileConfigDataTests.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.test.context.ActiveProfiles;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledSecretWithProfileConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@ActiveProfiles({ "k8s", "prod" })
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = LabeledSecretWithProfileApp.class,
- properties = { "spring.application.name=labeled-secret-with-profile", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./labeled-secret-with-profile.yaml",
- "spring.cloud.kubernetes.config.enabled=false" })
-class LabeledSecretWithProfileConfigDataTests extends LabeledSecretWithProfileTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileTests.java
deleted file mode 100644
index fbcb546a78..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/LabeledSecretWithProfileTests.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/*
- *
- * - secret with name "color-secret", with labels: "{color: blue}" and "explicitPrefix: blue"
- * - secret with name "green-secret", with labels: "{color: green}" and "explicitPrefix: blue-again"
- * - secret with name "red-secret", with labels "{color: not-red}" and "useNameAsPrefix: true"
- * - secret with name "yellow-secret" with labels "{color: not-yellow}" and useNameAsPrefix: true
- * - secret with name "color-secret-k8s", with labels : "{color: not-blue}"
- * - secret with name "green-secret-k8s", with labels : "{color: green-k8s}"
- * - secret with name "green-secret-prod", with labels : "{color: green-prod}"
- *
- */
-
-/**
- * Stubs for this test are in
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledSecretWithProfileConfigurationStub}
- *
- * @author wind57
- */
-abstract class LabeledSecretWithProfileTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- public void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * this one is taken from : "blue.one". We find "color-secret" by labels, and
- * "color-secrets-k8s" exists, but "includeProfileSpecificSources=false", thus not taken.
- * Since "explicitPrefix=blue", we take "blue.one"
- *
- */
- @Test
- void testBlue() {
- this.webClient.get().uri("/labeled-secret/profile/blue").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("1"));
- }
-
- /**
- *
- * this one is taken from : "green-purple-secret.green-purple-secret-k8s.green-secret.green-secret-k8s.green-secret-prod".
- * We find "green-secret" by labels, also "green-secrets-k8s" and "green-secrets-prod" exists,
- * because "includeProfileSpecificSources=true" is set. Also "green-purple-secret" and "green-purple-secret-k8s"
- * are found.
- *
- */
- @Test
- void testGreen() {
- this.webClient.get().uri("/labeled-secret/profile/green").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("2#6#7#eight-ish"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/controller/LabeledSecretWithProfileController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/controller/LabeledSecretWithProfileController.java
deleted file mode 100644
index 97f6a06ebc..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/controller/LabeledSecretWithProfileController.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.properties.Blue;
-import org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.properties.Green;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class LabeledSecretWithProfileController {
-
- private final Blue blue;
-
- private final Green green;
-
- public LabeledSecretWithProfileController(Blue blue, Green green) {
- this.blue = blue;
- this.green = green;
- }
-
- @GetMapping("/labeled-secret/profile/blue")
- public String blue() {
- return blue.getOne();
- }
-
- @GetMapping("/labeled-secret/profile/green")
- public String green() {
- return green.getTwo() + "#" + green.getSix() + "#" + green.getSeven() + "#" + green.getEight();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/properties/Blue.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/properties/Blue.java
deleted file mode 100644
index 7231da17ac..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/properties/Blue.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("blue")
-public class Blue {
-
- private String one;
-
- public String getOne() {
- return one;
- }
-
- public void setOne(String one) {
- this.one = one;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/properties/Green.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/properties/Green.java
deleted file mode 100644
index 851f229ed4..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/labeled_secret_with_profile/properties/Green.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.labeled_secret_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("green-purple-secret.green-purple-secret-k8s.green-secret.green-secret-k8s.green-secret-prod")
-public class Green {
-
- private String two;
-
- private String six;
-
- private String seven;
-
- private String eight;
-
- public String getTwo() {
- return two;
- }
-
- public void setTwo(String two) {
- this.two = two;
- }
-
- public String getSix() {
- return six;
- }
-
- public void setSix(String six) {
- this.six = six;
- }
-
- public String getSeven() {
- return seven;
- }
-
- public void setSeven(String seven) {
- this.seven = seven;
- }
-
- public String getEight() {
- return eight;
- }
-
- public void setEight(String eight) {
- this.eight = eight;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixApp.java
deleted file mode 100644
index d6457a5bc8..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixApp.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties.Two;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ One.class, Two.class, Three.class })
-public class NamedConfigMapWithPrefixApp {
-
- public static void main(String[] args) {
- SpringApplication.run(NamedConfigMapWithPrefixApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixBootstrapTests.java
deleted file mode 100644
index a7600c8e39..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixBootstrapTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Ryan Baxter
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = NamedConfigMapWithPrefixApp.class,
- properties = { "spring.cloud.bootstrap.name=named-configmap-with-prefix",
- "named.config.map.with.prefix.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true", "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class NamedConfigMapWithPrefixBootstrapTests extends NamedConfigMapWithPrefixTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixConfigDataTests.java
deleted file mode 100644
index 4bd5cdbd85..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixConfigDataTests.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithPrefixConfigurationStub.stubData;
-
-/**
- * @author Ryan Baxter
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = NamedConfigMapWithPrefixApp.class,
- properties = { "spring.cloud.application.name=named-configmap-with-prefix",
- "named.config.map.with.prefix.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./named-configmap-with-prefix.yaml" })
-class NamedConfigMapWithPrefixConfigDataTests extends NamedConfigMapWithPrefixTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixTests.java
deleted file mode 100644
index 881b628416..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/NamedConfigMapWithPrefixTests.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithPrefixConfigurationStub}
- *
- * @author wind57
- */
-abstract class NamedConfigMapWithPrefixTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- public void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[0].useNameAsPrefix=false'
- * ("one.property", "one")
- *
- * As such: @ConfigurationProperties("one")
- *
- */
- @Test
- void testOne() {
- this.webClient.get().uri("/named-configmap/prefix/one").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("one"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[1].explicitPrefix=two'
- * ("property", "two")
- *
- * As such: @ConfigurationProperties("two")
- *
- */
- @Test
- void testTwo() {
- this.webClient.get().uri("/named-configmap/prefix/two").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("two"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[2].name=config-map-three'
- * ("property", "three")
- *
- * As such: @ConfigurationProperties(prefix = "config-map-three")
- *
- */
- @Test
- void testThree() {
- this.webClient.get().uri("/named-configmap/prefix/three").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("three"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/controller/NamedConfigWithPrefixController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/controller/NamedConfigWithPrefixController.java
deleted file mode 100644
index 6702619367..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/controller/NamedConfigWithPrefixController.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties.Two;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class NamedConfigWithPrefixController {
-
- private final One one;
-
- private final Two two;
-
- private final Three three;
-
- public NamedConfigWithPrefixController(One one, Two two, Three three) {
- this.one = one;
- this.two = two;
- this.three = three;
- }
-
- @GetMapping("/named-configmap/prefix/one")
- public String one() {
- return one.getProperty();
- }
-
- @GetMapping("/named-configmap/prefix/two")
- public String two() {
- return two.getProperty();
- }
-
- @GetMapping("/named-configmap/prefix/three")
- public String three() {
- return three.getProperty();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/One.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/One.java
deleted file mode 100644
index 82c2a7f42c..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/One.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("one")
-public class One {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/Three.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/Three.java
deleted file mode 100644
index 30c592243c..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/Three.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "config-map-three")
-public class Three {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/Two.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/Two.java
deleted file mode 100644
index 0f45b685c2..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_prefix/properties/Two.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("two")
-public class Two {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileApp.java
deleted file mode 100644
index 81db4b8077..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileApp.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties.Two;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithProfileConfigurationStub}
- *
- * @author wind57
- */
-@SpringBootApplication
-@EnableConfigurationProperties({ One.class, Two.class, Three.class })
-class NamedConfigMapWithProfileApp {
-
- public static void main(String[] args) {
- SpringApplication.run(NamedConfigMapWithProfileApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileBootstrapTests.java
deleted file mode 100644
index 9e569f5c70..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileBootstrapTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = NamedConfigMapWithProfileApp.class,
- properties = { "spring.cloud.bootstrap.name=named-configmap-with-profile",
- "named.config.map.with.profile.stub=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true", "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-@ActiveProfiles("k8s")
-class NamedConfigMapWithProfileBootstrapTests extends NamedConfigMapWithProfileTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileConfigDataTests.java
deleted file mode 100644
index d3c660d3d0..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileConfigDataTests.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.test.context.ActiveProfiles;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithProfileConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = NamedConfigMapWithProfileApp.class,
- properties = { "spring.application.name=named-config-map-with-profile", "include.profile.specific.sources=true",
- "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./named-configmap-with-profile.yaml" })
-@ActiveProfiles("k8s")
-class NamedConfigMapWithProfileConfigDataTests extends NamedConfigMapWithProfileTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- public static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileTests.java
deleted file mode 100644
index a997b4e037..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/NamedConfigMapWithProfileTests.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithProfileConfigurationStub}
- *
- * @author wind57
- */
-abstract class NamedConfigMapWithProfileTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- public void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[0].useNameAsPrefix=false'
- * 'spring.cloud.kubernetes.config.sources[0].includeProfileSpecificSources=true'
- * ("one.property", "one-from-k8s")
- *
- * As such: @ConfigurationProperties("one"), value is overridden by the one that we read from
- * the profile based source.
- *
- */
- @Test
- void testOne() {
- this.webClient.get().uri("/named-configmap/profile/one").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("one-from-k8s"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[1].explicitPrefix=two'
- * 'spring.cloud.kubernetes.config.sources[1].includeProfileSpecificSources=false'
- * ("property", "two")
- *
- * As such: @ConfigurationProperties("two").
- *
- * Even if there is a profile based source, we disabled reading it.
- *
- */
- @Test
- void testTwo() {
- this.webClient.get().uri("/named-configmap/profile/two").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("two"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.config.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.config.sources[2].name=configmap-three'
- * 'spring.cloud.kubernetes.config.sources[1].includeProfileSpecificSources=true'
- * ("property", "three")
- *
- * As such: @ConfigurationProperties(prefix = "config-three"), value is overridden by the one that we read from
- * the profile based source
- *
- */
- @Test
- void testThree() {
- this.webClient.get().uri("/named-configmap/profile/three").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("three-from-k8s"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/controller/NamedConfigMapWithProfileController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/controller/NamedConfigMapWithProfileController.java
deleted file mode 100644
index 3a1bd2b1d2..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/controller/NamedConfigMapWithProfileController.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties.Two;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class NamedConfigMapWithProfileController {
-
- private final One one;
-
- private final Two two;
-
- private final Three three;
-
- public NamedConfigMapWithProfileController(One one, Two two, Three three) {
- this.one = one;
- this.two = two;
- this.three = three;
- }
-
- @GetMapping("/named-configmap/profile/one")
- public String one() {
- return one.getProperty();
- }
-
- @GetMapping("/named-configmap/profile/two")
- public String two() {
- return two.getProperty();
- }
-
- @GetMapping("/named-configmap/profile/three")
- public String three() {
- return three.getProperty();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/One.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/One.java
deleted file mode 100644
index ac8e271586..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/One.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("one")
-public class One {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/Three.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/Three.java
deleted file mode 100644
index 77d6656dc8..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/Three.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("configmap-three")
-public class Three {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/Two.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/Two.java
deleted file mode 100644
index 3d5bbb80d0..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_config_map_with_profile/properties/Two.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_config_map_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("two")
-public class Two {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixApp.java
deleted file mode 100644
index 036776a6ac..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixApp.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties.Two;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ One.class, Two.class, Three.class })
-public class NamedSecretWithPrefixApp {
-
- public static void main(String[] args) {
- SpringApplication.run(NamedSecretWithPrefixApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixBootstrapTests.java
deleted file mode 100644
index 9c11d631b2..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixBootstrapTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Ryan Baxter
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = NamedSecretWithPrefixApp.class,
- properties = { "spring.cloud.bootstrap.name=named-secret-with-prefix", "named.secret.with.prefix.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true",
- "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class NamedSecretWithPrefixBootstrapTests extends NamedSecretWithPrefixTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixConfigDataTests.java
deleted file mode 100644
index bacf92cb44..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixConfigDataTests.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedSecretWithPrefixConfigurationStub.stubData;
-
-/**
- * @author Ryan Baxter
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = NamedSecretWithPrefixApp.class,
- properties = { "spring.cloud.application.name=named-secret-with-prefix", "named.secret.with.prefix.stub=true",
- "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./named-secret-with-prefix.yaml",
- "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class NamedSecretWithPrefixConfigDataTests extends NamedSecretWithPrefixTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixTests.java
deleted file mode 100644
index 58a6545d2a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/NamedSecretWithPrefixTests.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedSecretWithPrefixConfigurationStub}
- *
- * @author wind57
- */
-abstract class NamedSecretWithPrefixTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[0].useNameAsPrefix=false'
- * ("one.property", "one")
- *
- * As such: @ConfigurationProperties("one")
- *
- */
- @Test
- void testOne() {
- this.webClient.get().uri("/named-secret/prefix/one").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("one"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[1].explicitPrefix=two'
- * ("property", "two")
- *
- * As such: @ConfigurationProperties("two")
- *
- */
- @Test
- void testTwo() {
- this.webClient.get().uri("/named-secret/prefix/two").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("two"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[2].name=config-map-three'
- * ("property", "three")
- *
- * As such: @ConfigurationProperties(prefix = "config-map-three")
- *
- */
- @Test
- void testThree() {
- this.webClient.get().uri("/named-secret/prefix/three").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("three"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/controller/NamedSecretWithPrefixController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/controller/NamedSecretWithPrefixController.java
deleted file mode 100644
index facc299a6e..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/controller/NamedSecretWithPrefixController.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties.Two;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class NamedSecretWithPrefixController {
-
- private final One one;
-
- private final Two two;
-
- private final Three three;
-
- public NamedSecretWithPrefixController(One one, Two two, Three three) {
- this.one = one;
- this.two = two;
- this.three = three;
- }
-
- @GetMapping("/named-secret/prefix/one")
- public String one() {
- return one.getProperty();
- }
-
- @GetMapping("/named-secret/prefix/two")
- public String two() {
- return two.getProperty();
- }
-
- @GetMapping("/named-secret/prefix/three")
- public String three() {
- return three.getProperty();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/One.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/One.java
deleted file mode 100644
index 80127c1bc7..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/One.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("one")
-public class One {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/Three.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/Three.java
deleted file mode 100644
index 658e23d903..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/Three.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "secret-three")
-public class Three {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/Two.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/Two.java
deleted file mode 100644
index a28aca72c4..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_prefix/properties/Two.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_prefix.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("two")
-public class Two {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithLabelApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithLabelApp.java
deleted file mode 100644
index 64c7643cae..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithLabelApp.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties.Two;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ One.class, Two.class, Three.class })
-public class NamedSecretWithLabelApp {
-
- public static void main(String[] args) {
- SpringApplication.run(NamedSecretWithLabelApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileBootstrapTests.java
deleted file mode 100644
index 50cbd8837c..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileBootstrapTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-
-/**
- * @author wind57
- */
-@ActiveProfiles("k8s")
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = NamedSecretWithLabelApp.class,
- properties = { "spring.cloud.bootstrap.name=named-secret-with-profile", "named.secret.with.profile.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
-class NamedSecretWithProfileBootstrapTests extends NamedSecretWithProfileTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileConfigDataTests.java
deleted file mode 100644
index 327af36374..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileConfigDataTests.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.test.context.ActiveProfiles;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedSecretWithProfileConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@ActiveProfiles("k8s")
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = NamedSecretWithLabelApp.class,
- properties = { "spring.cloud.application.name=named-secret-with-profile", "named.secret.with.profile.stub=true",
- "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./named-secret-with-profile.yaml",
- "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class NamedSecretWithProfileConfigDataTests extends NamedSecretWithProfileTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileTests.java
deleted file mode 100644
index 20093f5dc5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/NamedSecretWithProfileTests.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedSecretWithProfileConfigurationStub}
- *
- * @author wind57
- */
-abstract class NamedSecretWithProfileTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[0].useNameAsPrefix=false'
- * 'spring.cloud.kubernetes.secrets.sources[0].includeProfileSpecificSources=true'
- * ("one.property", "one-from-k8s")
- *
- * As such: @ConfigurationProperties("one"), value is overridden by the one that we read from
- * the profile based source.
- *
- */
- @Test
- void testOne() {
- this.webClient.get().uri("/named-secret/profile/one").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("one-from-k8s"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[1].explicitPrefix=two'
- * 'spring.cloud.kubernetes.secrets.sources[1].includeProfileSpecificSources=false'
- * ("property", "two")
- *
- * As such: @ConfigurationProperties("two").
- *
- * Even if there is a profile based source, we disabled reading it.
- *
- */
- @Test
- void testTwo() {
- this.webClient.get().uri("/named-secret/profile/two").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("two"));
- }
-
- /**
- *
- * 'spring.cloud.kubernetes.secrets.useNameAsPrefix=true'
- * 'spring.cloud.kubernetes.secrets.sources[2].name=secret-three'
- * 'spring.cloud.kubernetes.secrets.sources[1].includeProfileSpecificSources=true'
- * ("property", "three")
- *
- * As such: @ConfigurationProperties(prefix = "secret-three"), value is overridden by the one that we read from
- * * the profile based source
- *
- */
- @Test
- void testThree() {
- this.webClient.get().uri("/named-secret/profile/three").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("three-from-k8s"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/controller/NamedSecretWithProfileController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/controller/NamedSecretWithProfileController.java
deleted file mode 100644
index 93758cc0bf..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/controller/NamedSecretWithProfileController.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties.One;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties.Three;
-import org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties.Two;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class NamedSecretWithProfileController {
-
- private final One one;
-
- private final Two two;
-
- private final Three three;
-
- public NamedSecretWithProfileController(One one, Two two, Three three) {
- this.one = one;
- this.two = two;
- this.three = three;
- }
-
- @GetMapping("/named-secret/profile/one")
- public String one() {
- return one.getProperty();
- }
-
- @GetMapping("/named-secret/profile/two")
- public String two() {
- return two.getProperty();
- }
-
- @GetMapping("/named-secret/profile/three")
- public String three() {
- return three.getProperty();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/One.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/One.java
deleted file mode 100644
index f2d558ef98..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/One.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("one")
-public class One {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/Three.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/Three.java
deleted file mode 100644
index d4418e3278..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/Three.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "secret-three")
-public class Three {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/Two.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/Two.java
deleted file mode 100644
index 64a8f67ecc..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/named_secret_with_profile/properties/Two.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.named_secret_with_profile.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("two")
-public class Two {
-
- private String property;
-
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesApp.java
deleted file mode 100644
index 17f7d3c768..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesApp.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Color;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Name;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Shape;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Type;
-
-@SpringBootApplication
-@EnableConfigurationProperties({ Name.class, Shape.class, Color.class, Type.class })
-public class SingleSourceMultipleFilesApp {
-
- public static void main(String[] args) {
- SpringApplication.run(SingleSourceMultipleFilesApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesBootstrapTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesBootstrapTests.java
deleted file mode 100644
index c5f3fb1a54..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesBootstrapTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-
-/**
- * @author wind57
- */
-@ActiveProfiles("color")
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = SingleSourceMultipleFilesApp.class,
- properties = { "spring.cloud.bootstrap.name=single-source-multiple-files",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true",
- "spring.cloud.kubernetes.client.namespace=spring-k8s", "single.source.multiple.files.stub=true" })
-class SingleSourceMultipleFilesBootstrapTests extends SingleSourceMultipleFilesTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesConfigDataTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesConfigDataTests.java
deleted file mode 100644
index fa56b6811b..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesConfigDataTests.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.test.context.ActiveProfiles;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SingleSourceMultipleFilesConfigurationStub.stubData;
-
-/**
- * @author wind57
- */
-@ActiveProfiles("color")
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- classes = SingleSourceMultipleFilesApp.class, properties = { "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./single-source-multiple-files.yaml" })
-class SingleSourceMultipleFilesConfigDataTests extends SingleSourceMultipleFilesTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesTests.java
deleted file mode 100644
index 6ba97caee4..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/SingleSourceMultipleFilesTests.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * @author wind57
- *
- * Stub for this test is here :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SingleSourceMultipleFilesConfigurationStub}
- *
- * issue: https://github.com/spring-cloud/spring-cloud-kubernetes/issues/640
- *
- */
-abstract class SingleSourceMultipleFilesTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * "fruit-color.properties" is taken since "spring.application.name=fruit" and
- * "color" is an active profile
- *
- */
- @Test
- void color() {
- this.webClient.get().uri("/single_source-multiple-files/color").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("raw:green###ripe:yellow"));
- }
-
- /**
- *
- * "fruit.properties" is read, since it matches "spring.application.name"
- *
- */
- @Test
- void name() {
- this.webClient.get().uri("/single_source-multiple-files/name").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("banana"));
- }
-
- /**
- *
- * shape profile is not active, thus property "fruit-shape.properties" is skipped
- * and as such, a null comes here.
- *
- */
- @Test
- void shape() {
- this.webClient.get().uri("/single_source-multiple-files/shape").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.nullValue());
- }
-
- /**
- *
- * this is a non-file property in the configmap
- *
- */
- @Test
- void type() {
- this.webClient.get().uri("/single_source-multiple-files/type").exchange().expectStatus().isOk()
- .expectBody(String.class).value(Matchers.equalTo("yummy"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/controller/SingleSourceMultipleFilesController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/controller/SingleSourceMultipleFilesController.java
deleted file mode 100644
index 8fb655618c..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/controller/SingleSourceMultipleFilesController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Color;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Name;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Shape;
-import org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties.Type;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class SingleSourceMultipleFilesController {
-
- private final Name name;
-
- private final Shape shape;
-
- private final Color color;
-
- private final Type type;
-
- public SingleSourceMultipleFilesController(Name name, Shape shape, Color color, Type type) {
- this.name = name;
- this.shape = shape;
- this.color = color;
- this.type = type;
- }
-
- @GetMapping("/single_source-multiple-files/type")
- public String type() {
- return type.getType();
- }
-
- @GetMapping("/single_source-multiple-files/shape")
- public String shape() {
- return shape.getRaw();
- }
-
- @GetMapping("/single_source-multiple-files/color")
- public String color() {
- return "raw:" + color.getRaw() + "###" + "ripe:" + color.getRipe();
- }
-
- @GetMapping("/single_source-multiple-files/name")
- public String name() {
- return name.getName();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Color.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Color.java
deleted file mode 100644
index 8d5cb2d44d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Color.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "color.when")
-public class Color {
-
- private String raw;
-
- private String ripe;
-
- public String getRaw() {
- return raw;
- }
-
- public void setRaw(String raw) {
- this.raw = raw;
- }
-
- public String getRipe() {
- return ripe;
- }
-
- public void setRipe(String ripe) {
- this.ripe = ripe;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Name.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Name.java
deleted file mode 100644
index 21df50111a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Name.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("cool")
-public class Name {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Shape.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Shape.java
deleted file mode 100644
index 3a041536d8..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Shape.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("shape.when")
-public class Shape {
-
- private String raw;
-
- private String ripe;
-
- public String getRaw() {
- return raw;
- }
-
- public void setRaw(String raw) {
- this.raw = raw;
- }
-
- public String getRipe() {
- return ripe;
- }
-
- public void setRipe(String ripe) {
- this.ripe = ripe;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Type.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Type.java
deleted file mode 100644
index a8e4338b74..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/single_source_multiple_files/properties/Type.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.single_source_multiple_files.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("fruit")
-public class Type {
-
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/BootstrapRetryableSourcesOrderTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/BootstrapRetryableSourcesOrderTests.java
deleted file mode 100644
index ad0bfa9ef4..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/BootstrapRetryableSourcesOrderTests.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SourcesOrderApp.class,
- properties = { "spring.cloud.bootstrap.name=retryable-sources-order", "sources.order.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
-class BootstrapRetryableSourcesOrderTests extends SourcesOrderTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/BootstrapSourcesOrderTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/BootstrapSourcesOrderTests.java
deleted file mode 100644
index 412e72c276..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/BootstrapSourcesOrderTests.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SourcesOrderApp.class,
- properties = { "spring.cloud.bootstrap.name=sources-order", "sources.order.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
-class BootstrapSourcesOrderTests extends SourcesOrderTests {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/ConfigDataRetryableSourcesOrderTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/ConfigDataRetryableSourcesOrderTests.java
deleted file mode 100644
index f8c23716bb..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/ConfigDataRetryableSourcesOrderTests.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub.stubConfigMapData;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub.stubSecretsData;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub}
- *
- * @author wind57
- */
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SourcesOrderApp.class,
- properties = { "spring.cloud.bootstrap.name=retryable-sources-order", "sources.order.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
-@AutoConfigureWebTestClient
-class ConfigDataRetryableSourcesOrderTests extends SourcesOrderTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubConfigMapData();
- stubSecretsData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/ConfigDataSourcesOrderTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/ConfigDataSourcesOrderTests.java
deleted file mode 100644
index 1aea3d0290..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/ConfigDataSourcesOrderTests.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.Mockito.mockStatic;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub.stubConfigMapData;
-import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub.stubSecretsData;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SourcesOrderApp.class,
- properties = { "spring.cloud.application.name=sources-order", "sources.order.stub=true",
- "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:,classpath:./sources-order.yaml",
- "spring.cloud.kubernetes.client.namespace=spring-k8s" })
-class ConfigDataSourcesOrderTests extends SourcesOrderTests {
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(server.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("spring-k8s");
- stubConfigMapData();
- stubSecretsData();
- }
-
- @AfterAll
- static void teardown() {
- clientUtilsMock.close();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/SourcesOrderApp.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/SourcesOrderApp.java
deleted file mode 100644
index 757ddb63ab..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/SourcesOrderApp.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.kubernetes.client.config.applications.sources_order.properties.Properties;
-
-/**
- * @author wind57
- */
-@SpringBootApplication
-@EnableConfigurationProperties(Properties.class)
-public class SourcesOrderApp {
-
- public static void main(String[] args) {
- SpringApplication.run(SourcesOrderApp.class, args);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/SourcesOrderTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/SourcesOrderTests.java
deleted file mode 100644
index 7e7d59f2ba..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/SourcesOrderTests.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.springframework.test.web.reactive.server.WebTestClient;
-
-/**
- * The stub data for this test is in :
- * {@link org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub}
- *
- * @author wind57
- */
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SourcesOrderApp.class,
- properties = { "spring.cloud.bootstrap.name=sources-order", "sources.order.stub=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" })
-@AutoConfigureWebTestClient
-abstract class SourcesOrderTests {
-
- @Autowired
- private WebTestClient webClient;
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- }
-
- @AfterAll
- static void afterAll() {
- WireMock.shutdownServer();
- }
-
- /**
- *
- * 1. There is one secret deployed: my-secret. It has two properties: {my.one=one, my.key=from-secret}
- * 2. There is one configmap deployed: my-configmap. It has two properties: {my.two=two, my.key=from-configmap}
- *
- * We invoke three endpoints: /one, /two, /key.
- * The first two prove that both the secret and configmap have been read, the last one proves that
- * config maps have a higher precedence.
- *
- */
- @Test
- void test() {
- this.webClient.get().uri("/one").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("one"));
- this.webClient.get().uri("/two").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("two"));
-
- this.webClient.get().uri("/key").exchange().expectStatus().isOk().expectBody(String.class)
- .value(Matchers.equalTo("from-configmap"));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/controller/SourcesOrderController.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/controller/SourcesOrderController.java
deleted file mode 100644
index e5288511ed..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/controller/SourcesOrderController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order.controller;
-
-import org.springframework.cloud.kubernetes.client.config.applications.sources_order.properties.Properties;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author wind57
- */
-@RestController
-public class SourcesOrderController {
-
- private final Properties properties;
-
- SourcesOrderController(Properties properties) {
- this.properties = properties;
- }
-
- @GetMapping("/key")
- String key() {
- return properties.getKey();
- }
-
- @GetMapping("/one")
- String one() {
- return properties.getOne();
- }
-
- @GetMapping("/two")
- String two() {
- return properties.getTwo();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/properties/Properties.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/properties/Properties.java
deleted file mode 100644
index 14b55ddba5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/applications/sources_order/properties/Properties.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.applications.sources_order.properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * @author wind57
- */
-@ConfigurationProperties("my")
-public class Properties {
-
- private String key;
-
- private String one;
-
- private String two;
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getOne() {
- return one;
- }
-
- public void setOne(String one) {
- this.one = one;
- }
-
- public String getTwo() {
- return two;
- }
-
- public void setTwo(String two) {
- this.two = two;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java
deleted file mode 100644
index c55e19164a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Collections;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("labeled.config.map.with.prefix.stub")
-public class LabeledConfigMapWithPrefixConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
-
- V1ConfigMap one = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-one").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "a")).build())
- .addToData(Collections.singletonMap("one.property", "one")).build();
-
- V1ConfigMap two = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-two").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "b")).build())
- .addToData(Collections.singletonMap("property", "two")).build();
-
- V1ConfigMap three = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-three").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "c")).build())
- .addToData(Collections.singletonMap("property", "three")).build();
-
- V1ConfigMap four = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-four").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "d")).build())
- .addToData(Collections.singletonMap("property", "four")).build();
-
- // the actual stub for CoreV1Api calls
- V1ConfigMapList configMapList = new V1ConfigMapList();
- configMapList.addItemsItem(one);
- configMapList.addItemsItem(two);
- configMapList.addItemsItem(three);
- configMapList.addItemsItem(four);
-
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(configMapList))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java
deleted file mode 100644
index 09205f36e6..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Collections;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("labeled.config.map.with.profile.stub")
-public class LabeledConfigMapWithProfileConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubData();
- return apiClient;
- }
-
- /**
- *
- * - configmap with name "color-configmap", with labels: "{color: blue}" and "explicitPrefix: blue"
- * - configmap with name "green-configmap", with labels: "{color: green}" and "explicitPrefix: blue-again"
- * - configmap with name "red-configmap", with labels "{color: not-red}" and "useNameAsPrefix: true"
- * - configmap with name "yellow-configmap" with labels "{color: not-yellow}" and useNameAsPrefix: true
- * - configmap with name "color-configmap-k8s", with labels : "{color: not-blue}"
- * - configmap with name "green-configmap-k8s", with labels : "{color: green-k8s}"
- * - configmap with name "green-configmap-prod", with labels : "{color: green-prod}"
- *
- * # a test that proves order: first read non-profile based configmaps, thus profile based
- * # configmaps override non-profile ones.
- * - configmap with name "green-purple-configmap", labels "{color: green, shape: round}", data: "{eight: 8}"
- * - configmap with name "green-purple-configmap-k8s", labels "{color: black}", data: "{eight: eight-ish}"
- *
- */
- public static void stubData() {
-
- // is found by labels
- V1ConfigMap colorConfigMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("color-configmap").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "blue")).build())
- .addToData(Collections.singletonMap("one", "1")).build();
-
- // is not taken, since "profileSpecificSources=false" for the above
- V1ConfigMap colorConfigMapK8s = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("color-configmap-k8s").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "not-blue")).build())
- .addToData(Collections.singletonMap("five", "5")).build();
-
- // is found by labels
- V1ConfigMap greenConfigMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-configmap").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green")).build())
- .addToData(Collections.singletonMap("two", "2")).build();
-
- V1ConfigMap greenConfigMapK8s = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-configmap-k8s").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green-k8s")).build())
- .addToData(Collections.singletonMap("six", "6")).build();
-
- // is taken because prod profile is active and "profileSpecificSources=true"
- V1ConfigMap greenConfigMapProd = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-configmap-prod").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green-prod")).build())
- .addToData(Collections.singletonMap("seven", "7")).build();
-
- // not taken
- V1ConfigMap redConfigMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("red-configmap").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "red")).build())
- .addToData(Collections.singletonMap("three", "3")).build();
-
- // not taken
- V1ConfigMap yellowConfigMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("yellow-configmap").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "yellow")).build())
- .addToData(Collections.singletonMap("four", "4")).build();
-
- // is found by labels
- V1ConfigMap greenPurpleConfigMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-purple-configmap").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green", "shape", "round")).build())
- .addToData(Collections.singletonMap("eight", "8")).build();
-
- // is taken and thus overrides the above
- V1ConfigMap greenPurpleConfigMapK8s = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-purple-configmap-k8s")
- .withNamespace("spring-k8s").withLabels(Map.of("color", "black")).build())
- .addToData(Collections.singletonMap("eight", "eight-ish")).build();
-
- // the actual stub for CoreV1Api calls
- V1ConfigMapList configMaps = new V1ConfigMapList();
- configMaps.addItemsItem(colorConfigMap);
- configMaps.addItemsItem(colorConfigMapK8s);
- configMaps.addItemsItem(greenConfigMap);
- configMaps.addItemsItem(greenConfigMapK8s);
- configMaps.addItemsItem(greenConfigMapProd);
- configMaps.addItemsItem(redConfigMap);
- configMaps.addItemsItem(yellowConfigMap);
- configMaps.addItemsItem(greenPurpleConfigMap);
- configMaps.addItemsItem(greenPurpleConfigMapK8s);
-
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(configMaps))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledSecretWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledSecretWithPrefixConfigurationStub.java
deleted file mode 100644
index ea30c86b88..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledSecretWithPrefixConfigurationStub.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Collections;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretBuilder;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("labeled.secret.with.prefix.stub")
-public class LabeledSecretWithPrefixConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
- V1Secret one = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-one").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "a")).withResourceVersion("1").build())
- .addToData(Collections.singletonMap("one.property", "one".getBytes())).build();
-
- V1Secret two = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-two").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "b")).withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "two".getBytes())).build();
-
- V1Secret three = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-three").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "c")).withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "three".getBytes())).build();
-
- V1Secret four = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-four").withNamespace("spring-k8s")
- .withLabels(Map.of("letter", "d")).withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "four".getBytes())).build();
-
- // the actual stub for CoreV1Api calls
- V1SecretList secrets = new V1SecretList();
- secrets.addItemsItem(one);
- secrets.addItemsItem(two);
- secrets.addItemsItem(three);
- secrets.addItemsItem(four);
-
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(secrets))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledSecretWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledSecretWithProfileConfigurationStub.java
deleted file mode 100644
index 813d37d54e..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/LabeledSecretWithProfileConfigurationStub.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Collections;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretBuilder;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("labeled.secret.with.profile.stub")
-public class LabeledSecretWithProfileConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubData();
- return apiClient;
- }
-
- /**
- *
- * - secret with name "color-secret", with labels: "{color: blue}" and "explicitPrefix: blue"
- * - secret with name "green-secret", with labels: "{color: green}" and "explicitPrefix: blue-again"
- * - secret with name "red-secret", with labels "{color: not-red}" and "useNameAsPrefix: true"
- * - secret with name "yellow-secret" with labels "{color: not-yellow}" and useNameAsPrefix: true
- * - secret with name "color-secret-k8s", with labels : "{color: not-blue}"
- * - secret with name "green-secret-k8s", with labels : "{color: green-k8s}"
- * - secret with name "green-secret-prod", with labels : "{color: green-prod}"
- *
- * # a test that proves order: first read non-profile based secrets, thus profile based
- * # secrets override non-profile ones.
- * - secret with name "green-purple-secret", labels "{color: green, shape: round}", data: "{eight: 8}"
- * - secret with name "green-purple-secret-k8s", labels "{color: black}", data: "{eight: eight-ish}"
- *
- */
- public static void stubData() {
-
- // is found by labels
- V1Secret colorSecret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("color-secret").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "blue")).build())
- .addToData(Collections.singletonMap("one", "1".getBytes(StandardCharsets.UTF_8))).build();
-
- // is not taken, since "profileSpecificSources=false" for the above
- V1Secret colorSecretK8s = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("color-secret-k8s").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "not-blue")).build())
- .addToData(Collections.singletonMap("five", "5".getBytes(StandardCharsets.UTF_8))).build();
-
- // is found by labels
- V1Secret greenSecret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-secret").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green")).build())
- .addToData(Collections.singletonMap("two", "2".getBytes(StandardCharsets.UTF_8))).build();
-
- V1Secret greenSecretK8s = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-secret-k8s").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green-k8s")).build())
- .addToData(Collections.singletonMap("six", "6".getBytes(StandardCharsets.UTF_8))).build();
-
- // is taken because prod profile is active and "profileSpecificSources=true"
- V1Secret shapeSecretProd = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-secret-prod").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green-prod")).build())
- .addToData(Collections.singletonMap("seven", "7".getBytes(StandardCharsets.UTF_8))).build();
-
- // not taken
- V1Secret redSecret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("red-secret").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "not-red")).build())
- .addToData(Collections.singletonMap("three", "3".getBytes(StandardCharsets.UTF_8))).build();
-
- // not taken
- V1Secret yellowSecret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("yellow-secret").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "not-yellow")).build())
- .addToData(Collections.singletonMap("four", "4".getBytes(StandardCharsets.UTF_8))).build();
-
- // is found by labels
- V1Secret greenPurpleSecret = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-purple-secret").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "green", "shape", "round")).build())
- .addToData(Collections.singletonMap("eight", "8".getBytes(StandardCharsets.UTF_8))).build();
-
- // is taken and thus overrides the above
- V1Secret greenPurpleSecretK8s = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("green-purple-secret-k8s").withNamespace("spring-k8s")
- .withLabels(Map.of("color", "black")).build())
- .addToData(Collections.singletonMap("eight", "eight-ish".getBytes(StandardCharsets.UTF_8))).build();
-
- // the actual stub for CoreV1Api calls
- V1SecretList secrets = new V1SecretList();
- secrets.addItemsItem(colorSecret);
- secrets.addItemsItem(colorSecretK8s);
- secrets.addItemsItem(greenSecret);
- secrets.addItemsItem(greenSecretK8s);
- secrets.addItemsItem(shapeSecretProd);
- secrets.addItemsItem(redSecret);
- secrets.addItemsItem(yellowSecret);
- secrets.addItemsItem(greenPurpleSecret);
- secrets.addItemsItem(greenPurpleSecretK8s);
-
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(secrets))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java
deleted file mode 100644
index c021349cd1..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("named.config.map.with.prefix.stub")
-public class NamedConfigMapWithPrefixConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
- V1ConfigMap one = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("config-map-one").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("one.property", "one")).build();
-
- V1ConfigMap two = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("config-map-two").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "two")).build();
-
- V1ConfigMap three = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("config-map-three").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "three")).build();
-
- V1ConfigMapList allConfigMaps = new V1ConfigMapList();
- allConfigMaps.setItems(Arrays.asList(one, two, three));
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedConfigMapWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedConfigMapWithProfileConfigurationStub.java
deleted file mode 100644
index 8e2147c9ef..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedConfigMapWithProfileConfigurationStub.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("named.config.map.with.profile.stub")
-public class NamedConfigMapWithProfileConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
-
- // "one" and "oneFromK8s" also prove the fact that the right order is preserved:
- // first non-profile based
- // and only after profile based sources. Thus, properties from "one" are
- // overridden by the ones from "oneFromK8s".
- // We have a test that asserts this.
- V1ConfigMap one = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-one").withNamespace("spring-k8s").build())
- .addToData(Collections.singletonMap("one.property", "one")).build();
-
- V1ConfigMap oneFromK8s = new V1ConfigMapBuilder()
- .withMetadata(
- new V1ObjectMetaBuilder().withName("configmap-one-k8s").withNamespace("spring-k8s").build())
- .addToData(Collections.singletonMap("one.property", "one-from-k8s")).build();
-
- V1ConfigMap two = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-two").withNamespace("spring-k8s").build())
- .addToData(Collections.singletonMap("property", "two")).build();
-
- V1ConfigMap twoFromK8s = new V1ConfigMapBuilder()
- .withMetadata(
- new V1ObjectMetaBuilder().withName("configmap-two-k8s").withNamespace("spring-k8s").build())
- .addToData(Collections.singletonMap("property", "two-from-k8s")).build();
-
- V1ConfigMap three = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("configmap-three").withNamespace("spring-k8s").build())
- .addToData(Collections.singletonMap("property", "three")).build();
-
- V1ConfigMap threeFromK8s = new V1ConfigMapBuilder()
- .withMetadata(
- new V1ObjectMetaBuilder().withName("configmap-three-k8s").withNamespace("spring-k8s").build())
- .addToData(Collections.singletonMap("property", "three-from-k8s")).build();
-
- V1ConfigMapList allConfigMaps = new V1ConfigMapList();
- allConfigMaps.setItems(Arrays.asList(one, oneFromK8s, two, twoFromK8s, three, threeFromK8s));
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedSecretWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedSecretWithPrefixConfigurationStub.java
deleted file mode 100644
index dc8ab3dfd5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedSecretWithPrefixConfigurationStub.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretBuilder;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("named.secret.with.prefix.stub")
-public class NamedSecretWithPrefixConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
- V1Secret one = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-one").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("one.property", "one".getBytes())).build();
-
- V1Secret two = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-two").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "two".getBytes())).build();
-
- V1Secret three = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-three").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "three".getBytes())).build();
-
- V1SecretList allSecrets = new V1SecretList();
- allSecrets.setItems(Arrays.asList(one, two, three));
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allSecrets))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedSecretWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedSecretWithProfileConfigurationStub.java
deleted file mode 100644
index b1e1a19542..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/NamedSecretWithProfileConfigurationStub.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretBuilder;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("named.secret.with.profile.stub")
-public class NamedSecretWithProfileConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
-
- // "one" and "oneWithProfile" also prove the fact that the right order is
- // preserved: first non-profile based
- // and only after profile based sources. Thus, properties from "one" are
- // overridden by the ones from "oneWithProfile".
- // We have a test that asserts this.
- V1Secret one = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-one").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("one.property", "one".getBytes())).build();
-
- V1Secret oneWithProfile = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-one-k8s").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("one.property", "one-from-k8s".getBytes())).build();
-
- V1Secret two = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-two").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "two".getBytes())).build();
-
- V1Secret twoWithProfile = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-two-k8s").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "two-from-k8s".getBytes())).build();
-
- V1Secret three = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-three").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "three".getBytes())).build();
-
- V1Secret threeFromProfile = new V1SecretBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("secret-three-k8s").withNamespace("spring-k8s")
- .withResourceVersion("1").build())
- .addToData(Collections.singletonMap("property", "three-from-k8s".getBytes())).build();
-
- V1SecretList allSecrets = new V1SecretList();
- allSecrets.setItems(Arrays.asList(one, oneWithProfile, two, twoWithProfile, three, threeFromProfile));
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allSecrets))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/SingleSourceMultipleFilesConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/SingleSourceMultipleFilesConfigurationStub.java
deleted file mode 100644
index e92948d747..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/SingleSourceMultipleFilesConfigurationStub.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-/**
- * A test bootstrap that takes care to initialize ApiClient _before_ our main bootstrap
- * context; with some stub data already present.
- *
- * @author wind57
- */
-@Order(0)
-@Configuration
-@ConditionalOnProperty("single.source.multiple.files.stub")
-public class SingleSourceMultipleFilesConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- stubData();
- return apiClient;
- }
-
- public static void stubData() {
-
- Map one = new HashMap<>();
- one.put("fruit.type", "yummy");
- one.put("fruit.properties", "cool.name=banana");
- one.put("fruit-color.properties", "color.when.raw=green\ncolor.when.ripe=yellow");
-
- // this is not taken, since "shape" is not an active profile
- one.put("fruit-shape.properties", "shape.when.raw=small-sphere\nshape.when.ripe=bigger-sphere");
-
- V1ConfigMap configMap = new V1ConfigMapBuilder()
- .withMetadata(new V1ObjectMetaBuilder().withName("my-configmap").withNamespace("spring-k8s").build())
- .addToData(one).build();
-
- V1ConfigMapList allConfigMaps = new V1ConfigMapList();
- allConfigMaps.addItemsItem(configMap);
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/SourcesOrderConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/SourcesOrderConfigurationStub.java
deleted file mode 100644
index 9b6bd8587a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap/stubs/SourcesOrderConfigurationStub.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMetaBuilder;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretBuilder;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-
-@Order(0)
-@Configuration
-@ConditionalOnProperty("sources.order.stub")
-public class SourcesOrderConfigurationStub {
-
- @Bean
- public WireMockServer wireMock() {
- WireMockServer server = new WireMockServer(options().dynamicPort());
- server.start();
- WireMock.configureFor("localhost", server.port());
- return server;
- }
-
- @Bean
- public ApiClient apiClient(WireMockServer wireMockServer) {
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
- apiClient.setDebugging(true);
- stubConfigMapData();
- stubSecretsData();
- return apiClient;
- }
-
- public static void stubConfigMapData() {
-
- Map configMapData = new HashMap<>();
- configMapData.put("my.key", "from-configmap");
- configMapData.put("my.two", "two");
-
- V1ConfigMap myConfigMap = new V1ConfigMapBuilder().withMetadata(new V1ObjectMetaBuilder()
- .withName("my-configmap").withNamespace("spring-k8s").withResourceVersion("1").build())
- .addToData(configMapData).build();
-
- V1ConfigMapList allConfigMaps = new V1ConfigMapList();
- allConfigMaps.setItems(Collections.singletonList(myConfigMap));
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps))));
- }
-
- public static void stubSecretsData() {
-
- Map secretData = new HashMap<>();
- secretData.put("my.key", "from-secret".getBytes(StandardCharsets.UTF_8));
- secretData.put("my.one", "one".getBytes(StandardCharsets.UTF_8));
-
- V1Secret mySecret = new V1SecretBuilder().withMetadata(new V1ObjectMetaBuilder().withName("my-secret")
- .withNamespace("spring-k8s").withResourceVersion("1").build()).addToData(secretData).build();
-
- V1SecretList allConfigMaps = new V1SecretList();
- allConfigMaps.setItems(Collections.singletonList(mySecret));
-
- // the actual stub for CoreV1Api calls
- WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets")
- .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps))));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesClientBootstrapConfigurationInsideK8s.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesClientBootstrapConfigurationInsideK8s.java
deleted file mode 100644
index 898d664fa9..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesClientBootstrapConfigurationInsideK8s.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.client.namespace=abc",
- "spring.cloud.bootstrap.enabled=true" })
-class KubernetesClientBootstrapConfigurationInsideK8s {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- // tests that @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) has the desired
- // effect, meaning when it is enabled, both property sources are present
- @Test
- public void bothPresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(1);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(1);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesClientBootstrapConfigurationNotInsideK8s.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesClientBootstrapConfigurationNotInsideK8s.java
deleted file mode 100644
index b84ef3c7e5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesClientBootstrapConfigurationNotInsideK8s.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "kubernetes.manifests.enabled=false" })
-class KubernetesClientBootstrapConfigurationNotInsideK8s {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- // tests that @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) has the desired
- // effect, meaning when it is disabled, no property source bean is present
- @Test
- void bothMissing() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(0);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(0);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesDisabled.java
deleted file mode 100644
index bfe295c45d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesDisabled.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "kubernetes.informer.enabled=false", "kubernetes.manifests.enabled=false" })
-class KubernetesDisabled {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @Test
- void configAndSecretsBeansAreNotPresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(0);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(0);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabled.java
deleted file mode 100644
index fc43330fe9..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabled.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" })
-class KubernetesEnabled {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @Test
- void configAndSecretsBeansArePresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(1);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(1);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledConfigDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledConfigDisabled.java
deleted file mode 100644
index e8ee40b554..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledConfigDisabled.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" })
-class KubernetesEnabledConfigDisabled {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @Test
- void secretsOnlyPresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(0);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(1);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledOnPurpose.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledOnPurpose.java
deleted file mode 100644
index 821d15e2c1..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledOnPurpose.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "spring.cloud.kubernetes.secrets.enabled=true",
- "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" })
-class KubernetesEnabledOnPurpose {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @Test
- void configAndSecretsBeansArePresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(1);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(1);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledSecretsAndConfigDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledSecretsAndConfigDisabled.java
deleted file mode 100644
index 52c8f9a515..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledSecretsAndConfigDisabled.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "spring.cloud.kubernetes.secrets.enabled=false", "spring.cloud.kubernetes.config.enabled=false",
- "spring.main.cloud-platform=KUBERNETES" })
-class KubernetesEnabledSecretsAndConfigDisabled {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @Test
- void secretsOnlyPresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(0);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(0);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledSecretsDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledSecretsDisabled.java
deleted file mode 100644
index db268a9683..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/boostrap_configuration/KubernetesEnabledSecretsDisabled.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.boostrap_configuration;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.config.Application;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author wind57
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class,
- properties = { "spring.cloud.kubernetes.secrets.enabled=false",
- "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" })
-class KubernetesEnabledSecretsDisabled {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @Test
- void secretsOnlyPresent() {
- assertThat(context.getBeanNamesForType(KubernetesClientConfigMapPropertySourceLocator.class)).hasSize(1);
- assertThat(context.getBeanNamesForType(KubernetesClientSecretsPropertySourceLocator.class)).hasSize(0);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/App.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/App.java
deleted file mode 100644
index a0bf1df111..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/App.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-class App {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigFailFastDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigFailFastDisabled.java
deleted file mode 100644
index f94ff5ecf0..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigFailFastDisabled.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" },
- classes = App.class)
-class BootstrapConfigFailFastDisabled extends ConfigFailFastDisabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigFailFastEnabledButRetryDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigFailFastEnabledButRetryDisabled.java
deleted file mode 100644
index ae261f67e5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigFailFastEnabledButRetryDisabled.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.config.fail-fast=true",
- "spring.cloud.kubernetes.config.retry.enabled=false", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" },
- classes = App.class)
-class BootstrapConfigFailFastEnabledButRetryDisabled extends ConfigFailFastEnabledButRetryDisabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigRetryDisabledButSecretsRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigRetryDisabledButSecretsRetryEnabled.java
deleted file mode 100644
index cae7e2ed78..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigRetryDisabledButSecretsRetryEnabled.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.config.fail-fast=true",
- "spring.cloud.kubernetes.config.retry.enabled=false", "spring.cloud.kubernetes.secrets.fail-fast=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" },
- classes = App.class)
-class BootstrapConfigRetryDisabledButSecretsRetryEnabled extends ConfigRetryDisabledButSecretsRetryEnabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigRetryEnabled.java
deleted file mode 100644
index 02e5542079..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/BootstrapConfigRetryEnabled.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.config.fail-fast=true",
- "spring.cloud.kubernetes.config.retry.max-attempts=5", "spring.main.cloud-platform=KUBERNETES",
- "spring.cloud.bootstrap.enabled=true" },
- classes = App.class)
-class BootstrapConfigRetryEnabled extends ConfigRetryEnabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigFailFastDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigFailFastDisabled.java
deleted file mode 100644
index 33051f0239..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigFailFastDisabled.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.client.namespace=default", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:" },
- classes = App.class)
-class ConfigDataConfigFailFastDisabled extends ConfigFailFastDisabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigFailFastEnabledButRetryDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigFailFastEnabledButRetryDisabled.java
deleted file mode 100644
index 5fc1b2d38d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigFailFastEnabledButRetryDisabled.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.client.namespace=default",
- "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false",
- "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" },
- classes = App.class)
-class ConfigDataConfigFailFastEnabledButRetryDisabled extends ConfigFailFastEnabledButRetryDisabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigRetryDisabledButSecretsRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigRetryDisabledButSecretsRetryEnabled.java
deleted file mode 100644
index 60ced494e4..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigRetryDisabledButSecretsRetryEnabled.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.client.namespace=default",
- "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false",
- "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:" },
- classes = App.class)
-class ConfigDataConfigRetryDisabledButSecretsRetryEnabled extends ConfigRetryDisabledButSecretsRetryEnabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigRetryEnabled.java
deleted file mode 100644
index db2a2c96ec..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigDataConfigRetryEnabled.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.client.namespace=default",
- "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.max-attempts=5",
- "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" },
- classes = App.class)
-class ConfigDataConfigRetryEnabled extends ConfigRetryEnabled {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java
deleted file mode 100644
index ddb6ecef7b..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Isik Erhan
- */
-abstract class ConfigFailFastDisabled {
-
- private static final String API = "/api/v1/namespaces/default/configmaps";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private KubernetesClientConfigMapPropertySourceLocator propertySourceLocator;
-
- @Test
- void locateShouldNotRetry() {
- propertySourceLocator = spy(propertySourceLocator);
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- Assertions.assertDoesNotThrow(() -> propertySourceLocator.locate(new MockEnvironment()));
-
- // verify locate is called only once
- verify(propertySourceLocator, times(1)).locate(any());
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java
deleted file mode 100644
index ebea1330bd..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.context.ApplicationContext;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Isik Erhan
- */
-abstract class ConfigFailFastEnabledButRetryDisabled {
-
- private static final String API = "/api/v1/namespaces/default/configmaps";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("default");
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private KubernetesClientConfigMapPropertySourceLocator propertySourceLocator;
-
- @Autowired
- private ApplicationContext context;
-
- @Test
- void locateShouldFailWithoutRetrying() {
- propertySourceLocator = spy(propertySourceLocator);
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- assertThat(context.containsBean("kubernetesConfigRetryInterceptor")).isFalse();
- assertThatThrownBy(() -> propertySourceLocator.locate(new MockEnvironment()))
- .isInstanceOf(IllegalStateException.class).hasMessage("Internal Server Error");
-
- // verify that propertySourceLocator.locate is called only once
- verify(propertySourceLocator, times(1)).locate(any());
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java
deleted file mode 100644
index ffac804563..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-
-import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
-import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor;
-import org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration;
-import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
-import org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientBootstrapConfiguration;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientRetryBootstrapConfiguration;
-import org.springframework.cloud.kubernetes.client.config.reload.KubernetesClientConfigReloadAutoConfiguration;
-import org.springframework.cloud.kubernetes.commons.config.KubernetesBootstrapConfiguration;
-import org.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadAutoConfiguration;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.retry.annotation.RetryConfiguration;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mockStatic;
-
-/**
- * @author Ryan Baxter
- */
-public class ConfigMapEnableRetryWithoutFailFastTest {
-
- private static final String API = "/api/v1/namespaces/default/configmaps";
-
- private static final String SECRETS_API = "/api/v1/namespaces/default/secrets";
-
- private ConfigurableApplicationContext context;
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- public static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- stubFor(get(SECRETS_API)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- }
-
- @AfterAll
- public static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- protected void setup(String... env) {
- List envList = (env != null) ? new ArrayList<>(Arrays.asList(env)) : new ArrayList<>();
- envList.add("spring.cloud.kubernetes.client.namespace=default");
- String[] envArray = envList.toArray(new String[0]);
-
- context = new SpringApplicationBuilder(RetryConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
- ConfigReloadAutoConfiguration.class, RefreshAutoConfiguration.class, EndpointAutoConfiguration.class,
- InfoEndpointAutoConfiguration.class, RefreshEndpointAutoConfiguration.class,
- ConfigurationPropertiesBindingPostProcessor.class,
- ConfigurationPropertiesRebinderAutoConfiguration.class, KubernetesClientBootstrapConfiguration.class,
- KubernetesClientRetryBootstrapConfiguration.class, KubernetesBootstrapConfiguration.class,
- KubernetesClientConfigReloadAutoConfiguration.class)
- .web(org.springframework.boot.WebApplicationType.NONE).properties(envArray).run();
- }
-
- @AfterEach
- public void afterEach() {
- if (this.context != null) {
- this.context.close();
- this.context = null;
- }
- }
-
- @Test
- public void doesNotContainRetryableConfigMapPropertySourceLocator() throws Exception {
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
- setup("debug=true", "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.test.enable-retry=true");
- assertThat(context.containsBean("retryableConfigMapPropertySourceLocator")).isFalse();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java
deleted file mode 100644
index f5fbe2036f..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.context.ApplicationContext;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Isik Erhan
- */
-abstract class ConfigRetryDisabledButSecretsRetryEnabled {
-
- private static final String API = "/api/v1/namespaces/default/configmaps";
-
- private static final String SECRETS_API = "/api/v1/namespaces/default/secrets";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("default");
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- stubFor(get(SECRETS_API)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private KubernetesClientConfigMapPropertySourceLocator propertySourceLocator;
-
- @Autowired
- private ApplicationContext context;
-
- @Test
- void locateShouldFailWithoutRetrying() {
- propertySourceLocator = spy(propertySourceLocator);
- /*
- * Enabling secrets retry causes Spring Retry to be enabled and a
- * RetryOperationsInterceptor bean with NeverRetryPolicy for config maps to be
- * defined. ConfigMapPropertySourceLocator should not retry even Spring Retry is
- * enabled.
- */
-
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- // TODO not in bootstrap
- // assertThat(context.containsBean("kubernetesConfigRetryInterceptor")).isTrue();
- assertThatThrownBy(() -> propertySourceLocator.locate(new MockEnvironment()))
- .isInstanceOf(IllegalStateException.class).hasMessage("Internal Server Error");
-
- // verify that propertySourceLocator.locate is called only once
- verify(propertySourceLocator, times(1)).locate(any());
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java
deleted file mode 100644
index c638853f33..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.configmap_retry;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ObjectMeta;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.commons.config.ConfigMapPropertySourceLocator;
-import org.springframework.core.env.PropertySource;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-
-/**
- * @author Isik Erhan
- */
-abstract class ConfigRetryEnabled {
-
- private static final String API = "/api/v1/namespaces/default/configmaps";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("default");
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private ConfigMapPropertySourceLocator retryablePl;
-
- @Test
- void locateShouldNotRetryWhenThereIsNoFailure() {
- ConfigMapPropertySourceLocator propertySourceLocator = spy(retryablePl);
- Map data = new HashMap<>();
- data.put("some.prop", "theValue");
- data.put("some.number", "0");
-
- V1ConfigMapList configMapList = new V1ConfigMapList()
- .addItemsItem(new V1ConfigMap().metadata(new V1ObjectMeta().name("application")).data(data));
-
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(configMapList))));
-
- PropertySource> propertySource = Assertions
- .assertDoesNotThrow(() -> propertySourceLocator.locate(new MockEnvironment()));
-
- // verify locate is called only once
- WireMock.verify(1, getRequestedFor(urlEqualTo(API)));
-
- // validate the contents of the property source
- assertThat(propertySource.getProperty("some.prop")).isEqualTo("theValue");
- assertThat(propertySource.getProperty("some.number")).isEqualTo("0");
- }
-
- @Test
- void locateShouldRetryAndRecover() {
- ConfigMapPropertySourceLocator propertySourceLocator = spy(retryablePl);
- Map data = new HashMap<>();
- data.put("some.prop", "theValue");
- data.put("some.number", "0");
-
- V1ConfigMapList configMapList = new V1ConfigMapList()
- .addItemsItem(new V1ConfigMap().metadata(new V1ObjectMeta().name("application")).data(data));
-
- // fail 3 times
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs(STARTED)
- .willReturn(aResponse().withStatus(500)).willSetStateTo("Failed once"));
-
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs("Failed once")
- .willReturn(aResponse().withStatus(500)).willSetStateTo("Failed twice"));
-
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs("Failed twice")
- .willReturn(aResponse().withStatus(500)).willSetStateTo("Failed thrice"));
-
- // then succeed
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs("Failed thrice")
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(configMapList))));
-
- PropertySource> propertySource = Assertions
- .assertDoesNotThrow(() -> propertySourceLocator.locate(new MockEnvironment()));
-
- // verify the request was retried 4 times, 5 total request
- WireMock.verify(5, getRequestedFor(urlEqualTo(API)));
-
- // validate the contents of the property source
- assertThat(propertySource.getProperty("some.prop")).isEqualTo("theValue");
- assertThat(propertySource.getProperty("some.number")).isEqualTo("0");
- }
-
- @Test
- void locateShouldRetryAndFail() {
- ConfigMapPropertySourceLocator propertySourceLocator = spy(retryablePl);
- // fail all the 5 requests
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- assertThatThrownBy(() -> propertySourceLocator.locate(new MockEnvironment()))
- .isInstanceOf(IllegalStateException.class).hasMessage("Internal Server Error");
-
- // verify the request was retried 5 times
- WireMock.verify(5, getRequestedFor(urlEqualTo(API)));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java
deleted file mode 100644
index f4d3449c6c..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.reload;
-
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-import java.time.Duration;
-import java.time.OffsetDateTime;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import io.kubernetes.client.informer.EventType;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.apis.CoreV1Api;
-import io.kubernetes.client.openapi.models.V1ConfigMap;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1ListMeta;
-import io.kubernetes.client.openapi.models.V1ObjectMeta;
-import io.kubernetes.client.util.ClientBuilder;
-import io.kubernetes.client.util.Watch;
-import okhttp3.OkHttpClient;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySource;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator;
-import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider;
-import org.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadProperties;
-import org.springframework.cloud.kubernetes.commons.config.reload.ConfigurationUpdateStrategy;
-import org.springframework.mock.env.MockPropertySource;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
-import static org.awaitility.Awaitility.await;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Ryan Baxter
- */
-class KubernetesClientEventBasedConfigMapChangeDetectorTests {
-
- private static WireMockServer wireMockServer;
-
- @BeforeAll
- public static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor("localhost", wireMockServer.port());
-
- }
-
- @AfterAll
- public static void after() {
- wireMockServer.stop();
- }
-
- @AfterEach
- public void afterEach() {
- WireMock.reset();
- }
-
- @Test
- void watch() {
- GsonBuilder builder = new GsonBuilder();
- builder.excludeFieldsWithModifiers(Modifier.STATIC, Modifier.TRANSIENT, Modifier.VOLATILE)
- .registerTypeAdapter(OffsetDateTime.class, new GsonOffsetDateTimeAdapter());
- Gson gson = builder.create();
-
- Map data = new HashMap<>();
- data.put("application.properties", "spring.cloud.kubernetes.configuration.watcher.refreshDelay=0\n"
- + "logging.level.org.springframework.cloud.kubernetes=TRACE");
- Map updateData = new HashMap<>();
- updateData.put("application.properties", "spring.cloud.kubernetes.configuration.watcher.refreshDelay=1\n"
- + "logging.level.org.springframework.cloud.kubernetes=TRACE");
- V1ConfigMap applicationConfig = new V1ConfigMap().kind("ConfigMap")
- .metadata(new V1ObjectMeta().namespace("default").name("bar1")).data(data);
- V1ConfigMapList configMapList = new V1ConfigMapList().metadata(new V1ListMeta().resourceVersion("0"))
- .items(List.of(applicationConfig));
- stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch")
- .whenScenarioStateIs(STARTED).withQueryParam("watch", equalTo("false"))
- .willReturn(aResponse().withStatus(200).withBody(gson.toJson(configMapList))).willSetStateTo("update"));
-
- Watch.Response watchResponse = new Watch.Response<>(EventType.MODIFIED.name(), new V1ConfigMap()
- .kind("ConfigMap").metadata(new V1ObjectMeta().namespace("default").name("bar1")).data(updateData));
- stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch")
- .whenScenarioStateIs("update").withQueryParam("watch", equalTo("true"))
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(watchResponse)))
- .willSetStateTo("add"));
-
- stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch")
- .whenScenarioStateIs("add").withQueryParam("watch", equalTo("true"))
- .willReturn(aResponse().withStatus(200)
- .withBody(new JSON().serialize(new Watch.Response<>(EventType.ADDED.name(),
- new V1ConfigMap().kind("ConfigMap")
- .metadata(new V1ObjectMeta().namespace("default").name("bar3"))
- .putDataItem("application.properties", "debug=true")))))
- .willSetStateTo("delete"));
-
- stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch")
- .whenScenarioStateIs("delete").withQueryParam("watch", equalTo("true"))
- .willReturn(aResponse().withStatus(200)
- .withBody(new JSON().serialize(new Watch.Response<>(EventType.DELETED.name(),
- new V1ConfigMap().kind("ConfigMap")
- .metadata(new V1ObjectMeta().namespace("default").name("bar1"))
- .putDataItem("application.properties", "debug=true")))))
- .willSetStateTo("done"));
-
- stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch")
- .whenScenarioStateIs("done").withQueryParam("watch", equalTo("true"))
- .willReturn(aResponse().withStatus(200)));
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- OkHttpClient httpClient = apiClient.getHttpClient().newBuilder().readTimeout(0, TimeUnit.SECONDS).build();
- apiClient.setHttpClient(httpClient);
- CoreV1Api coreV1Api = new CoreV1Api(apiClient);
-
- int[] howMany = new int[1];
- Runnable run = () -> {
- ++howMany[0];
- };
- ConfigurationUpdateStrategy strategy = new ConfigurationUpdateStrategy("strategy", run);
-
- KubernetesMockEnvironment environment = new KubernetesMockEnvironment(
- mock(KubernetesClientConfigMapPropertySource.class)).withProperty("debug", "true");
- KubernetesClientConfigMapPropertySourceLocator locator = mock(
- KubernetesClientConfigMapPropertySourceLocator.class);
- when(locator.locate(environment)).thenAnswer(x -> new MockPropertySource().withProperty("debug", "false"));
- KubernetesNamespaceProvider kubernetesNamespaceProvider = mock(KubernetesNamespaceProvider.class);
- when(kubernetesNamespaceProvider.getNamespace()).thenReturn("default");
-
- KubernetesClientEventBasedConfigMapChangeDetector changeDetector = new KubernetesClientEventBasedConfigMapChangeDetector(
- coreV1Api, environment, ConfigReloadProperties.DEFAULT, strategy, locator, kubernetesNamespaceProvider);
-
- Thread controllerThread = new Thread(changeDetector::inform);
- controllerThread.setDaemon(true);
- controllerThread.start();
-
- await().timeout(Duration.ofSeconds(10)).pollInterval(Duration.ofSeconds(2)).until(() -> howMany[0] >= 4);
- }
-
- // This is needed when using JDK17 because GSON uses reflection to construct an
- // OffsetDateTime but that constructor
- // is protected.
- public final static class GsonOffsetDateTimeAdapter extends TypeAdapter {
-
- @Override
- public void write(JsonWriter jsonWriter, OffsetDateTime localDateTime) throws IOException {
- jsonWriter.value(OffsetDateTime.now().toString());
- }
-
- @Override
- public OffsetDateTime read(JsonReader jsonReader) {
- return OffsetDateTime.now();
- }
-
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java
deleted file mode 100644
index 98bfef6cf1..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.reload;
-
-import java.time.Duration;
-import java.util.Base64;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import com.github.tomakehurst.wiremock.matching.StringValuePattern;
-import io.kubernetes.client.informer.EventType;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.apis.CoreV1Api;
-import io.kubernetes.client.openapi.models.V1ListMeta;
-import io.kubernetes.client.openapi.models.V1ObjectMeta;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import io.kubernetes.client.util.Watch;
-import okhttp3.OkHttpClient;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySource;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider;
-import org.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadProperties;
-import org.springframework.cloud.kubernetes.commons.config.reload.ConfigurationUpdateStrategy;
-import org.springframework.mock.env.MockPropertySource;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
-import static org.awaitility.Awaitility.await;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Ryan Baxter
- */
-class KubernetesClientEventBasedSecretsChangeDetectorTests {
-
- private static final Map WATCH_FALSE = Map.of("watch", equalTo("false"));
-
- private static final Map WATCH_TRUE = Map.of("watch", equalTo("true"));
-
- private static final String SCENARIO = "watch";
-
- private static WireMockServer wireMockServer;
-
- @BeforeAll
- public static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor("localhost", wireMockServer.port());
-
- }
-
- @AfterAll
- public static void after() {
- wireMockServer.stop();
- }
-
- @AfterEach
- public void afterEach() {
- WireMock.reset();
- }
-
- @Test
- void watch() {
-
- V1Secret dbPassword = new V1Secret().metadata(new V1ObjectMeta().name("db-password"))
- .putStringDataItem("password", Base64.getEncoder().encodeToString("p455w0rd".getBytes()))
- .putDataItem("password", Base64.getEncoder().encode("p455w0rd".getBytes()))
- .putStringDataItem("username", Base64.getEncoder().encodeToString("user".getBytes()))
- .putDataItem("username", Base64.getEncoder().encode("user".getBytes()));
- V1SecretList secretList = new V1SecretList().metadata(new V1ListMeta().resourceVersion("0"))
- .items(List.of(dbPassword));
-
- V1Secret dbPasswordUpdated = new V1Secret().metadata(new V1ObjectMeta().name("db-password"))
- .putStringDataItem("password", Base64.getEncoder().encodeToString("p455w0rd2".getBytes()))
- .putDataItem("password", Base64.getEncoder().encode("p455w0rd2".getBytes()))
- .putStringDataItem("username", Base64.getEncoder().encodeToString("user".getBytes()))
- .putDataItem("username", Base64.getEncoder().encode("user".getBytes()));
- Watch.Response watchResponse = new Watch.Response<>(EventType.MODIFIED.name(), dbPasswordUpdated);
-
- stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO)
- .whenScenarioStateIs(STARTED).withQueryParams(WATCH_FALSE)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList)))
- .willSetStateTo("update"));
-
- stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO)
- .whenScenarioStateIs("update").withQueryParams(WATCH_TRUE)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(watchResponse)))
- .willSetStateTo("add"));
-
- stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO).whenScenarioStateIs("add")
- .withQueryParams(WATCH_TRUE)
- .willReturn(aResponse().withStatus(200)
- .withBody(new JSON().serialize(new Watch.Response<>(EventType.ADDED.name(),
- new V1Secret().metadata(new V1ObjectMeta().name("rabbit-password"))
- .putDataItem("rabbit-pw", Base64.getEncoder().encode("password".getBytes()))))))
- .willSetStateTo("delete"));
-
- stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO)
- .whenScenarioStateIs("delete").withQueryParams(WATCH_TRUE)
- .willReturn(aResponse().withStatus(200)
- .withBody(new JSON().serialize(new Watch.Response<>(EventType.DELETED.name(),
- new V1Secret().metadata(new V1ObjectMeta().name("rabbit-password"))
- .putDataItem("rabbit-pw", Base64.getEncoder().encode("password".getBytes()))))))
- .willSetStateTo("done"));
-
- stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario("watch").whenScenarioStateIs("done")
- .withQueryParam("watch", equalTo("true")).willReturn(aResponse().withStatus(200)));
-
- ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockServer.port()).build();
- OkHttpClient httpClient = apiClient.getHttpClient().newBuilder().readTimeout(0, TimeUnit.SECONDS).build();
- apiClient.setHttpClient(httpClient);
- CoreV1Api coreV1Api = new CoreV1Api(apiClient);
-
- int[] howMany = new int[1];
- Runnable run = () -> {
- ++howMany[0];
- };
- ConfigurationUpdateStrategy strategy = new ConfigurationUpdateStrategy("strategy", run);
-
- KubernetesMockEnvironment environment = new KubernetesMockEnvironment(
- mock(KubernetesClientSecretsPropertySource.class)).withProperty("db-password", "p455w0rd");
- KubernetesClientSecretsPropertySourceLocator locator = mock(KubernetesClientSecretsPropertySourceLocator.class);
- when(locator.locate(environment))
- .thenAnswer(ignoreMe -> new MockPropertySource().withProperty("db-password", "p455w0rd2"));
- ConfigReloadProperties properties = new ConfigReloadProperties(false, false, true,
- ConfigReloadProperties.ReloadStrategy.REFRESH, ConfigReloadProperties.ReloadDetectionMode.EVENT,
- Duration.ofMillis(15000), Set.of(), false, Duration.ofSeconds(2));
- KubernetesNamespaceProvider kubernetesNamespaceProvider = mock(KubernetesNamespaceProvider.class);
- when(kubernetesNamespaceProvider.getNamespace()).thenReturn("default");
- KubernetesClientEventBasedSecretsChangeDetector changeDetector = new KubernetesClientEventBasedSecretsChangeDetector(
- coreV1Api, environment, properties, strategy, locator, kubernetesNamespaceProvider);
-
- Thread controllerThread = new Thread(changeDetector::inform);
- controllerThread.setDaemon(true);
- controllerThread.start();
-
- await().timeout(Duration.ofSeconds(10)).pollInterval(Duration.ofSeconds(2)).until(() -> howMany[0] >= 4);
- }
-
- /**
- * both are null, treat that as no change.
- */
- @Test
- void equalsOne() {
- Map left = null;
- Map right = null;
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertTrue(result);
- }
-
- /**
- * - left is empty map - right is null
- *
- * treat as equal, that is: no change
- */
- @Test
- void equalsTwo() {
- Map left = Map.of();
- Map right = null;
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertTrue(result);
- }
-
- /**
- * - left is empty map - right is null
- *
- * treat as equal, that is: no change
- */
- @Test
- void equalsThree() {
- Map left = Map.of();
- Map right = null;
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertTrue(result);
- }
-
- /**
- * - left is null - right is empty map
- *
- * treat as equal, that is: no change
- */
- @Test
- void equalsFour() {
- Map left = null;
- Map right = Map.of();
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertTrue(result);
- }
-
- /**
- * - left is empty map - right is empty map
- *
- * treat as equal, that is: no change
- */
- @Test
- void equalsFive() {
- Map left = Map.of();
- Map right = Map.of();
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertTrue(result);
- }
-
- /**
- * - left is empty map - right is [1, b]
- *
- * treat as non-equal, that is change
- */
- @Test
- void equalsSix() {
- Map left = Map.of();
- Map right = Map.of("1", "b".getBytes());
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertFalse(result);
- }
-
- /**
- * - left is [1, a] - right is [1, b]
- *
- * treat as non-equal, that is change
- */
- @Test
- void equalsSeven() {
- Map left = Map.of("1", "a".getBytes());
- Map right = Map.of("1", "b".getBytes());
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertFalse(result);
- }
-
- /**
- * - left is [1, a, 2 aa] - right is [1, b, 2, aa]
- *
- * treat as non-equal, that is change
- */
- @Test
- void equalsEight() {
- Map left = Map.of("1", "a".getBytes(), "2", "aa".getBytes());
- Map right = Map.of("1", "b".getBytes(), "2", "aa".getBytes());
-
- boolean result = KubernetesClientEventBasedSecretsChangeDetector.equals(left, right);
- Assertions.assertFalse(result);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesMockEnvironment.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesMockEnvironment.java
deleted file mode 100644
index f951f627d2..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesMockEnvironment.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2020 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.reload;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySource;
-import org.springframework.core.env.AbstractEnvironment;
-import org.springframework.core.env.PropertySource;
-
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Ryan Baxter
- */
-public class KubernetesMockEnvironment extends AbstractEnvironment {
-
- private PropertySource propertySource = mock(KubernetesClientSecretsPropertySource.class);
-
- private Map map = new HashMap<>();
-
- public KubernetesMockEnvironment(PropertySource mockPropertySource) {
- this.propertySource = mockPropertySource;
- this.getPropertySources().addLast(this.propertySource);
- when(propertySource.getSource()).thenReturn(map);
- }
-
- public void setProperty(String key, String value) {
- map.put(key, value);
- when(propertySource.getProperty(eq(key))).thenReturn(value);
- }
-
- public KubernetesMockEnvironment withProperty(String key, String value) {
- this.setProperty(key, value);
- return this;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java
deleted file mode 100644
index e0312b4892..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.secrets_retry;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-
-import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
-import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor;
-import org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration;
-import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
-import org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientBootstrapConfiguration;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientRetryBootstrapConfiguration;
-import org.springframework.cloud.kubernetes.client.config.reload.KubernetesClientConfigReloadAutoConfiguration;
-import org.springframework.cloud.kubernetes.commons.config.KubernetesBootstrapConfiguration;
-import org.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadAutoConfiguration;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.retry.annotation.RetryConfiguration;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mockStatic;
-
-/**
- * @author Ryan Baxter
- */
-public class SecretsEnableRetryWithoutFailFastTest {
-
- private static final String API = "/api/v1/namespaces/default/configmaps";
-
- private static final String SECRETS_API = "/api/v1/namespaces/default/secrets";
-
- private ConfigurableApplicationContext context;
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- public static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- stubFor(get(SECRETS_API)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- }
-
- @AfterAll
- public static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- protected void setup(String... env) {
- List envList = (env != null) ? new ArrayList<>(Arrays.asList(env)) : new ArrayList<>();
- envList.add("spring.cloud.kubernetes.client.namespace=default");
- String[] envArray = envList.toArray(new String[0]);
-
- context = new SpringApplicationBuilder(RetryConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
- ConfigReloadAutoConfiguration.class, RefreshAutoConfiguration.class, EndpointAutoConfiguration.class,
- InfoEndpointAutoConfiguration.class, RefreshEndpointAutoConfiguration.class,
- ConfigurationPropertiesBindingPostProcessor.class,
- ConfigurationPropertiesRebinderAutoConfiguration.class, KubernetesClientBootstrapConfiguration.class,
- KubernetesClientRetryBootstrapConfiguration.class, KubernetesBootstrapConfiguration.class,
- KubernetesClientConfigReloadAutoConfiguration.class)
- .web(org.springframework.boot.WebApplicationType.NONE).properties(envArray).run();
- }
-
- @AfterEach
- public void afterEach() {
- if (this.context != null) {
- this.context.close();
- this.context = null;
- }
- }
-
- @Test
- public void doesNotContainRetryableSecretsPropertySourceLocator() throws Exception {
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
- setup("debug=true", "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.test.enable-retry=true",
- "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true");
- assertThat(context.containsBean("retryableSecretsPropertySourceLocator")).isFalse();
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastDisabled.java
deleted file mode 100644
index dd23fe1a53..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastDisabled.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.secrets_retry;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.client.namespace=default",
- "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" },
- classes = SecretsRetryApplication.class)
-class SecretsFailFastDisabled {
-
- private static final String API = "/api/v1/namespaces/default/secrets";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private KubernetesClientSecretsPropertySourceLocator psl;
-
- @Test
- void locateShouldNotRetry() {
- KubernetesClientSecretsPropertySourceLocator propertySourceLocator = spy(psl);
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- Assertions.assertDoesNotThrow(() -> propertySourceLocator.locate(new MockEnvironment()));
-
- // verify locate is called only once
- verify(propertySourceLocator, times(1)).locate(any());
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastEnabledButRetryDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastEnabledButRetryDisabled.java
deleted file mode 100644
index b536c300f5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastEnabledButRetryDisabled.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2013-2021 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.secrets_retry;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ApplicationContext;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.secrets.fail-fast=true",
- "spring.cloud.kubernetes.secrets.retry.enabled=false", "spring.cloud.kubernetes.secrets.name=my-secret",
- "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES",
- "spring.config.import=kubernetes:" },
- classes = SecretsRetryApplication.class)
-class SecretsFailFastEnabledButRetryDisabled {
-
- private static final String API = "/api/v1/namespaces/default/secrets";
-
- private static final String CONFIG_MAPS_API = "/api/v1/namespaces/default/configmaps";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("default");
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- stubFor(get(CONFIG_MAPS_API)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private KubernetesClientSecretsPropertySourceLocator psl;
-
- @Autowired
- private ApplicationContext context;
-
- @Test
- void locateShouldFailWithoutRetrying() {
- KubernetesClientSecretsPropertySourceLocator propertySourceLocator = spy(psl);
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- assertThat(context.containsBean("kubernetesSecretsRetryInterceptor")).isFalse();
- assertThatThrownBy(() -> propertySourceLocator.locate(new MockEnvironment()))
- .isInstanceOf(IllegalStateException.class).hasMessage("Internal Server Error");
-
- // verify that propertySourceLocator.locate is called only once
- verify(propertySourceLocator, times(1)).locate(any());
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryApplication.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryApplication.java
deleted file mode 100644
index 36a541b9f5..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryApplication.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.secrets_retry;
-
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-class SecretsRetryApplication {
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryDisabledButConfigRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryDisabledButConfigRetryEnabled.java
deleted file mode 100644
index 1791fef951..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryDisabledButConfigRetryEnabled.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.secrets_retry;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ConfigMapList;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator;
-import org.springframework.context.ApplicationContext;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.secrets.fail-fast=true",
- "spring.cloud.kubernetes.secrets.retry.enabled=false", "spring.cloud.kubernetes.config.fail-fast=true",
- "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" },
- classes = SecretsRetryApplication.class)
-class SecretsRetryDisabledButConfigRetryEnabled {
-
- private static final String API = "/api/v1/namespaces/default/secrets";
-
- private static final String CONFIG_MAPS_API = "/api/v1/namespaces/default/configmaps";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("default");
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- stubFor(get(CONFIG_MAPS_API)
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @AfterEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Autowired
- private KubernetesClientSecretsPropertySourceLocator psl;
-
- @Autowired
- private ApplicationContext context;
-
- @Test
- void locateShouldFailWithoutRetrying() {
- KubernetesClientSecretsPropertySourceLocator propertySourceLocator = spy(psl);
- /*
- * Enabling config retry causes Spring Retry to be enabled and a
- * RetryOperationsInterceptor bean with NeverRetryPolicy for secrets to be
- * defined. SecretsPropertySourceLocator should not retry even Spring Retry is
- * enabled.
- */
-
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- // TODO not in bootstrap
- // assertThat(context.containsBean("kubernetesSecretsRetryInterceptor")).isTrue();
- assertThatThrownBy(() -> propertySourceLocator.locate(new MockEnvironment()))
- .isInstanceOf(IllegalStateException.class).hasMessage("Internal Server Error");
-
- // verify that propertySourceLocator.locate is called only once
- verify(propertySourceLocator, times(1)).locate(any());
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabled.java
deleted file mode 100644
index bda4f7b481..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabled.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.config.secrets_retry;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-import io.kubernetes.client.openapi.JSON;
-import io.kubernetes.client.openapi.models.V1ObjectMeta;
-import io.kubernetes.client.openapi.models.V1Secret;
-import io.kubernetes.client.openapi.models.V1SecretList;
-import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
-import org.springframework.cloud.kubernetes.commons.config.SecretsPropertySourceLocator;
-import org.springframework.core.env.PropertySource;
-import org.springframework.mock.env.MockEnvironment;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.spy;
-
-/**
- * @author Isik Erhan
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
- properties = { "spring.cloud.kubernetes.secrets.fail-fast=true",
- "spring.cloud.kubernetes.secrets.retry.max-attempts=5",
- "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true",
- "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" },
- classes = SecretsRetryApplication.class)
-class SecretsRetryEnabled {
-
- private static final String API = "/api/v1/namespaces/default/secrets";
-
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
-
- clientUtilsMock = mockStatic(KubernetesClientUtils.class);
- clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
- .thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
- clientUtilsMock
- .when(() -> KubernetesClientUtils.getApplicationNamespace(Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn("default");
- stubConfigMapAndSecretsDefaults();
- }
-
- private static void stubConfigMapAndSecretsDefaults() {
- // return empty config map / secret list to not fail context creation
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList()))));
- }
-
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
- clientUtilsMock.close();
- }
-
- @Autowired
- private SecretsPropertySourceLocator psl;
-
- @BeforeEach
- void afterEach() {
- WireMock.reset();
- stubConfigMapAndSecretsDefaults();
- }
-
- @Test
- void locateShouldNotRetryWhenThereIsNoFailure() {
- SecretsPropertySourceLocator propertySourceLocator = spy(psl);
- Map data = new HashMap<>();
- data.put("some.sensitive.prop", "theSensitiveValue".getBytes());
- data.put("some.sensitive.number", "1".getBytes());
-
- V1SecretList secretList = new V1SecretList()
- .addItemsItem(new V1Secret().metadata(new V1ObjectMeta().name("my-secret")).data(data));
-
- stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList))));
-
- PropertySource> propertySource = Assertions
- .assertDoesNotThrow(() -> propertySourceLocator.locate(new MockEnvironment()));
-
- // verify locate is called only once
- WireMock.verify(1, getRequestedFor(urlEqualTo(API)));
-
- // validate the contents of the property source
- assertThat(propertySource.getProperty("some.sensitive.prop")).isEqualTo("theSensitiveValue");
- assertThat(propertySource.getProperty("some.sensitive.number")).isEqualTo("1");
- }
-
- @Test
- void locateShouldRetryAndRecover() {
- SecretsPropertySourceLocator propertySourceLocator = spy(psl);
- Map data = new HashMap<>();
- data.put("some.sensitive.prop", "theSensitiveValue".getBytes());
- data.put("some.sensitive.number", "1".getBytes());
-
- V1SecretList secretList = new V1SecretList()
- .addItemsItem(new V1Secret().metadata(new V1ObjectMeta().name("my-secret")).data(data));
-
- // fail 3 times
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs(STARTED)
- .willReturn(aResponse().withStatus(500)).willSetStateTo("Failed once"));
-
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs("Failed once")
- .willReturn(aResponse().withStatus(500)).willSetStateTo("Failed twice"));
-
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs("Failed twice")
- .willReturn(aResponse().withStatus(500)).willSetStateTo("Failed thrice"));
-
- // then succeed
- stubFor(get(API).inScenario("Retry and Recover").whenScenarioStateIs("Failed thrice")
- .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList))));
-
- PropertySource> propertySource = Assertions
- .assertDoesNotThrow(() -> propertySourceLocator.locate(new MockEnvironment()));
-
- // verify retried 4 times
- WireMock.verify(4, getRequestedFor(urlEqualTo(API)));
-
- // validate the contents of the property source
- assertThat(propertySource.getProperty("some.sensitive.prop")).isEqualTo("theSensitiveValue");
- assertThat(propertySource.getProperty("some.sensitive.number")).isEqualTo("1");
- }
-
- @Test
- void locateShouldRetryAndFail() {
- SecretsPropertySourceLocator propertySourceLocator = spy(psl);
- // fail all the 5 requests
- stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
-
- assertThatThrownBy(() -> propertySourceLocator.locate(new MockEnvironment()))
- .isInstanceOf(IllegalStateException.class).hasMessage("Internal Server Error");
-
- // verify retried 5 times until failure
- WireMock.verify(5, getRequestedFor(urlEqualTo(API)));
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/META-INF/spring.factories b/spring-cloud-kubernetes-client-config/src/test/resources/META-INF/spring.factories
deleted file mode 100644
index 00abb43956..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,14 +0,0 @@
-org.springframework.cloud.bootstrap.BootstrapConfiguration=\
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithProfileConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedConfigMapWithPrefixConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedSecretWithPrefixConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.NamedSecretWithProfileConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledSecretWithPrefixConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledSecretWithProfileConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledConfigMapWithPrefixConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.LabeledConfigMapWithProfileConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SingleSourceMultipleFilesConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.IncludeProfileSpecificSourcesConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.ConfigMapNameAsPrefixConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.boostrap.stubs.SourcesOrderConfigurationStub, \
-org.springframework.cloud.kubernetes.client.config.EnableRetryBootstrapConfiguration
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/include-profile-specific-sources.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/include-profile-specific-sources.yaml
deleted file mode 100644
index 54999aaa3a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/include-profile-specific-sources.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-spring:
- application:
- name: include-profile-specific-sources
- cloud:
- kubernetes:
- config:
- includeProfileSpecificSources: false
- namespace: spring-k8s
- sources:
- - name: config-map-one
- includeProfileSpecificSources: true
- - name: config-map-two
- includeProfileSpecificSources: false
- - name: config-map-three
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-configmap-with-prefix.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/labeled-configmap-with-prefix.yaml
deleted file mode 100644
index 40bea776b8..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-configmap-with-prefix.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-spring:
- application:
- name: labeled-configmap-with-prefix
- cloud:
- kubernetes:
- config:
- enableApi: true
- useNameAsPrefix: true
- namespace: spring-k8s
- sources:
- - labels:
- letter: a
- useNameAsPrefix: false
- - labels:
- letter: b
- explicitPrefix: two
- - labels:
- letter: c
- - labels:
- letter: d
- useNameAsPrefix: true
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-configmap-with-profile.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/labeled-configmap-with-profile.yaml
deleted file mode 100644
index 8aa88d2deb..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-configmap-with-profile.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-spring:
- application:
- name: labeled-configmap-with-profile
- cloud:
- kubernetes:
- config:
- enableApi: true
- useNameAsPrefix: true
- namespace: spring-k8s
- includeProfileSpecificSources: true
- sources:
- - labels:
- color: blue
- explicitPrefix: blue
- includeProfileSpecificSources: false
- - labels:
- color: green
- - labels:
- color: red
- - labels:
- color: yellow
- useNameAsPrefix: true
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-secret-with-prefix.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/labeled-secret-with-prefix.yaml
deleted file mode 100644
index fa6cb72d0f..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-secret-with-prefix.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-spring:
- application:
- name: labeled-secret-with-prefix
- cloud:
- kubernetes:
- secrets:
- enableApi: true
- useNameAsPrefix: true
- namespace: spring-k8s
- sources:
- - labels:
- letter: a
- useNameAsPrefix: false
- - labels:
- letter: b
- explicitPrefix: two
- - labels:
- letter: c
- - labels:
- letter: d
- useNameAsPrefix: true
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-secret-with-profile.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/labeled-secret-with-profile.yaml
deleted file mode 100644
index 89255f0810..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/labeled-secret-with-profile.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-spring:
- application:
- name: labeled-secret-with-profile
- cloud:
- kubernetes:
- secrets:
- enableApi: true
- useNameAsPrefix: true
- namespace: spring-k8s
- includeProfileSpecificSources: true
- sources:
- - labels:
- color: blue
- explicitPrefix: blue
- includeProfileSpecificSources: false
- - labels:
- color: green
- - labels:
- color: red
- - labels:
- color: yellow
- useNameAsPrefix: true
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/logback-test.xml b/spring-cloud-kubernetes-client-config/src/test/resources/logback-test.xml
deleted file mode 100644
index c947209d9a..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/named-configmap-with-prefix.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/named-configmap-with-prefix.yaml
deleted file mode 100644
index cb7bd5af86..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/named-configmap-with-prefix.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-spring:
- application:
- name: named-config-map-with-prefix
- cloud:
- kubernetes:
- config:
- useNameAsPrefix: true
- namespace: spring-k8s
- sources:
- - name: config-map-one
- useNameAsPrefix: false
- - name: config-map-two
- explicitPrefix: two
- - name: config-map-three
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/named-configmap-with-profile.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/named-configmap-with-profile.yaml
deleted file mode 100644
index da49651040..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/named-configmap-with-profile.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-spring:
- application:
- name: named-configmap-with-profile
- cloud:
- kubernetes:
- config:
- enableApi: true
- useNameAsPrefix: true
- namespace: spring-k8s
- includeProfileSpecificSources: true
- sources:
- - name: configmap-one
- useNameAsPrefix: false
- - name: configmap-two
- explicitPrefix: two
- includeProfileSpecificSources: false
- - name: configmap-three
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/named-secret-with-prefix.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/named-secret-with-prefix.yaml
deleted file mode 100644
index 8bfda9beaa..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/named-secret-with-prefix.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-spring:
- application:
- name: named-secret-with-prefix
- cloud:
- kubernetes:
- client:
- namespace: spring-k8s
- secrets:
- enableApi: true
- useNameAsPrefix: true
- sources:
- - name: secret-one
- useNameAsPrefix: false
- - name: secret-two
- explicitPrefix: two
- - name: secret-three
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/named-secret-with-profile.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/named-secret-with-profile.yaml
deleted file mode 100644
index 6d52b01f1d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/named-secret-with-profile.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-spring:
- application:
- name: named-secret-with-prefix
- cloud:
- kubernetes:
- client:
- namespace: spring-k8s
- secrets:
- enableApi: true
- useNameAsPrefix: true
- includeProfileSpecificSources: true
- sources:
- - name: secret-one
- useNameAsPrefix: false
- - name: secret-two
- explicitPrefix: two
- includeProfileSpecificSources: false
- - name: secret-three
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/retryable-sources-order.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/retryable-sources-order.yaml
deleted file mode 100644
index 06afb7ca70..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/retryable-sources-order.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-spring:
- application:
- name: sources-order
- cloud:
- kubernetes:
- secrets:
- fail-fast: true
- enabled: true
- enableApi: true
- namespace: spring-k8s
- sources:
- - name: my-secret
- config:
- fail-fast: true
- namespace: spring-k8s
- sources:
- - name: my-configmap
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/single-source-multiple-files.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/single-source-multiple-files.yaml
deleted file mode 100644
index 571e90a02d..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/single-source-multiple-files.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-spring:
- application:
- name: fruit
- cloud:
- kubernetes:
- config:
- namespace: spring-k8s
- sources:
- - name: my-configmap
diff --git a/spring-cloud-kubernetes-client-config/src/test/resources/sources-order.yaml b/spring-cloud-kubernetes-client-config/src/test/resources/sources-order.yaml
deleted file mode 100644
index c76cb73369..0000000000
--- a/spring-cloud-kubernetes-client-config/src/test/resources/sources-order.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-spring:
- application:
- name: sources-order
- cloud:
- kubernetes:
- secrets:
- enabled: true
- enableApi: true
- namespace: spring-k8s
- sources:
- - name: my-secret
- config:
- namespace: spring-k8s
- sources:
- - name: my-configmap
diff --git a/spring-cloud-kubernetes-client-discovery/.flattened-pom.xml b/spring-cloud-kubernetes-client-discovery/.flattened-pom.xml
new file mode 100644
index 0000000000..b4d4f2f5f4
--- /dev/null
+++ b/spring-cloud-kubernetes-client-discovery/.flattened-pom.xml
@@ -0,0 +1,128 @@
+
+
+ 4.0.0
+
+ org.springframework.cloud
+ spring-cloud-kubernetes
+ 3.0.4-SNAPSHOT
+
+ org.springframework.cloud
+ spring-cloud-kubernetes-client-discovery
+ 3.0.4-SNAPSHOT
+ Spring Cloud Kubernetes :: Kubernetes Client Discovery
+ Spring Cloud parent pom, managing plugins and dependencies for Spring
+ Cloud projects
+ https://cloud.spring.io/spring-cloud-kubernetes-client-discovery
+ 2017
+
+ Pivotal Software, Inc.
+ https://www.spring.io
+
+
+
+ Apache License, Version 2.0
+ https://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ dsyer
+ Dave Syer
+ dsyer at pivotal.io
+ Pivotal Software, Inc.
+ https://www.spring.io
+
+ lead
+
+
+
+ sgibb
+ Spencer Gibb
+ sgibb at pivotal.io
+ Pivotal Software, Inc.
+ https://www.spring.io
+
+ lead
+
+
+
+ mgrzejszczak
+ Marcin Grzejszczak
+ mgrzejszczak at pivotal.io
+ Pivotal Software, Inc.
+ https://www.spring.io
+
+ developer
+
+
+
+ rbaxter
+ Ryan Baxter
+ rbaxter at pivotal.io
+ Pivotal Software, Inc.
+ https://www.spring.io
+
+ developer
+
+
+
+ omaciaszeksharma
+ Olga Maciaszek-Sharma
+ omaciaszeksharma at pivotal.io
+ Pivotal Software, Inc.
+ https://www.spring.io
+
+ developer
+
+
+
+
+ scm:git:git://github.com/spring-cloud/spring-cloud-kubernetes.git/spring-cloud-kubernetes-client-discovery
+ scm:git:ssh://git@github.com/spring-cloud/spring-cloud-kubernetes.git/spring-cloud-kubernetes-client-discovery
+ https://github.com/spring-cloud/spring-cloud-kubernetes/spring-cloud-kubernetes-client-discovery
+
+
+
+ org.springframework.cloud
+ spring-cloud-kubernetes-client-autoconfig
+ 3.0.4-SNAPSHOT
+ compile
+
+
+ org.springframework.cloud
+ spring-cloud-commons
+ 4.0.4-SNAPSHOT
+ compile
+
+
+ org.springframework.boot
+ spring-boot-actuator
+ 3.0.7
+ compile
+ true
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ 3.0.7
+ compile
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+ 3.0.7
+ compile
+ true
+
+
+ org.springframework.cloud
+ spring-cloud-config-client
+ 4.0.4-SNAPSHOT
+ compile
+ true
+
+
+
diff --git a/spring-cloud-kubernetes-client-discovery/pom.xml b/spring-cloud-kubernetes-client-discovery/pom.xml
deleted file mode 100644
index db48e67fca..0000000000
--- a/spring-cloud-kubernetes-client-discovery/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
- spring-cloud-kubernetes
- org.springframework.cloud
- 3.1.0-SNAPSHOT
-
- 4.0.0
-
- spring-cloud-kubernetes-client-discovery
- Spring Cloud Kubernetes :: Kubernetes Client Discovery
-
-
-
- org.springframework.cloud
- spring-cloud-kubernetes-client-autoconfig
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-commons
- ${spring-cloud-commons.version}
-
-
- org.springframework.boot
- spring-boot-actuator
- true
-
-
- org.springframework.boot
- spring-boot-autoconfigure
- true
-
-
- org.springframework.boot
- spring-boot-starter-webflux
- true
-
-
- org.springframework.cloud
- spring-cloud-config-client
- true
-
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-web
- test
-
-
- io.projectreactor
- reactor-test
- test
-
-
- org.springframework.cloud
- spring-cloud-kubernetes-test-support
- test
-
-
- com.github.tomakehurst
- wiremock-jre8-standalone
- test
-
-
- org.springframework.cloud
- spring-cloud-kubernetes-test-support
- test
-
-
-
-
-
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnBlockingOrReactiveEnabled.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnBlockingOrReactiveEnabled.java
deleted file mode 100644
index 6bb44aa493..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnBlockingOrReactiveEnabled.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
-import org.springframework.cloud.client.ConditionalOnBlockingDiscoveryEnabled;
-import org.springframework.cloud.client.ConditionalOnReactiveDiscoveryEnabled;
-import org.springframework.context.annotation.Conditional;
-
-/**
- * Conditional that is resolved to active when either
- * {@link ConditionalOnBlockingOrReactiveEnabled} or
- * {@link ConditionalOnReactiveDiscoveryEnabled} matches.
- *
- * @author wind57
- */
-@Target({ ElementType.TYPE, ElementType.METHOD })
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-@Conditional(ConditionalOnBlockingOrReactiveEnabled.OnBlockingOrReactiveEnabled.class)
-public @interface ConditionalOnBlockingOrReactiveEnabled {
-
- class OnBlockingOrReactiveEnabled extends AnyNestedCondition {
-
- OnBlockingOrReactiveEnabled() {
- super(ConfigurationPhase.REGISTER_BEAN);
- }
-
- @ConditionalOnBlockingDiscoveryEnabled
- static class OnBlockingEnabled {
-
- }
-
- @ConditionalOnReactiveDiscoveryEnabled
- static class OnReactiveEnabled {
-
- }
-
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnSelectiveNamespacesMissing.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnSelectiveNamespacesMissing.java
deleted file mode 100644
index 5f1815d0b1..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnSelectiveNamespacesMissing.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import java.util.Set;
-
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.boot.context.properties.bind.Bindable;
-import org.springframework.boot.context.properties.bind.Binder;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.ConfigurationCondition;
-import org.springframework.core.log.LogAccessor;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Conditional that checks if our discovery is _not_ based on selective namespaces, i.e.:
- * 'spring.cloud.kubernetes.discovery.namespaces' is not set.
- *
- * @author wind57
- */
-public final class ConditionalOnSelectiveNamespacesMissing implements ConfigurationCondition {
-
- private static final LogAccessor LOG = new LogAccessor(
- LogFactory.getLog(ConditionalOnSelectiveNamespacesMissing.class));
-
- @Override
- public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
-
- Set selectiveNamespaces = Binder.get(context.getEnvironment())
- .bind("spring.cloud.kubernetes.discovery.namespaces", Bindable.setOf(String.class)).orElse(Set.of());
- boolean selectiveNamespacesMissing = selectiveNamespaces.isEmpty();
- if (selectiveNamespacesMissing) {
- LOG.debug(() -> "selective namespaces not present");
- }
- else {
- LOG.debug(() -> "found selective namespaces : " + selectiveNamespaces.stream().sorted().toList());
- }
- return selectiveNamespacesMissing;
- }
-
- @Override
- public ConfigurationPhase getConfigurationPhase() {
- return ConfigurationPhase.REGISTER_BEAN;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnSelectiveNamespacesPresent.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnSelectiveNamespacesPresent.java
deleted file mode 100644
index 6832287d74..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/ConditionalOnSelectiveNamespacesPresent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import java.util.Set;
-
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.boot.context.properties.bind.Bindable;
-import org.springframework.boot.context.properties.bind.Binder;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.ConfigurationCondition;
-import org.springframework.core.log.LogAccessor;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Conditional that checks if our discovery is based on selective namespaces, i.e.:
- * 'spring.cloud.kubernetes.discovery.namespaces' is set.
- *
- * @author wind57
- */
-public final class ConditionalOnSelectiveNamespacesPresent implements ConfigurationCondition {
-
- private static final LogAccessor LOG = new LogAccessor(
- LogFactory.getLog(ConditionalOnSelectiveNamespacesPresent.class));
-
- @Override
- public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
-
- Set selectiveNamespaces = Binder.get(context.getEnvironment())
- .bind("spring.cloud.kubernetes.discovery.namespaces", Bindable.setOf(String.class)).orElse(Set.of());
- boolean selectiveNamespacesPresent = !selectiveNamespaces.isEmpty();
- if (selectiveNamespacesPresent) {
- LOG.debug(() -> "found selective namespaces : " + selectiveNamespaces.stream().sorted().toList());
- }
- else {
- LOG.debug(() -> "selective namespaces not present");
- }
- return selectiveNamespacesPresent;
- }
-
- @Override
- public ConfigurationCondition.ConfigurationPhase getConfigurationPhase() {
- return ConfigurationPhase.REGISTER_BEAN;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapper.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapper.java
deleted file mode 100644
index 282b843817..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapper.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright 2019-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import java.util.Collections;
-import java.util.List;
-
-import io.kubernetes.client.informer.SharedIndexInformer;
-import io.kubernetes.client.informer.SharedInformerFactory;
-import io.kubernetes.client.informer.cache.Lister;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.models.V1Endpoints;
-import io.kubernetes.client.openapi.models.V1EndpointsList;
-import io.kubernetes.client.openapi.models.V1Service;
-import io.kubernetes.client.openapi.models.V1ServiceList;
-import io.kubernetes.client.util.Namespaces;
-import io.kubernetes.client.util.generic.GenericKubernetesApi;
-import org.apache.commons.logging.Log;
-
-import org.springframework.boot.BootstrapContext;
-import org.springframework.boot.BootstrapRegistry;
-import org.springframework.boot.context.properties.bind.BindHandler;
-import org.springframework.boot.context.properties.bind.Bindable;
-import org.springframework.boot.context.properties.bind.Binder;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.config.client.ConfigServerInstanceProvider;
-import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.commons.KubernetesClientProperties;
-import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider;
-import org.springframework.cloud.kubernetes.commons.config.KubernetesConfigServerBootstrapper;
-import org.springframework.cloud.kubernetes.commons.config.KubernetesConfigServerInstanceProvider;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
-import org.springframework.core.env.AbstractEnvironment;
-import org.springframework.core.env.Environment;
-import org.springframework.util.ClassUtils;
-
-import static org.springframework.cloud.kubernetes.client.KubernetesClientUtils.kubernetesApiClient;
-
-/**
- * @author Ryan Baxter
- */
-class KubernetesClientConfigServerBootstrapper extends KubernetesConfigServerBootstrapper {
-
- @Override
- public void initialize(BootstrapRegistry registry) {
- if (!ClassUtils.isPresent("org.springframework.cloud.config.client.ConfigServerInstanceProvider", null)) {
- return;
- }
- // We need to pass a lambda here rather than create a new instance of
- // ConfigServerInstanceProvider.Function
- // or else we will get ClassNotFoundExceptions if Spring Cloud Config is not on
- // the classpath
- registry.registerIfAbsent(ConfigServerInstanceProvider.Function.class, KubernetesFunction::create);
- }
-
- final static class KubernetesFunction implements ConfigServerInstanceProvider.Function {
-
- private final BootstrapContext context;
-
- private KubernetesFunction(BootstrapContext context) {
- this.context = context;
- }
-
- static KubernetesFunction create(BootstrapContext context) {
- return new KubernetesFunction(context);
- }
-
- @Override
- public List apply(String serviceId, Binder binder, BindHandler bindHandler, Log log) {
- if (binder == null || bindHandler == null || !getDiscoveryEnabled(binder, bindHandler)) {
- // If we don't have the Binder or BinderHandler from the
- // ConfigDataLocationResolverContext
- // we won't be able to create the necessary configuration
- // properties to configure the
- // Kubernetes DiscoveryClient
- return Collections.emptyList();
- }
- KubernetesDiscoveryProperties discoveryProperties = createKubernetesDiscoveryProperties(binder,
- bindHandler);
- KubernetesClientProperties clientProperties = createKubernetesClientProperties(binder, bindHandler);
- return getInstanceProvider(discoveryProperties, clientProperties, context, binder, bindHandler, log)
- .getInstances(serviceId);
- }
-
- protected KubernetesConfigServerInstanceProvider getInstanceProvider(
- KubernetesDiscoveryProperties discoveryProperties, KubernetesClientProperties clientProperties,
- BootstrapContext context, Binder binder, BindHandler bindHandler, Log log) {
- if (context.isRegistered(KubernetesInformerDiscoveryClient.class)) {
- KubernetesInformerDiscoveryClient client = context.get(KubernetesInformerDiscoveryClient.class);
- return client::getInstances;
- }
- else {
-
- ApiClient defaultApiClient = kubernetesApiClient();
- defaultApiClient.setUserAgent(binder.bind("spring.cloud.kubernetes.client.user-agent", String.class)
- .orElse(KubernetesClientProperties.DEFAULT_USER_AGENT));
- KubernetesClientAutoConfiguration clientAutoConfiguration = new KubernetesClientAutoConfiguration();
- ApiClient apiClient = context.getOrElseSupply(ApiClient.class, () -> defaultApiClient);
-
- KubernetesNamespaceProvider kubernetesNamespaceProvider = clientAutoConfiguration
- .kubernetesNamespaceProvider(getNamespaceEnvironment(binder, bindHandler));
-
- String namespace = getInformerNamespace(kubernetesNamespaceProvider, discoveryProperties);
- SharedInformerFactory sharedInformerFactory = new SharedInformerFactory(apiClient);
- final GenericKubernetesApi servicesApi = new GenericKubernetesApi<>(
- V1Service.class, V1ServiceList.class, "", "v1", "services", apiClient);
- SharedIndexInformer serviceSharedIndexInformer = sharedInformerFactory
- .sharedIndexInformerFor(servicesApi, V1Service.class, 0L, namespace);
- Lister serviceLister = new Lister<>(serviceSharedIndexInformer.getIndexer());
- final GenericKubernetesApi endpointsApi = new GenericKubernetesApi<>(
- V1Endpoints.class, V1EndpointsList.class, "", "v1", "endpoints", apiClient);
- SharedIndexInformer endpointsSharedIndexInformer = sharedInformerFactory
- .sharedIndexInformerFor(endpointsApi, V1Endpoints.class, 0L, namespace);
- Lister endpointsLister = new Lister<>(endpointsSharedIndexInformer.getIndexer());
- KubernetesInformerDiscoveryClient discoveryClient = new KubernetesInformerDiscoveryClient(
- sharedInformerFactory, serviceLister, endpointsLister, serviceSharedIndexInformer,
- endpointsSharedIndexInformer, discoveryProperties);
- try {
- discoveryClient.afterPropertiesSet();
- return discoveryClient::getInstances;
- }
- catch (Exception e) {
- if (log != null) {
- log.warn("Error initiating informer discovery client", e);
- }
- return (serviceId) -> Collections.emptyList();
- }
- finally {
- sharedInformerFactory.stopAllRegisteredInformers();
- }
- }
- }
-
- private String getInformerNamespace(KubernetesNamespaceProvider kubernetesNamespaceProvider,
- KubernetesDiscoveryProperties discoveryProperties) {
- return discoveryProperties.allNamespaces() ? Namespaces.NAMESPACE_ALL
- : kubernetesNamespaceProvider.getNamespace() == null ? Namespaces.NAMESPACE_DEFAULT
- : kubernetesNamespaceProvider.getNamespace();
- }
-
- private Environment getNamespaceEnvironment(Binder binder, BindHandler bindHandler) {
- return new AbstractEnvironment() {
- @Override
- public String getProperty(String key) {
- return binder.bind(key, Bindable.of(String.class), bindHandler).orElse(super.getProperty(key));
- }
- };
- }
-
- // This method should never be called, but is there for backward
- // compatibility purposes
- @Override
- public List apply(String serviceId) {
- return apply(serviceId, null, null, null);
- }
-
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientInformerAutoConfiguration.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientInformerAutoConfiguration.java
deleted file mode 100644
index 2b73621095..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientInformerAutoConfiguration.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import io.kubernetes.client.informer.SharedIndexInformer;
-import io.kubernetes.client.informer.SharedInformerFactory;
-import io.kubernetes.client.informer.cache.Lister;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.models.V1Endpoints;
-import io.kubernetes.client.openapi.models.V1EndpointsList;
-import io.kubernetes.client.openapi.models.V1Service;
-import io.kubernetes.client.openapi.models.V1ServiceList;
-import io.kubernetes.client.util.generic.GenericKubernetesApi;
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.AutoConfigureBefore;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.cloud.CloudPlatform;
-import org.springframework.cloud.client.CommonsClientAutoConfiguration;
-import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
-import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider;
-import org.springframework.cloud.kubernetes.commons.config.NamespaceResolutionFailedException;
-import org.springframework.cloud.kubernetes.commons.discovery.ConditionalOnKubernetesDiscoveryEnabled;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryPropertiesAutoConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.log.LogAccessor;
-
-import static io.kubernetes.client.util.Namespaces.NAMESPACE_ALL;
-import static io.kubernetes.client.util.Namespaces.NAMESPACE_DEFAULT;
-import static org.springframework.cloud.kubernetes.client.KubernetesClientUtils.getApplicationNamespace;
-
-/**
- * @author wind57
- */
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnDiscoveryEnabled
-@ConditionalOnKubernetesDiscoveryEnabled
-@ConditionalOnBlockingOrReactiveEnabled
-@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
-@Conditional(ConditionalOnSelectiveNamespacesMissing.class)
-@AutoConfigureBefore({ SimpleDiscoveryClientAutoConfiguration.class, CommonsClientAutoConfiguration.class })
-@AutoConfigureAfter({ KubernetesClientAutoConfiguration.class, KubernetesDiscoveryPropertiesAutoConfiguration.class })
-public class KubernetesClientInformerAutoConfiguration {
-
- private static final LogAccessor LOG = new LogAccessor(
- LogFactory.getLog(KubernetesClientInformerAutoConfiguration.class));
-
- @Bean
- @ConditionalOnMissingBean
- public SharedInformerFactory sharedInformerFactory(ApiClient client) {
- LOG.debug(() -> "registering sharedInformerFactory for non-selective namespaces");
- return new SharedInformerFactory(client);
- }
-
- @Bean
- public String kubernetesClientNamespace(KubernetesDiscoveryProperties properties,
- KubernetesNamespaceProvider provider) {
- String namespace;
- if (properties.allNamespaces()) {
- namespace = NAMESPACE_ALL;
- LOG.debug(() -> "serviceSharedInformer will use all-namespaces");
- }
- else {
- try {
- namespace = getApplicationNamespace(null, "kubernetes client discovery", provider);
- }
- catch (NamespaceResolutionFailedException ex) {
- LOG.warn(() -> "failed to resolve namespace, defaulting to :" + NAMESPACE_DEFAULT
- + ". This will fail in a future release.");
- namespace = NAMESPACE_DEFAULT;
- }
- LOG.debug("serviceSharedInformer will use namespace : " + namespace);
- }
-
- return namespace;
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Service.class, parameterizedContainer = SharedIndexInformer.class)
- public SharedIndexInformer servicesSharedIndexInformer(SharedInformerFactory sharedInformerFactory,
- ApiClient apiClient, String kubernetesClientNamespace) {
-
- GenericKubernetesApi servicesApi = new GenericKubernetesApi<>(V1Service.class,
- V1ServiceList.class, "", "v1", "services", apiClient);
-
- return sharedInformerFactory.sharedIndexInformerFor(servicesApi, V1Service.class, 0L,
- kubernetesClientNamespace);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Endpoints.class, parameterizedContainer = SharedIndexInformer.class)
- public SharedIndexInformer endpointsSharedIndexInformer(SharedInformerFactory sharedInformerFactory,
- ApiClient apiClient, String kubernetesClientNamespace) {
-
- GenericKubernetesApi servicesApi = new GenericKubernetesApi<>(V1Endpoints.class,
- V1EndpointsList.class, "", "v1", "endpoints", apiClient);
-
- return sharedInformerFactory.sharedIndexInformerFor(servicesApi, V1Endpoints.class, 0L,
- kubernetesClientNamespace);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Service.class, parameterizedContainer = Lister.class)
- public Lister servicesLister(SharedIndexInformer servicesSharedIndexInformer,
- String kubernetesClientNamespace) {
- return new Lister<>(servicesSharedIndexInformer.getIndexer(), kubernetesClientNamespace);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Endpoints.class, parameterizedContainer = Lister.class)
- public Lister endpointsLister(SharedIndexInformer endpointsSharedIndexInformer,
- String kubernetesClientNamespace) {
- return new Lister<>(endpointsSharedIndexInformer.getIndexer(), kubernetesClientNamespace);
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientInformerSelectiveNamespacesAutoConfiguration.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientInformerSelectiveNamespacesAutoConfiguration.java
deleted file mode 100644
index 5f44ed9b21..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientInformerSelectiveNamespacesAutoConfiguration.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.kubernetes.client.informer.SharedIndexInformer;
-import io.kubernetes.client.informer.SharedInformerFactory;
-import io.kubernetes.client.informer.cache.Lister;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.models.V1Endpoints;
-import io.kubernetes.client.openapi.models.V1EndpointsList;
-import io.kubernetes.client.openapi.models.V1Service;
-import io.kubernetes.client.openapi.models.V1ServiceList;
-import io.kubernetes.client.util.generic.GenericKubernetesApi;
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.AutoConfigureBefore;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.cloud.CloudPlatform;
-import org.springframework.cloud.client.CommonsClientAutoConfiguration;
-import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
-import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.commons.discovery.ConditionalOnKubernetesDiscoveryEnabled;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryPropertiesAutoConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.log.LogAccessor;
-
-/**
- * Auto-configuration to be used when "spring.cloud.kubernetes.discovery.namespaces" is
- * defined.
- *
- * @author wind57
- */
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnDiscoveryEnabled
-@ConditionalOnKubernetesDiscoveryEnabled
-@ConditionalOnBlockingOrReactiveEnabled
-@Conditional(ConditionalOnSelectiveNamespacesPresent.class)
-@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
-@AutoConfigureBefore({ SimpleDiscoveryClientAutoConfiguration.class, CommonsClientAutoConfiguration.class })
-@AutoConfigureAfter({ KubernetesClientAutoConfiguration.class, KubernetesDiscoveryPropertiesAutoConfiguration.class })
-public class KubernetesClientInformerSelectiveNamespacesAutoConfiguration {
-
- private static final LogAccessor LOG = new LogAccessor(
- LogFactory.getLog(KubernetesClientInformerSelectiveNamespacesAutoConfiguration.class));
-
- // we rely on the order of namespaces to enable listers, as such provide a bean of
- // namespaces
- // as a list, instead of the incoming Set.
- @Bean
- @ConditionalOnMissingBean
- public List selectiveNamespaces(KubernetesDiscoveryProperties properties) {
- List selectiveNamespaces = properties.namespaces().stream().sorted().toList();
- LOG.debug(() -> "using selective namespaces : " + selectiveNamespaces);
- return selectiveNamespaces;
- }
-
- @Bean
- @ConditionalOnMissingBean(value = SharedInformerFactory.class, parameterizedContainer = List.class)
- public List sharedInformerFactories(ApiClient apiClient, List selectiveNamespaces) {
-
- int howManyNamespaces = selectiveNamespaces.size();
- List sharedInformerFactories = new ArrayList<>(howManyNamespaces);
- for (int i = 0; i < howManyNamespaces; ++i) {
- sharedInformerFactories.add(new SharedInformerFactory(apiClient));
- }
- return sharedInformerFactories;
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Service.class,
- parameterizedContainer = { List.class, SharedIndexInformer.class })
- public List> serviceSharedIndexInformers(
- List sharedInformerFactories, List selectiveNamespaces,
- ApiClient apiClient) {
-
- int howManyNamespaces = selectiveNamespaces.size();
- List> serviceSharedIndexedInformers = new ArrayList<>(howManyNamespaces);
- for (int i = 0; i < howManyNamespaces; ++i) {
- GenericKubernetesApi servicesApi = new GenericKubernetesApi<>(V1Service.class,
- V1ServiceList.class, "", "v1", "services", apiClient);
- SharedIndexInformer sharedIndexInformer = sharedInformerFactories.get(i)
- .sharedIndexInformerFor(servicesApi, V1Service.class, 0L, selectiveNamespaces.get(i));
- serviceSharedIndexedInformers.add(sharedIndexInformer);
- }
- return serviceSharedIndexedInformers;
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Service.class, parameterizedContainer = { List.class, Lister.class })
- public List> serviceListers(List selectiveNamespaces,
- List> serviceSharedIndexInformers) {
-
- int howManyNamespaces = selectiveNamespaces.size();
- List> serviceListers = new ArrayList<>(howManyNamespaces);
-
- for (int i = 0; i < howManyNamespaces; ++i) {
- String namespace = selectiveNamespaces.get(i);
- Lister lister = new Lister<>(serviceSharedIndexInformers.get(i).getIndexer(), namespace);
- LOG.debug(() -> "registering lister (for services) in namespace : " + namespace);
- serviceListers.add(lister);
- }
-
- return serviceListers;
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Endpoints.class,
- parameterizedContainer = { List.class, SharedIndexInformer.class })
- public List> endpointsSharedIndexInformers(
- List sharedInformerFactories, List selectiveNamespaces,
- ApiClient apiClient) {
-
- int howManyNamespaces = selectiveNamespaces.size();
- List> endpointsSharedIndexedInformers = new ArrayList<>(howManyNamespaces);
- for (int i = 0; i < howManyNamespaces; ++i) {
- GenericKubernetesApi endpointsApi = new GenericKubernetesApi<>(
- V1Endpoints.class, V1EndpointsList.class, "", "v1", "endpoints", apiClient);
- SharedIndexInformer sharedIndexInformer = sharedInformerFactories.get(i)
- .sharedIndexInformerFor(endpointsApi, V1Endpoints.class, 0L, selectiveNamespaces.get(i));
- endpointsSharedIndexedInformers.add(sharedIndexInformer);
- }
- return endpointsSharedIndexedInformers;
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Endpoints.class, parameterizedContainer = { List.class, Lister.class })
- public List> endpointsListers(List selectiveNamespaces,
- List> serviceSharedIndexInformers) {
-
- int howManyNamespaces = selectiveNamespaces.size();
- List> endpointsListers = new ArrayList<>(howManyNamespaces);
-
- for (int i = 0; i < howManyNamespaces; ++i) {
- String namespace = selectiveNamespaces.get(i);
- Lister lister = new Lister<>(serviceSharedIndexInformers.get(i).getIndexer());
- LOG.debug(() -> "registering lister (for endpoints) in namespace : " + namespace);
- endpointsListers.add(lister);
- }
-
- return endpointsListers;
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientConfigClientBootstrapConfiguration.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientConfigClientBootstrapConfiguration.java
deleted file mode 100644
index 954c1c1471..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientConfigClientBootstrapConfiguration.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013-2019 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnProperty("spring.cloud.config.discovery.enabled")
-@Import({ KubernetesClientAutoConfiguration.class, KubernetesInformerDiscoveryClientAutoConfiguration.class })
-public class KubernetesDiscoveryClientConfigClientBootstrapConfiguration {
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientUtils.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientUtils.java
deleted file mode 100644
index 9e0a88aeae..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientUtils.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import java.time.Duration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Predicate;
-import java.util.function.Supplier;
-
-import io.kubernetes.client.informer.SharedInformerFactory;
-import io.kubernetes.client.informer.cache.Lister;
-import io.kubernetes.client.openapi.models.V1ObjectMeta;
-import io.kubernetes.client.openapi.models.V1Service;
-import io.kubernetes.client.openapi.models.V1ServiceSpec;
-import io.kubernetes.client.util.wait.Wait;
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
-import org.springframework.core.log.LogAccessor;
-import org.springframework.expression.Expression;
-import org.springframework.expression.spel.standard.SpelExpressionParser;
-import org.springframework.expression.spel.support.SimpleEvaluationContext;
-
-import static org.springframework.cloud.kubernetes.commons.config.ConfigUtils.keysWithPrefix;
-import static org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryConstants.NAMESPACE_METADATA_KEY;
-import static org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryConstants.SERVICE_TYPE;
-
-/**
- * @author wind57
- */
-final class KubernetesDiscoveryClientUtils {
-
- private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(KubernetesDiscoveryClientUtils.class));
-
- private static final SpelExpressionParser PARSER = new SpelExpressionParser();
-
- private static final SimpleEvaluationContext EVALUATION_CONTEXT = SimpleEvaluationContext.forReadOnlyDataBinding()
- .withInstanceMethods().build();
-
- private KubernetesDiscoveryClientUtils() {
-
- }
-
- static boolean matchesServiceLabels(V1Service service, KubernetesDiscoveryProperties properties) {
-
- Map propertiesServiceLabels = properties.serviceLabels();
- Map serviceLabels = Optional.ofNullable(service.getMetadata()).map(V1ObjectMeta::getLabels)
- .orElse(Map.of());
-
- if (propertiesServiceLabels.isEmpty()) {
- LOG.debug(() -> "service labels from properties are empty, service with name : '"
- + service.getMetadata().getName() + "' will match");
- return true;
- }
-
- if (serviceLabels.isEmpty()) {
- LOG.debug(() -> "service with name : '" + service.getMetadata().getName() + "' does not have labels");
- return false;
- }
-
- LOG.debug(() -> "Service labels from properties : " + propertiesServiceLabels);
- LOG.debug(() -> "Service labels from service : " + serviceLabels);
-
- return serviceLabels.entrySet().containsAll(propertiesServiceLabels.entrySet());
-
- }
-
- /**
- * This adds the following metadata.
- * - labels (if requested)
- * - annotations (if requested)
- * - metadata
- * - service type
- *
- */
- static Map serviceMetadata(KubernetesDiscoveryProperties properties, V1Service service,
- String serviceId) {
-
- Map serviceMetadata = new HashMap<>();
- KubernetesDiscoveryProperties.Metadata metadataProps = properties.metadata();
- if (metadataProps.addLabels()) {
- Map labelMetadata = keysWithPrefix(service.getMetadata().getLabels(),
- metadataProps.labelsPrefix());
- LOG.debug(() -> "Adding labels metadata: " + labelMetadata + " for serviceId: " + serviceId);
- serviceMetadata.putAll(labelMetadata);
- }
- if (metadataProps.addAnnotations()) {
- Map annotationMetadata = keysWithPrefix(service.getMetadata().getAnnotations(),
- metadataProps.annotationsPrefix());
- LOG.debug(() -> "Adding annotations metadata: " + annotationMetadata + " for serviceId: " + serviceId);
- serviceMetadata.putAll(annotationMetadata);
- }
-
- serviceMetadata.put(NAMESPACE_METADATA_KEY,
- Optional.ofNullable(service.getMetadata()).map(V1ObjectMeta::getNamespace).orElse(null));
- serviceMetadata.put(SERVICE_TYPE,
- Optional.ofNullable(service.getSpec()).map(V1ServiceSpec::getType).orElse(null));
-
- return serviceMetadata;
- }
-
- static Predicate filter(KubernetesDiscoveryProperties properties) {
- String spelExpression = properties.filter();
- Predicate predicate;
- if (spelExpression == null || spelExpression.isEmpty()) {
- LOG.debug(() -> "filter not defined, returning always true predicate");
- predicate = service -> true;
- }
- else {
- Expression filterExpr = PARSER.parseExpression(spelExpression);
- predicate = service -> {
- Boolean include = filterExpr.getValue(EVALUATION_CONTEXT, service, Boolean.class);
- return Optional.ofNullable(include).orElse(false);
- };
- LOG.debug(() -> "returning predicate based on filter expression: " + spelExpression);
- }
- return predicate;
- }
-
- static void postConstruct(List sharedInformerFactories,
- KubernetesDiscoveryProperties properties, Supplier informersReadyFunc,
- List> serviceListers) {
-
- sharedInformerFactories.forEach(SharedInformerFactory::startAllRegisteredInformers);
- if (!Wait.poll(Duration.ofSeconds(1), Duration.ofSeconds(properties.cacheLoadingTimeoutSeconds()), () -> {
- LOG.info(() -> "Waiting for the cache of informers to be fully loaded..");
- return informersReadyFunc.get();
- })) {
- if (properties.waitCacheReady()) {
- throw new IllegalStateException(
- "Timeout waiting for informers cache to be ready, is the kubernetes service up?");
- }
- else {
- LOG.warn(() -> "Timeout waiting for informers cache to be ready, "
- + "ignoring the failure because waitForInformerCacheReady property is false");
- }
- }
- else {
- LOG.info(() -> "Cache fully loaded (total " + serviceListers.stream().mapToLong(x -> x.list().size()).sum()
- + " services), discovery client is now available");
- }
-
- }
-
-}
diff --git a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesInformerAutoConfiguration.java b/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesInformerAutoConfiguration.java
deleted file mode 100644
index e504eb3219..0000000000
--- a/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesInformerAutoConfiguration.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2013-2023 the original author or authors.
- *
- * 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
- *
- * https://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 org.springframework.cloud.kubernetes.client.discovery;
-
-import io.kubernetes.client.informer.SharedIndexInformer;
-import io.kubernetes.client.informer.SharedInformerFactory;
-import io.kubernetes.client.informer.cache.Lister;
-import io.kubernetes.client.openapi.ApiClient;
-import io.kubernetes.client.openapi.models.V1Endpoints;
-import io.kubernetes.client.openapi.models.V1EndpointsList;
-import io.kubernetes.client.openapi.models.V1Service;
-import io.kubernetes.client.openapi.models.V1ServiceList;
-import io.kubernetes.client.util.generic.GenericKubernetesApi;
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.AutoConfigureBefore;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.cloud.CloudPlatform;
-import org.springframework.cloud.client.CommonsClientAutoConfiguration;
-import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
-import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration;
-import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider;
-import org.springframework.cloud.kubernetes.commons.discovery.ConditionalOnKubernetesDiscoveryEnabled;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
-import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryPropertiesAutoConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.log.LogAccessor;
-
-import static io.kubernetes.client.util.Namespaces.NAMESPACE_ALL;
-import static io.kubernetes.client.util.Namespaces.NAMESPACE_DEFAULT;
-
-/**
- * This configuration is not used by us internally and will be removed in a future
- * release. Use it at your own risk.
- *
- * @author wind57
- */
-@Deprecated(forRemoval = true)
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnDiscoveryEnabled
-@ConditionalOnKubernetesDiscoveryEnabled
-@ConditionalOnBlockingOrReactiveEnabled
-@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
-@Conditional(ConditionalOnSelectiveNamespacesMissing.class)
-@AutoConfigureBefore({ SimpleDiscoveryClientAutoConfiguration.class, CommonsClientAutoConfiguration.class })
-@AutoConfigureAfter({ KubernetesClientAutoConfiguration.class, KubernetesDiscoveryPropertiesAutoConfiguration.class })
-public class KubernetesInformerAutoConfiguration {
-
- private static final LogAccessor LOG = new LogAccessor(
- LogFactory.getLog(KubernetesInformerAutoConfiguration.class));
-
- @Bean
- @ConditionalOnMissingBean
- public SharedInformerFactory sharedInformerFactory(ApiClient client) {
- return new SharedInformerFactory(client);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Service.class, parameterizedContainer = SharedIndexInformer.class)
- public SharedIndexInformer servicesSharedIndexInformer(SharedInformerFactory sharedInformerFactory,
- ApiClient apiClient, KubernetesNamespaceProvider kubernetesNamespaceProvider,
- KubernetesDiscoveryProperties discoveryProperties) {
-
- GenericKubernetesApi servicesApi = new GenericKubernetesApi<>(V1Service.class,
- V1ServiceList.class, "", "v1", "services", apiClient);
-
- return sharedInformerFactory.sharedIndexInformerFor(servicesApi, V1Service.class, 0L,
- namespace(discoveryProperties, kubernetesNamespaceProvider));
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Endpoints.class, parameterizedContainer = SharedIndexInformer.class)
- public SharedIndexInformer endpointsSharedIndexInformer(SharedInformerFactory sharedInformerFactory,
- ApiClient apiClient, KubernetesNamespaceProvider kubernetesNamespaceProvider,
- KubernetesDiscoveryProperties discoveryProperties) {
-
- GenericKubernetesApi servicesApi = new GenericKubernetesApi<>(V1Endpoints.class,
- V1EndpointsList.class, "", "v1", "endpoints", apiClient);
-
- return sharedInformerFactory.sharedIndexInformerFor(servicesApi, V1Endpoints.class, 0L,
- namespace(discoveryProperties, kubernetesNamespaceProvider));
- }
-
- @Bean
- @ConditionalOnMissingBean(value = V1Service.class, parameterizedContainer = Lister.class)
- public Lister