This commit is contained in:
erabii
2024-09-09 23:30:39 +03:00
committed by GitHub
parent 31492052c5
commit cc19a5dd66
9 changed files with 9 additions and 16 deletions

View File

@@ -18,7 +18,6 @@ package org.springframework.cloud.kubernetes.client.config;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.apis.CoreV1Api;
@@ -79,7 +78,7 @@ public final class KubernetesClientConfigMapsCache implements ConfigMapCache {
return configMaps.stream()
.map(configMap -> new StrippedSourceContainer(configMap.getMetadata().getLabels(),
configMap.getMetadata().getName(), configMap.getData()))
.collect(Collectors.toList());
.toList();
}
}

View File

@@ -80,7 +80,7 @@ public class KubernetesClientSecretsCache implements SecretsCache {
return secrets.stream()
.map(secret -> new StrippedSourceContainer(secret.getMetadata().getLabels(), secret.getMetadata().getName(),
transform(secret.getData())))
.collect(Collectors.toList());
.toList();
}
private static Map<String, String> transform(Map<String, byte[]> in) {

View File

@@ -19,7 +19,6 @@ package org.springframework.cloud.kubernetes.commons.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -67,7 +66,7 @@ public record ConfigMapConfigProperties(@DefaultValue("true") boolean enableApi,
return this.sources.stream()
.flatMap(s -> s.normalize(this.name, this.namespace, this.labels, this.includeProfileSpecificSources,
this.failFast, this.useNameAsPrefix, environment))
.collect(Collectors.toList());
.toList();
}
/**

View File

@@ -19,7 +19,6 @@ package org.springframework.cloud.kubernetes.commons.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -68,7 +67,7 @@ public record SecretsConfigProperties(boolean enableApi, @DefaultValue Map<Strin
return this.sources.stream()
.flatMap(s -> s.normalize(this.name, this.namespace, this.labels, this.includeProfileSpecificSources,
this.failFast, this.useNameAsPrefix, environment))
.collect(Collectors.toList());
.toList();
}
/**

View File

@@ -18,7 +18,6 @@ package org.springframework.cloud.kubernetes.fabric8.config;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.client.KubernetesClient;
@@ -70,7 +69,7 @@ final class Fabric8ConfigMapsCache implements ConfigMapCache {
return configMaps.stream()
.map(configMap -> new StrippedSourceContainer(configMap.getMetadata().getLabels(),
configMap.getMetadata().getName(), configMap.getData()))
.collect(Collectors.toList());
.toList();
}
}

View File

@@ -18,7 +18,6 @@ package org.springframework.cloud.kubernetes.fabric8.config;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import io.fabric8.kubernetes.api.model.Secret;
import io.fabric8.kubernetes.client.KubernetesClient;
@@ -70,7 +69,7 @@ final class Fabric8SecretsCache implements SecretsCache {
return secrets.stream()
.map(secret -> new StrippedSourceContainer(secret.getMetadata().getLabels(), secret.getMetadata().getName(),
secret.getData()))
.collect(Collectors.toList());
.toList();
}
}

View File

@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import io.fabric8.kubernetes.api.model.Endpoints;
import io.fabric8.kubernetes.api.model.EndpointsBuilder;
@@ -302,7 +301,7 @@ class Fabric8KubernetesDiscoveryClientTest {
assertThat(result_endpoints.stream()
.map(Endpoints::getMetadata)
.map(ObjectMeta::getNamespace)
.collect(Collectors.toList())).containsOnly(namespace1, namespace3);
.toList()).containsOnly(namespace1, namespace3);
}
@Test

View File

@@ -20,7 +20,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import io.fabric8.kubernetes.api.model.EndpointAddress;
import io.fabric8.kubernetes.api.model.EndpointSubset;
@@ -318,7 +317,7 @@ class KubernetesCatalogWatchTest {
private EndpointsList createEndpointsListByServiceName(String namespace, String... serviceNames) {
List<Endpoints> endpoints = stream(serviceNames)
.map(s -> createEndpointsByPodName(namespace, s + "-singlePodUniqueId"))
.collect(Collectors.toList());
.toList();
EndpointsList endpointsList = new EndpointsList();
endpointsList.setItems(endpoints);

View File

@@ -86,7 +86,7 @@ public class TestsDiscovery {
// /tmp/deps.txt is created by the pipeline
private static List<String> entireClasspath() throws Exception {
try (Stream<String> lines = Files.lines(Paths.get("/tmp/deps.txt"))) {
return lines.distinct().collect(Collectors.toList());
return lines.distinct().toList();
}
}