build: Upgrade of maven plugins (#222)

* build: Upgrade of maven plugins

Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
pull/225/head
Sergii Kabashniuk 2021-12-23 14:54:46 +02:00 committed by GitHub
parent e136e366a2
commit ce7c300eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
140 changed files with 271 additions and 712 deletions

View File

@ -134,41 +134,31 @@ public class IntegrityConfigurationTest {
new MethodAnnotationsScanner());
Set<String> parameters = new HashSet<>();
parameters.addAll(
reflections
.getConstructorsWithAnyParamAnnotated(Named.class)
.stream()
reflections.getConstructorsWithAnyParamAnnotated(Named.class).stream()
.flatMap(c -> Stream.of(c.getParameters()))
.filter(p -> p.isAnnotationPresent(Named.class))
.map(p -> p.getAnnotation(Named.class).value())
.collect(Collectors.toSet()));
parameters.addAll(
reflections
.getFieldsAnnotatedWith(Named.class)
.stream()
reflections.getFieldsAnnotatedWith(Named.class).stream()
.filter(f -> f.isAnnotationPresent(Named.class))
.map(f -> f.getAnnotation(Named.class).value())
.collect(Collectors.toSet()));
parameters.addAll(
reflections
.getMethodsAnnotatedWith(ScheduleDelay.class)
.stream()
reflections.getMethodsAnnotatedWith(ScheduleDelay.class).stream()
.filter(m -> m.isAnnotationPresent(ScheduleDelay.class))
.map(m -> m.getAnnotation(ScheduleDelay.class).delayParameterName())
.collect(Collectors.toSet()));
parameters.addAll(
reflections
.getMethodsAnnotatedWith(ScheduleDelay.class)
.stream()
reflections.getMethodsAnnotatedWith(ScheduleDelay.class).stream()
.filter(m -> m.isAnnotationPresent(ScheduleDelay.class))
.map(m -> m.getAnnotation(ScheduleDelay.class).initialDelayParameterName())
.collect(Collectors.toSet()));
Set<String> unusedDeclaredConfigurationParameters =
getProperties(new File(Resources.getResource("che").getPath()))
.keySet()
.stream()
getProperties(new File(Resources.getResource("che").getPath())).keySet().stream()
.filter(k -> !parameters.contains(k))
.collect(Collectors.toSet());
Assert.assertTrue(

View File

@ -29,8 +29,7 @@ public class ServerSideRequestProcessorConfigurator
public ServerSideRequestProcessorConfigurator(
Set<RequestProcessorConfigurationProvider.Configuration> configurations) {
this.configurations =
configurations
.stream()
configurations.stream()
.collect(Collectors.toMap(Configuration::getEndpointId, Function.identity()));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -60,9 +60,7 @@ public class RemoteSubscriptionManager {
String method, Class<T> eventType, BiPredicate<T, Map<String, String>> biPredicate) {
eventService.subscribe(
event ->
remoteSubscriptionStorage
.getByMethod(method)
.stream()
remoteSubscriptionStorage.getByMethod(method).stream()
.filter(context -> biPredicate.test(event, context.getScope()))
.forEach(context -> transmit(context.getEndpointId(), method, event)),
eventType);

View File

@ -46,9 +46,7 @@ public class ApiInfoService {
public RootResourcesList listJSON(@Context ServletContext context) {
ResourceBinder binder = (ResourceBinder) context.getAttribute(ResourceBinder.class.getName());
return new RootResourcesList(
binder
.getResources()
.stream()
binder.getResources().stream()
.map(
new Function<ObjectFactory<ResourceDescriptor>, RootResource>() {
@Nullable

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -51,9 +51,7 @@ public class DefaultHttpJsonResponse implements HttpJsonResponse {
this.responseCode = responseCode;
this.headers =
unmodifiableMap(
headers
.entrySet()
.stream()
headers.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> unmodifiableList(e.getValue()))));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -55,9 +55,7 @@ public class JsonRpcEndpointIdsHolder {
}
public Set<String> getEndpointIdsByWorkspaceId(String workspaceId) {
return endpointIds
.entrySet()
.stream()
return endpointIds.entrySet().stream()
.filter(it -> it.getValue().contains(workspaceId))
.map(Map.Entry::getKey)
.collect(toSet());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -55,9 +55,7 @@ public class JsonRpcEndpointToMachineNameHolder {
}
public Set<String> getEndpointIdsByWorkspaceIdPlusMachineName(String workspaceIdPlusMachineName) {
return endpointIds
.entrySet()
.stream()
return endpointIds.entrySet().stream()
.filter(it -> it.getValue().contains(workspaceIdPlusMachineName))
.map(Map.Entry::getKey)
.collect(toSet());

View File

@ -66,8 +66,7 @@ public final class PagingUtil {
pageRefs.add(Pair.of("next", page.getNextPageRef()));
}
final UriBuilder ub = UriBuilder.fromUri(uri);
return pageRefs
.stream()
return pageRefs.stream()
.map(
refPair ->
format(

View File

@ -55,18 +55,14 @@ public class WebSocketSessionRegistry {
}
public Set<Session> getByPartialMatch(String partialEndpointId) {
return sessionsMap
.entrySet()
.stream()
return sessionsMap.entrySet().stream()
.filter(it -> it.getKey().contains(partialEndpointId))
.map(Map.Entry::getValue)
.collect(toSet());
}
public Optional<String> get(Session session) {
return sessionsMap
.entrySet()
.stream()
return sessionsMap.entrySet().stream()
.filter(entry -> entry.getValue().equals(session))
.map(Map.Entry::getKey)
.findAny();

View File

@ -187,9 +187,7 @@ public class CustomSqlMigrationResolver extends BaseMigrationResolver {
final Map<MigrationVersion, ResolvedMigration> migrations = new HashMap<>();
for (SqlScript script :
scriptsInDir
.values()
.stream()
scriptsInDir.values().stream()
.flatMap(scripts -> scripts.values().stream())
.collect(toList())) {
final ResolvedMigrationImpl migration = new ResolvedMigrationImpl();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -80,8 +80,7 @@ public class TypeScriptDtoGenerator {
List<Class<?>> annotatedWithDtos =
new ArrayList<>(reflections.getTypesAnnotatedWith(DTO.class));
List<Class<?>> interfacesDtos =
annotatedWithDtos
.stream()
annotatedWithDtos.stream()
.filter(clazz -> clazz.isInterface())
.collect(Collectors.toList());
interfacesDtos.stream().forEach(this::analyze);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -61,8 +61,7 @@ public class DtoModel {
/** Scan all getter/setter/with methods that are not inherited */
protected void analyze() {
Arrays.asList(this.dto.getMethods())
.stream()
Arrays.asList(this.dto.getMethods()).stream()
.filter(
method ->
!method.isBridge()
@ -85,9 +84,7 @@ public class DtoModel {
});
// now convert map into list
fieldAttributes
.entrySet()
.stream()
fieldAttributes.entrySet().stream()
.forEach(
field ->
fieldAttributeModels.add(

View File

@ -257,9 +257,7 @@ public class CheBootstrap extends EverrestGuiceContextListener {
@Override
protected void configure() {
Iterable<Map.Entry<Object, Object>> cheProperties =
System.getProperties()
.entrySet()
.stream()
System.getProperties().entrySet().stream()
.filter(new PropertyNamePrefixPredicate<>("che.", "codenvy."))
.collect(toList());
bindProperties(null, cheProperties);
@ -274,9 +272,7 @@ public class CheBootstrap extends EverrestGuiceContextListener {
@Override
protected void configure() {
Iterable<Map.Entry<String, String>> cheProperties =
System.getenv()
.entrySet()
.stream()
System.getenv().entrySet().stream()
.filter(new PropertyNamePrefixPredicate<>("CHE_", "CODENVY_"))
.map(new EnvironmentVariableToSystemPropertyFormatNameConverter())
.collect(toList());

View File

@ -516,7 +516,8 @@ public class IoUtil {
public static String countFileHash(File file, MessageDigest digest) throws IOException {
byte[] b = new byte[8192];
try (DigestInputStream dis = new DigestInputStream(new FileInputStream(file), digest)) {
while (dis.read(b) != -1) ;
while (dis.read(b) != -1)
;
return toHex(digest.digest());
}
}

View File

@ -909,14 +909,16 @@ public final class CronExpression implements Serializable, Cloneable {
}
protected int skipWhiteSpace(int i, String s) {
for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {;
for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {
;
}
return i;
}
protected int findNextWhiteSpace(int i, String s) {
for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {;
for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {
;
}
return i;

View File

@ -177,9 +177,7 @@ public class KubernetesPersonalAccessTokenManager implements PersonalAccessToken
private String getFirstNamespace()
throws UnsatisfiedScmPreconditionException, ScmConfigurationPersistenceException {
try {
return namespaceFactory
.list()
.stream()
return namespaceFactory.list().stream()
.map(KubernetesNamespaceMeta::getName)
.findFirst()
.orElseThrow(

View File

@ -656,10 +656,7 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
getContext().getIdentity().getWorkspaceId());
// get all the pods we care about
Set<String> podNames =
machines
.getMachines(getContext().getIdentity())
.values()
.stream()
machines.getMachines(getContext().getIdentity()).values().stream()
.filter(Objects::nonNull)
.map(KubernetesMachineImpl::getPodName)
.filter(Objects::nonNull)
@ -810,8 +807,7 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
ObjectMeta toCreateMeta,
List<Container> toCreateContainers,
Map<String, Map<String, Pod>> injectables) {
return toCreateContainers
.stream()
return toCreateContainers.stream()
.map(c -> Names.machineName(toCreateMeta, c))
.map(injectables::get)
// we're only interested in pods for which we require injection
@ -1035,9 +1031,7 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
*/
public boolean isConsistent() throws InfrastructureException {
Set<String> podNames =
getInternalMachines()
.values()
.stream()
getInternalMachines().values().stream()
.map(KubernetesMachineImpl::getPodName)
.collect(Collectors.toSet());
for (String podName : podNames) {

View File

@ -98,13 +98,7 @@ public class ContainerSearch {
return ((StatefulSet) o).getSpec().getTemplate().getSpec().getContainers().stream();
} else if (o instanceof CronJob) {
return ((CronJob) o)
.getSpec()
.getJobTemplate()
.getSpec()
.getTemplate()
.getSpec()
.getContainers()
.stream();
.getSpec().getJobTemplate().getSpec().getTemplate().getSpec().getContainers().stream();
} else if (o instanceof DeploymentConfig) {
return ((DeploymentConfig) o).getSpec().getTemplate().getSpec().getContainers().stream();
} else if (o instanceof Template) {

View File

@ -124,9 +124,7 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
componentObjects,
ImmutableMap.of(machineName, machineConfig));
workspaceConfig
.getCommands()
.stream()
workspaceConfig.getCommands().stream()
.filter(
c ->
componentAlias != null
@ -177,9 +175,7 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
dockerimageComponent.getMemoryLimit(),
dockerimageComponent.getCpuRequest(),
dockerimageComponent.getCpuLimit(),
dockerimageComponent
.getEnv()
.stream()
dockerimageComponent.getEnv().stream()
.map(e -> new EnvVar(e.getName(), e.getValue(), null))
.collect(Collectors.toCollection(ArrayList::new)),
dockerimageComponent.getCommand(),

View File

@ -165,8 +165,7 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
prepareComponentObjects(k8sComponent, componentContent);
List<PodData> podsData = getPodDatas(componentObjects);
podsData
.stream()
podsData.stream()
.flatMap(
e ->
Stream.concat(
@ -205,8 +204,7 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
}
private void applyProjectsVolumes(List<PodData> podsData, List<HasMetadata> componentObjects) {
if (componentObjects
.stream()
if (componentObjects.stream()
.noneMatch(
hasMeta ->
hasMeta instanceof PersistentVolumeClaim
@ -221,18 +219,13 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
}
for (PodData podData : podsData) {
if (podData
.getSpec()
.getVolumes()
.stream()
if (podData.getSpec().getVolumes().stream()
.noneMatch(volume -> volume.getName().equals(PROJECTS_VOLUME_NAME))) {
Volume volume = newVolume(PROJECTS_VOLUME_NAME, PROJECTS_VOLUME_NAME);
podData.getSpec().getVolumes().add(volume);
}
for (Container container : podData.getSpec().getContainers()) {
if (container
.getVolumeMounts()
.stream()
if (container.getVolumeMounts().stream()
.noneMatch(mount -> mount.getName().equals(PROJECTS_VOLUME_NAME))) {
VolumeMount volumeMount = newVolumeMount(PROJECTS_VOLUME_NAME, projectFolderPath, null);
container.getVolumeMounts().add(volumeMount);
@ -282,9 +275,7 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
for (org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl componentVolume :
component.getVolumes()) {
Optional<VolumeMount> sameNameMount =
container
.getVolumeMounts()
.stream()
container.getVolumeMounts().stream()
.filter(vm -> vm.getName().equals(componentVolume.getName()))
.findFirst();
if (sameNameMount.isPresent()
@ -299,9 +290,7 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
getIdentifiableComponentName(component),
container.getName()));
}
if (container
.getVolumeMounts()
.stream()
if (container.getVolumeMounts().stream()
.anyMatch(vm -> vm.getMountPath().equals(componentVolume.getContainerPath()))) {
throw new DevfileException(
format(
@ -365,9 +354,7 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
private void linkCommandsToMachineName(
WorkspaceConfig workspaceConfig, Component component, Set<String> machinesNames) {
List<? extends Command> componentCommands =
workspaceConfig
.getCommands()
.stream()
workspaceConfig.getCommands().stream()
.filter(
c ->
component.getAlias() != null
@ -392,14 +379,12 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
private List<PodData> getPodDatas(List<HasMetadata> componentsObjects) {
List<PodData> podsData = new ArrayList<>();
componentsObjects
.stream()
componentsObjects.stream()
.filter(hasMetadata -> hasMetadata instanceof Pod)
.map(hasMetadata -> (Pod) hasMetadata)
.forEach(p -> podsData.add(new PodData(p)));
componentsObjects
.stream()
componentsObjects.stream()
.filter(hasMetadata -> hasMetadata instanceof Deployment)
.map(hasMetadata -> (Deployment) hasMetadata)
.forEach(d -> podsData.add(new PodData(d)));

View File

@ -134,8 +134,7 @@ public class KubernetesEnvironmentProvisioner {
co ->
co instanceof PersistentVolumeClaim
&& co.getMetadata().getName().equals(PROJECTS_VOLUME_NAME)
&& envObjects
.stream()
&& envObjects.stream()
.filter(envObject -> envObject instanceof PersistentVolumeClaim)
.anyMatch(pvc -> pvc.equals(co)));
}

View File

@ -97,8 +97,7 @@ public class KubernetesRecipeParser {
clientFactory.create().load(new ByteArrayInputStream(recipeContent.getBytes())).get();
// needed because Che master namespace is set by K8s API during list loading
parsed
.stream()
parsed.stream()
.filter(o -> o.getMetadata() != null)
.forEach(o -> o.getMetadata().setNamespace(null));

View File

@ -92,9 +92,7 @@ public class KubernetesMachineImpl implements Machine {
this.status = status;
this.attributes = attributes;
this.servers =
servers
.entrySet()
.stream()
servers.entrySet().stream()
.collect(
Collectors.toMap(
Map.Entry::getKey,

View File

@ -452,9 +452,7 @@ public class KubernetesDeployments {
errorMessage.append("The following containers have terminated:\n");
errorMessage.append(
terminatedContainers
.entrySet()
.stream()
terminatedContainers.entrySet().stream()
.map(e -> e.getKey() + ": " + e.getValue())
.collect(Collectors.joining("" + "\n")));
}

View File

@ -144,8 +144,7 @@ public class KubernetesNamespaceFactory {
if (isNullOrEmpty(defaultNamespaceName)) {
throw new ConfigurationException("che.infra.kubernetes.namespace.default must be configured");
} else if (REQUIRED_NAMESPACE_NAME_PLACEHOLDERS
.stream()
} else if (REQUIRED_NAMESPACE_NAME_PLACEHOLDERS.stream()
.noneMatch(defaultNamespaceName::contains)) {
throw new ConfigurationException(
format(
@ -450,8 +449,7 @@ public class KubernetesNamespaceFactory {
List<KubernetesNamespaceMeta> labeledNamespaces = findPreparedNamespaces(resolutionCtx);
if (!labeledNamespaces.isEmpty()) {
String foundNamespace =
labeledNamespaces
.stream()
labeledNamespaces.stream()
.findFirst()
.map(KubernetesNamespaceMeta::getName)
.orElseThrow(
@ -542,8 +540,7 @@ public class KubernetesNamespaceFactory {
cheClientFactory.create().namespaces().withLabels(namespaceLabels).list().getItems();
if (!workspaceNamespaces.isEmpty()) {
Map<String, String> evaluatedAnnotations = evaluateAnnotationPlaceholders(namespaceCtx);
return workspaceNamespaces
.stream()
return workspaceNamespaces.stream()
.filter(p -> matchesAnnotations(p, evaluatedAnnotations))
.map(this::asNamespaceMeta)
.collect(Collectors.toList());

View File

@ -76,8 +76,7 @@ public class SshKeysConfigurator implements NamespaceConfigurator {
List<SshPairImpl> vcsSshPairs = getVcsSshPairs(namespaceResolutionContext);
List<String> invalidSshKeyNames =
vcsSshPairs
.stream()
vcsSshPairs.stream()
.filter(keyPair -> !isValidSshKeyPair(keyPair))
.map(SshPairImpl::getName)
.collect(toList());

View File

@ -264,10 +264,7 @@ public class CommonPVCStrategy implements WorkspaceVolumesStrategy {
}
private Set<String> combineVolumeMountsSubpaths(KubernetesEnvironment k8sEnv) {
return k8sEnv
.getPodsData()
.values()
.stream()
return k8sEnv.getPodsData().values().stream()
.flatMap(p -> p.getSpec().getContainers().stream())
.flatMap(c -> c.getVolumeMounts().stream())
.map(VolumeMount::getSubPath)

View File

@ -70,9 +70,7 @@ public class EphemeralWorkspaceAdapter {
private void replacePVCsWithEmptyDir(KubernetesEnvironment k8sEnv) {
for (PodData pod : k8sEnv.getPodsData().values()) {
PodSpec podSpec = pod.getSpec();
podSpec
.getVolumes()
.stream()
podSpec.getVolumes().stream()
.filter(v -> v.getPersistentVolumeClaim() != null)
.forEach(
v -> {

View File

@ -195,9 +195,7 @@ public class PVCProvisioner {
String pvcName = pvc.getMetadata().getName();
PodSpec podSpec = pod.getSpec();
Optional<io.fabric8.kubernetes.api.model.Volume> volumeOpt =
podSpec
.getVolumes()
.stream()
podSpec.getVolumes().stream()
.filter(
volume ->
volume.getPersistentVolumeClaim() != null

View File

@ -84,9 +84,7 @@ public class CertificateProvisioner implements ConfigurationProvisioner<Kubernet
for (PodData pod : k8sEnv.getPodsData().values()) {
if (pod.getRole() == PodRole.DEPLOYMENT) {
if (pod.getSpec()
.getVolumes()
.stream()
if (pod.getSpec().getVolumes().stream()
.noneMatch(v -> v.getName().equals(CHE_SELF_SIGNED_CERT_VOLUME))) {
pod.getSpec().getVolumes().add(buildCertSecretVolume(selfSignedCertSecretName));
}
@ -102,9 +100,7 @@ public class CertificateProvisioner implements ConfigurationProvisioner<Kubernet
}
private void provisionCertVolumeMountIfNeeded(Container container) {
if (container
.getVolumeMounts()
.stream()
if (container.getVolumeMounts().stream()
.noneMatch(vm -> vm.getName().equals(CHE_SELF_SIGNED_CERT_VOLUME))) {
container.getVolumeMounts().add(buildCertVolumeMount());
}

View File

@ -127,9 +127,7 @@ public class KubernetesTrustedCAProvisioner implements TrustedCAProvisioner {
for (PodData pod : k8sEnv.getPodsData().values()) {
if (pod.getRole() == PodRole.DEPLOYMENT) {
if (pod.getSpec()
.getVolumes()
.stream()
if (pod.getSpec().getVolumes().stream()
.noneMatch(v -> v.getName().equals(CHE_TRUST_STORE_VOLUME))) {
pod.getSpec()
.getVolumes()
@ -151,9 +149,7 @@ public class KubernetesTrustedCAProvisioner implements TrustedCAProvisioner {
}
private void provisionTrustStoreVolumeMountIfNeeded(Container container) {
if (container
.getVolumeMounts()
.stream()
if (container.getVolumeMounts().stream()
.noneMatch(vm -> vm.getName().equals(CHE_TRUST_STORE_VOLUME))) {
container
.getVolumeMounts()

View File

@ -67,8 +67,7 @@ public abstract class PreviewUrlCommandProvisioner<
List<T> exposureObjects = loadExposureObjects(namespace);
List<Service> services = namespace.services().get();
for (CommandImpl command :
env.getCommands()
.stream()
env.getCommands().stream()
.filter(c -> c.getPreviewUrl() != null)
.collect(Collectors.toList())) {
Optional<Service> foundService =

View File

@ -62,10 +62,7 @@ public class ProxySettingsProvisioner implements ConfigurationProvisioner {
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);
if (!proxyEnvVars.isEmpty()) {
k8sEnv
.getPodsData()
.entrySet()
.stream()
k8sEnv.getPodsData().entrySet().stream()
// JWTProxy container doesn't need proxy settings since it never does any outbound
// requests, and setting of it may fail accessing internal addresses.
.filter(entry -> !entry.getKey().equals(JWT_PROXY_POD_NAME))

View File

@ -124,8 +124,7 @@ public class SshKeysProvisioner implements ConfigurationProvisioner<KubernetesEn
allSshPairs.addAll(systemSshPairs);
List<String> invalidSshKeyNames =
allSshPairs
.stream()
allSshPairs.stream()
.filter(keyPair -> !isValidSshKeyPair(keyPair))
.map(SshPairImpl::getName)
.collect(toList());
@ -220,8 +219,7 @@ public class SshKeysProvisioner implements ConfigurationProvisioner<KubernetesEn
List<SshPairImpl> sshPairs, KubernetesEnvironment k8sEnv, String wsId) {
Map<String, String> data =
sshPairs
.stream()
sshPairs.stream()
.filter(sshPair -> !isNullOrEmpty(sshPair.getPrivateKey()))
.collect(
toMap(

View File

@ -108,9 +108,7 @@ public class UniqueNamesProvisioner<T extends KubernetesEnvironment>
for (Container container : pod.getSpec().getContainers()) {
// Can set env vars to key/value pairs in configmap
if (container.getEnv() != null) {
container
.getEnv()
.stream()
container.getEnv().stream()
.filter(
env ->
env.getValueFrom() != null && env.getValueFrom().getConfigMapKeyRef() != null)
@ -128,9 +126,7 @@ public class UniqueNamesProvisioner<T extends KubernetesEnvironment>
}
if (container.getEnvFrom() != null) {
// Can use all entries in configMap as env vars
container
.getEnvFrom()
.stream()
container.getEnvFrom().stream()
.filter(envFrom -> envFrom.getConfigMapRef() != null)
.forEach(
envFrom -> {
@ -145,8 +141,7 @@ public class UniqueNamesProvisioner<T extends KubernetesEnvironment>
// Next update any mounted configMaps
List<Volume> volumes = pod.getSpec().getVolumes();
if (pod.getSpec().getVolumes() != null) {
volumes
.stream()
volumes.stream()
.filter(vol -> vol.getConfigMap() != null)
.forEach(
volume -> {

View File

@ -104,9 +104,7 @@ public class VcsSslCertificateProvisioner
for (PodData pod : k8sEnv.getPodsData().values()) {
if (pod.getRole() != PodRole.INJECTABLE) {
if (pod.getSpec()
.getVolumes()
.stream()
if (pod.getSpec().getVolumes().stream()
.noneMatch(v -> v.getName().equals(CHE_GIT_SELF_SIGNED_VOLUME))) {
pod.getSpec().getVolumes().add(buildCertVolume(selfSignedCertConfigMapName));
}
@ -122,9 +120,7 @@ public class VcsSslCertificateProvisioner
}
private void provisionCertVolumeMountIfNeeded(Container container) {
if (container
.getVolumeMounts()
.stream()
if (container.getVolumeMounts().stream()
.noneMatch(vm -> vm.getName().equals(CHE_GIT_SELF_SIGNED_VOLUME))) {
container.getVolumeMounts().add(buildCertVolumeMount());
}

View File

@ -58,10 +58,7 @@ public class EnvVarsConverter implements ConfigurationProvisioner {
// we need to combine the env vars from the machine config with the variables already
// present in the container. Let's key the variables by name and use the map for merging
Map<String, EnvVar> envVars =
machineConf
.getEnv()
.entrySet()
.stream()
machineConf.getEnv().entrySet().stream()
.map(e -> new EnvVar(e.getKey(), e.getValue(), null))
.collect(toMap(EnvVar::getName, identity()));

View File

@ -94,10 +94,7 @@ public class FileSecretApplier extends KubernetesSecretApplier<KubernetesEnviron
if (!podData.getRole().equals(PodRole.DEPLOYMENT)) {
continue;
}
if (podData
.getSpec()
.getVolumes()
.stream()
if (podData.getSpec().getVolumes().stream()
.anyMatch(v -> v.getName().equals(volumeFromSecret.getName()))) {
volumeFromSecret.setName(volumeFromSecret.getName() + "_" + NameGenerator.generate("", 6));
}
@ -135,10 +132,7 @@ public class FileSecretApplier extends KubernetesSecretApplier<KubernetesEnviron
container
.getVolumeMounts()
.addAll(
secret
.getData()
.keySet()
.stream()
secret.getData().keySet().stream()
.map(
secretFile ->
buildVolumeMount(volumeFromSecret, componentMountPath, secretFile))

View File

@ -53,9 +53,7 @@ public abstract class KubernetesSecretApplier<E extends KubernetesEnvironment> {
String componentName =
internalMachineConfig.getAttributes().get(DEVFILE_COMPONENT_ALIAS_ATTRIBUTE);
if (componentName != null) {
return env.getDevfile()
.getComponents()
.stream()
return env.getDevfile().getComponents().stream()
.filter(c -> componentName.equals(c.getAlias()))
.findFirst();
}

View File

@ -336,9 +336,7 @@ public class KubernetesServerExposer<T extends KubernetesEnvironment> {
private Map<String, ServerConfig> match(
Map<String, ServerConfig> servers, ServicePort servicePort) {
int port = servicePort.getTargetPort().getIntVal();
return servers
.entrySet()
.stream()
return servers.entrySet().stream()
.filter(e -> parseInt(e.getValue().getPort().split("/")[0]) == port)
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
}
@ -356,9 +354,7 @@ public class KubernetesServerExposer<T extends KubernetesEnvironment> {
}
private void exposeInContainerIfNeeded(ServicePort servicePort) {
if (container
.getPorts()
.stream()
if (container.getPorts().stream()
.noneMatch(
p ->
p.getContainerPort().equals(servicePort.getPort())

View File

@ -59,8 +59,7 @@ public class PreviewUrlExposer<T extends KubernetesEnvironment> {
public void expose(T env) throws InternalInfrastructureException {
List<CommandImpl> previewUrlCommands =
env.getCommands()
.stream()
env.getCommands().stream()
.filter(c -> c.getPreviewUrl() != null)
.collect(Collectors.toList());

View File

@ -87,9 +87,7 @@ public class CombinedSingleHostServerExposer<T extends KubernetesEnvironment>
@Override
public Map<String, ServerConfig> getStrategyConformingServers(
Map<String, ServerConfig> externalServers) {
return externalServers
.entrySet()
.stream()
return externalServers.entrySet().stream()
.filter(e -> !e.getValue().isRequireSubdomain())
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
}
@ -97,9 +95,7 @@ public class CombinedSingleHostServerExposer<T extends KubernetesEnvironment>
@Override
public Map<String, ServerConfig> getServersRequiringSubdomain(
Map<String, ServerConfig> externalServers) {
return externalServers
.entrySet()
.stream()
return externalServers.entrySet().stream()
.filter(e -> e.getValue().isRequireSubdomain())
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
}

View File

@ -83,9 +83,7 @@ public abstract class AbstractServerResolver implements ServerResolver {
}
private Map<String, ServerImpl> resolveInternalServers(String machineName) {
return services
.get(machineName)
.stream()
return services.get(machineName).stream()
.map(this::resolveServiceServers)
.flatMap(s -> s.entrySet().stream())
.collect(Collectors.toMap(Entry::getKey, Entry::getValue, (s1, s2) -> s2));

View File

@ -54,9 +54,7 @@ public class ConfigMapServerResolver extends AbstractServerResolver {
Map<String, ServerImpl> serverMap = new HashMap<>();
serverMap.putAll(nativeServerResolver.resolveExternalServers(machineName));
serverMap.putAll(
configMaps
.get(machineName)
.stream()
configMaps.get(machineName).stream()
.map(this::fillGatewayServers)
.flatMap(m -> m.entrySet().stream())
.collect(Collectors.toMap(Entry::getKey, Entry::getValue, (s1, s2) -> s2)));

View File

@ -59,9 +59,7 @@ public class IngressServerResolver extends AbstractServerResolver {
@Override
public Map<String, ServerImpl> resolveExternalServers(String machineName) {
return ingresses
.get(machineName)
.stream()
return ingresses.get(machineName).stream()
.map(this::fillIngressServers)
.flatMap(m -> m.entrySet().stream())
.collect(Collectors.toMap(Entry::getKey, Entry::getValue, (v1, v2) -> v2));

View File

@ -29,10 +29,7 @@ public class Services {
if (service == null || service.getSpec() == null || service.getSpec().getPorts() == null) {
return Optional.empty();
}
return service
.getSpec()
.getPorts()
.stream()
return service.getSpec().getPorts().stream()
.filter(p -> p.getPort() != null && p.getPort() == port)
.findFirst();
}

View File

@ -62,10 +62,7 @@ public class UnrecoverablePodEventListenerFactory {
}
Set<String> toWatch =
environment
.getPodsData()
.values()
.stream()
environment.getPodsData().values().stream()
.map(podData -> podData.getMetadata().getName())
.collect(Collectors.toSet());

View File

@ -82,9 +82,7 @@ public class ChePluginsVolumeApplier {
PodSpec podSpec = pod.getSpec();
Optional<io.fabric8.kubernetes.api.model.Volume> volumeOpt =
podSpec
.getVolumes()
.stream()
podSpec.getVolumes().stream()
.filter(
vm ->
vm.getPersistentVolumeClaim() != null
@ -101,9 +99,7 @@ public class ChePluginsVolumeApplier {
}
private void addEmptyDirVolumeIfAbsent(PodSpec podSpec, String uniqueVolumeName) {
if (podSpec
.getVolumes()
.stream()
if (podSpec.getVolumes().stream()
.noneMatch(volume -> volume.getName().equals(uniqueVolumeName))) {
podSpec
.getVolumes()

View File

@ -180,8 +180,7 @@ public class K8sContainerResolver {
}
private List<ContainerPort> getContainerPorts() {
return containerEndpoints
.stream()
return containerEndpoints.stream()
.map(
endpoint ->
new ContainerPortBuilder()

View File

@ -55,8 +55,7 @@ public class K8sContainerResolverBuilder {
if (ports == null || ports.isEmpty()) {
return Collections.emptyList();
}
return ports
.stream()
return ports.stream()
.map(CheContainerPort::getExposedPort)
.flatMap(port -> endpoints.stream().filter(e -> e.getTargetPort() == port))
.collect(Collectors.toList());

View File

@ -136,10 +136,7 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
CommandsResolver commandsResolver = new CommandsResolver(k8sEnv);
for (ChePlugin chePlugin : chePlugins) {
Map<String, ComponentImpl> devfilePlugins =
k8sEnv
.getDevfile()
.getComponents()
.stream()
k8sEnv.getDevfile().getComponents().stream()
.filter(c -> c.getType().equals("cheEditor") || c.getType().equals("chePlugin"))
.collect(Collectors.toMap(ComponentImpl::getId, Function.identity()));
if (!devfilePlugins.containsKey(chePlugin.getId())) {
@ -192,10 +189,7 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
ChePlugin chePlugin, KubernetesEnvironment kubernetesEnvironment) {
List<EnvVar> workspaceEnv = toK8sEnvVars(chePlugin.getWorkspaceEnv());
kubernetesEnvironment
.getPodsData()
.values()
.stream()
kubernetesEnvironment.getPodsData().values().stream()
.flatMap(pod -> pod.getSpec().getContainers().stream())
.forEach(container -> container.getEnv().addAll(workspaceEnv));
}
@ -205,8 +199,7 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
if (workspaceEnv == null) {
return emptyList();
}
return workspaceEnv
.stream()
return workspaceEnv.stream()
.map(e -> new EnvVar(e.getName(), e.getValue(), null))
.collect(Collectors.toList());
}
@ -280,9 +273,7 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
org.eclipse.che.api.core.model.workspace.config.Command.MACHINE_NAME_ATTRIBUTE,
machineName));
container
.getCommands()
.stream()
container.getCommands().stream()
.map(c -> asCommand(machineName, c))
.forEach(c -> k8sEnv.getCommands().add(c));

View File

@ -145,10 +145,7 @@ public class KubernetesArtifactsBrokerApplierTest {
assertNotNull(workspaceConfigMap);
assertFalse(workspaceConfigMap.getData().isEmpty());
assertTrue(
workspaceConfigMap
.getData()
.entrySet()
.stream()
workspaceConfigMap.getData().entrySet().stream()
.allMatch(e -> brokerConfigMap.getData().get(e.getKey()).equals(e.getValue())));
}

View File

@ -1003,12 +1003,7 @@ public class KubernetesInternalRuntimeTest {
assertEquals(depls.size(), 1);
Deployment deployedPod = depls.get(0);
List<String> containerNames =
deployedPod
.getSpec()
.getTemplate()
.getSpec()
.getContainers()
.stream()
deployedPod.getSpec().getTemplate().getSpec().getContainers().stream()
.map(Container::getName)
.collect(toList());
@ -1060,12 +1055,7 @@ public class KubernetesInternalRuntimeTest {
assertEquals(depls.size(), 1);
Deployment deployedPod = depls.get(0);
List<String> containerNames =
deployedPod
.getSpec()
.getTemplate()
.getSpec()
.getContainers()
.stream()
deployedPod.getSpec().getTemplate().getSpec().getContainers().stream()
.map(Container::getName)
.collect(toList());
@ -1155,12 +1145,7 @@ public class KubernetesInternalRuntimeTest {
assertEquals(depls.size(), 1);
Deployment deployedPod = depls.get(0);
List<String> containerNames =
deployedPod
.getSpec()
.getTemplate()
.getSpec()
.getContainers()
.stream()
deployedPod.getSpec().getTemplate().getSpec().getContainers().stream()
.map(Container::getName)
.collect(toList());
@ -1528,9 +1513,7 @@ public class KubernetesInternalRuntimeTest {
@Override
public Map<String, KubernetesMachineImpl> getMachines(RuntimeIdentity runtimeIdentity) {
return machines
.entrySet()
.stream()
return machines.entrySet().stream()
.filter(e -> e.getKey().getWorkspaceId().equals(runtimeIdentity.getWorkspaceId()))
.collect(toMap(e -> e.getValue().getName(), Entry::getValue));
}

View File

@ -241,10 +241,7 @@ public class KubernetesMachinesCacheTest {
// then
Optional<KubernetesMachineImpl> machineOpt =
machineCache
.getMachines(runtimeId)
.entrySet()
.stream()
machineCache.getMachines(runtimeId).entrySet().stream()
.filter(e -> e.getKey().equals(machineName))
.map(Map.Entry::getValue)
.findAny();

View File

@ -355,8 +355,7 @@ public class ContainerSearchTest {
}
private static void assertContainsContainer(Collection<Container> containers, String name) {
containers
.stream()
containers.stream()
.filter(c -> name.equals(c.getName()))
.findAny()
.orElseThrow(

View File

@ -262,9 +262,7 @@ public class KubernetesComponentToWorkspaceApplierTest {
}
// Make sure volume is created
assertTrue(
p.getSpec()
.getVolumes()
.stream()
p.getSpec().getVolumes().stream()
.anyMatch(
v ->
v.getName().equals(PROJECTS_VOLUME_NAME)
@ -274,8 +272,7 @@ public class KubernetesComponentToWorkspaceApplierTest {
for (Container c : p.getSpec().getContainers()) {
assertEquals(c.getImagePullPolicy(), "Always");
assertTrue(
c.getVolumeMounts()
.stream()
c.getVolumeMounts().stream()
.anyMatch(
vm ->
vm.getName().equals(PROJECTS_VOLUME_NAME)
@ -308,18 +305,12 @@ public class KubernetesComponentToWorkspaceApplierTest {
for (MachineConfig config : configMaps.values()) {
assertEquals(config.getVolumes().size(), 2);
assertTrue(
config
.getVolumes()
.entrySet()
.stream()
config.getVolumes().entrySet().stream()
.anyMatch(
entry ->
entry.getKey().equals("foo") && entry.getValue().getPath().equals("/foo1")));
assertTrue(
config
.getVolumes()
.entrySet()
.stream()
config.getVolumes().entrySet().stream()
.anyMatch(
entry ->
entry.getKey().equals("bar") && entry.getValue().getPath().equals("/bar1")));
@ -423,9 +414,7 @@ public class KubernetesComponentToWorkspaceApplierTest {
verify(k8sEnvProvisioner).provision(any(), any(), any(), mapCaptor.capture());
Map<String, MachineConfigImpl> machines = mapCaptor.getValue();
assertTrue(
machines
.values()
.stream()
machines.values().stream()
.allMatch(
config ->
config
@ -809,8 +798,7 @@ public class KubernetesComponentToWorkspaceApplierTest {
}
private void replaceImagePullPolicy(KubernetesList list, String imagePullPolicy) {
list.getItems()
.stream()
list.getItems().stream()
.filter(item -> item instanceof Pod)
.map(item -> (Pod) item)
.filter(pod -> pod.getSpec() != null)

View File

@ -360,10 +360,7 @@ public class KubernetesEnvironmentFactoryTest {
PodData mergedPodData = k8sEnv.getPodsData().get("merged");
assertEquals(mergedPodData.getMetadata().getLabels().get(DEPLOYMENT_NAME_LABEL), "merged");
assertTrue(
k8sEnv
.getServices()
.values()
.stream()
k8sEnv.getServices().values().stream()
.allMatch(
s ->
ImmutableMap.of(DEPLOYMENT_NAME_LABEL, "merged")

View File

@ -277,8 +277,7 @@ public class PodMergerTest {
public void shouldBeAbleToMergeTerminationGracePeriodS(
List<Long> terminationGracePeriods, Long expectedResultLong) throws ValidationException {
List<PodData> podData =
terminationGracePeriods
.stream()
terminationGracePeriods.stream()
.map(
p ->
new PodData(

View File

@ -892,9 +892,7 @@ public class KubernetesNamespaceFactoryTest {
"exec"));
RoleBindingList bindings = k8sClient.rbac().roleBindings().inNamespace("workspace123").list();
assertEquals(
bindings
.getItems()
.stream()
bindings.getItems().stream()
.map(r -> r.getMetadata().getName())
.collect(Collectors.toSet()),
Sets.newHashSet(
@ -941,13 +939,7 @@ public class KubernetesNamespaceFactoryTest {
// then
Optional<Role> roleOptional =
k8sClient
.rbac()
.roles()
.inNamespace("workspace123")
.list()
.getItems()
.stream()
k8sClient.rbac().roles().inNamespace("workspace123").list().getItems().stream()
.filter(r -> r.getMetadata().getName().equals(SECRETS_ROLE_NAME))
.findAny();
assertTrue(roleOptional.isPresent());
@ -957,13 +949,7 @@ public class KubernetesNamespaceFactoryTest {
assertEquals(rule.getApiGroups(), singletonList(""));
assertEquals(rule.getVerbs(), Arrays.asList("get", "patch"));
assertTrue(
k8sClient
.rbac()
.roleBindings()
.inNamespace("workspace123")
.list()
.getItems()
.stream()
k8sClient.rbac().roleBindings().inNamespace("workspace123").list().getItems().stream()
.anyMatch(rb -> rb.getMetadata().getName().equals("serviceAccount-secrets")));
}
@ -1024,9 +1010,7 @@ public class KubernetesNamespaceFactoryTest {
RoleBindingList bindings = k8sClient.rbac().roleBindings().inNamespace("workspace123").list();
assertEquals(
bindings
.getItems()
.stream()
bindings.getItems().stream()
.map(r -> r.getMetadata().getName())
.collect(Collectors.toSet()),
Sets.newHashSet(

View File

@ -115,8 +115,7 @@ public class KubernetesWorkspaceServiceAccountTest {
RoleBindingList rbl = k8sClient.rbac().roleBindings().inNamespace(NAMESPACE).list();
assertTrue(
rbl.getItems()
.stream()
rbl.getItems().stream()
.anyMatch(rb -> rb.getMetadata().getName().equals(SA_NAME + "-metrics")));
}
@ -137,8 +136,7 @@ public class KubernetesWorkspaceServiceAccountTest {
RoleBindingList rbl = k8sClient.rbac().roleBindings().inNamespace(NAMESPACE).list();
assertTrue(
rbl.getItems()
.stream()
rbl.getItems().stream()
.noneMatch(rb -> rb.getMetadata().getName().equals(SA_NAME + "-metrics")));
}
@ -153,8 +151,7 @@ public class KubernetesWorkspaceServiceAccountTest {
// then
RoleList rl = k8sClient.rbac().roles().inNamespace(NAMESPACE).list();
Optional<Role> roleOptional =
rl.getItems()
.stream()
rl.getItems().stream()
.filter(r -> r.getMetadata().getName().equals(SECRETS_ROLE_NAME))
.findFirst();
assertTrue(roleOptional.isPresent());
@ -166,8 +163,7 @@ public class KubernetesWorkspaceServiceAccountTest {
RoleBindingList rbl = k8sClient.rbac().roleBindings().inNamespace(NAMESPACE).list();
assertTrue(
rbl.getItems()
.stream()
rbl.getItems().stream()
.anyMatch(rb -> rb.getMetadata().getName().equals(SA_NAME + "-secrets")));
}
@ -182,8 +178,7 @@ public class KubernetesWorkspaceServiceAccountTest {
// then
RoleList rl = k8sClient.rbac().roles().inNamespace(NAMESPACE).list();
Optional<Role> roleOptional =
rl.getItems()
.stream()
rl.getItems().stream()
.filter(r -> r.getMetadata().getName().equals(CONFIGMAPS_ROLE_NAME))
.findFirst();
assertTrue(roleOptional.isPresent());
@ -195,8 +190,7 @@ public class KubernetesWorkspaceServiceAccountTest {
RoleBindingList rbl = k8sClient.rbac().roleBindings().inNamespace(NAMESPACE).list();
assertTrue(
rbl.getItems()
.stream()
rbl.getItems().stream()
.anyMatch(rb -> rb.getMetadata().getName().equals(SA_NAME + "-configmaps")));
}
}

View File

@ -99,8 +99,7 @@ public class WorkspaceServiceAccountConfiguratorTest {
assertEquals(
roleBindings.size(),
6,
roleBindings
.stream()
roleBindings.stream()
.map(r -> r.getMetadata().getName())
.collect(joining(", "))); // exec, secrets, configmaps, view bindings + cr1, cr2
}
@ -129,8 +128,7 @@ public class WorkspaceServiceAccountConfiguratorTest {
assertEquals(
roleBindings.size(),
4,
roleBindings
.stream()
roleBindings.stream()
.map(r -> r.getMetadata().getName())
.collect(joining(", "))); // exec, secrets, configmaps, view bindings
}

View File

@ -323,9 +323,7 @@ public class PVCProvisionerTest {
private PersistentVolumeClaim findPvc(
String volumeName, Map<String, PersistentVolumeClaim> claims) {
return claims
.values()
.stream()
return claims.values().stream()
.filter(c -> volumeName.equals(c.getMetadata().getLabels().get(CHE_VOLUME_NAME_LABEL)))
.findAny()
.orElse(null);

View File

@ -68,10 +68,7 @@ public class ProxySettingsProvisionerTest {
provisioner.provision(k8sEnv, runtimeId);
assertTrue(
k8sEnv
.getPodsData()
.values()
.stream()
k8sEnv.getPodsData().values().stream()
.flatMap(pod -> pod.getSpec().getContainers().stream())
.allMatch(
container ->
@ -94,10 +91,7 @@ public class ProxySettingsProvisionerTest {
provisioner.provision(k8sEnv, runtimeId);
assertTrue(
k8sEnv
.getPodsData()
.values()
.stream()
k8sEnv.getPodsData().values().stream()
.filter(pod -> pod.getMetadata().getName().equals(JWT_PROXY_POD_NAME))
.flatMap(pod -> pod.getSpec().getContainers().stream())
.noneMatch(
@ -122,10 +116,7 @@ public class ProxySettingsProvisionerTest {
provisioner.provision(k8sEnv, runtimeId);
assertTrue(
k8sEnv
.getPodsData()
.values()
.stream()
k8sEnv.getPodsData().values().stream()
.flatMap(
pod ->
Stream.concat(

View File

@ -158,10 +158,7 @@ public class VcsSslCertificateProvisionerTest {
}
for (Pod pod :
k8sEnv
.getInjectablePodsCopy()
.values()
.stream()
k8sEnv.getInjectablePodsCopy().values().stream()
.flatMap(v -> v.values().stream())
.toArray(Pod[]::new)) {
assertTrue(pod.getSpec().getVolumes().isEmpty());

View File

@ -514,10 +514,7 @@ public class KubernetesServerExposerTest {
assertEquals(serviceAnnotations.machineName(), machineName);
// check that we did not create servers for public endpoints
assertFalse(
serviceAnnotations
.servers()
.keySet()
.stream()
serviceAnnotations.servers().keySet().stream()
.anyMatch(key -> expectedServers.containsKey(key)));
verify(externalServerExposer)
@ -547,10 +544,7 @@ public class KubernetesServerExposerTest {
// ensure that no service port is exposed
assertTrue(
service
.getSpec()
.getPorts()
.stream()
service.getSpec().getPorts().stream()
.noneMatch(p -> p.getTargetPort().getIntVal().equals(port)));
ServicePort servicePort =
@ -600,9 +594,7 @@ public class KubernetesServerExposerTest {
private void assertThatContainerPortIsExposed(String portProtocol, Integer port) {
assertTrue(
container
.getPorts()
.stream()
container.getPorts().stream()
.anyMatch(
p ->
p.getContainerPort().equals(port)
@ -622,10 +614,7 @@ public class KubernetesServerExposerTest {
private ServicePort assertThatServicePortIsExposed(Integer port, Service service) {
Optional<ServicePort> servicePortOpt =
service
.getSpec()
.getPorts()
.stream()
service.getSpec().getPorts().stream()
.filter(p -> p.getTargetPort().getIntVal().equals(port))
.findAny();
assertTrue(servicePortOpt.isPresent());

View File

@ -167,17 +167,13 @@ public class K8sContainerResolverTest {
}
private List<EnvVar> toSidecarEnvVars(Map<String, String> envVars) {
return envVars
.entrySet()
.stream()
return envVars.entrySet().stream()
.map(entry -> new EnvVar().name(entry.getKey()).value(entry.getValue()))
.collect(Collectors.toList());
}
private List<io.fabric8.kubernetes.api.model.EnvVar> toK8sEnvVars(Map<String, String> envVars) {
return envVars
.entrySet()
.stream()
return envVars.entrySet().stream()
.map(
entry ->
new io.fabric8.kubernetes.api.model.EnvVar(entry.getKey(), entry.getValue(), null))

View File

@ -966,8 +966,7 @@ public class KubernetesPluginsToolingApplierTest {
Collection<InternalMachineConfig> machineConfigs, int numberOfMachines, int numberOfVolumes) {
long numberOfMatchingMachines =
machineConfigs
.stream()
machineConfigs.stream()
.filter(machineConfig -> machineConfig.getVolumes().size() == numberOfVolumes)
.count();
assertEquals(numberOfMatchingMachines, numberOfMachines);
@ -1002,9 +1001,7 @@ public class KubernetesPluginsToolingApplierTest {
InternalEnvironment internalEnvironment) {
Map<String, InternalMachineConfig> machines = internalEnvironment.getMachines();
Map<String, InternalMachineConfig> nonUserMachines =
machines
.entrySet()
.stream()
machines.entrySet().stream()
.filter(entry -> !USER_MACHINE_NAME.equals(entry.getKey()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
return nonUserMachines.values();
@ -1019,9 +1016,7 @@ public class KubernetesPluginsToolingApplierTest {
private List<Container> getNonUserContainers(KubernetesEnvironment kubernetesEnvironment) {
Pod pod = kubernetesEnvironment.getPodsCopy().values().iterator().next();
return pod.getSpec()
.getContainers()
.stream()
return pod.getSpec().getContainers().stream()
.filter(container -> userContainer != container)
.collect(Collectors.toList());
}
@ -1057,8 +1052,7 @@ public class KubernetesPluginsToolingApplierTest {
.targetPort(port);
plugin.getEndpoints().add(endpoint);
List<CheContainerPort> ports = plugin.getContainers().get(0).getPorts();
if (ports
.stream()
if (ports.stream()
.map(CheContainerPort::getExposedPort)
.noneMatch(integer -> integer == port)) {
ports.add(new CheContainerPort().exposedPort(port));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -117,8 +117,7 @@ public class SidecarServicesProvisionerTest {
}
private Map<String, Service> toK8sServices(List<ChePluginEndpoint> endpoints) {
return endpoints
.stream()
return endpoints.stream()
.map(this::createService)
.collect(toMap(s -> s.getMetadata().getName(), Function.identity()));
}

View File

@ -118,10 +118,7 @@ public class BrokerEnvironmentFactoryTest {
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers =
brokersConfigs
.pods
.values()
.stream()
brokersConfigs.pods.values().stream()
.flatMap(p -> p.getSpec().getContainers().stream())
.collect(Collectors.toList());
assertEquals(containers.size(), 1);
@ -160,10 +157,7 @@ public class BrokerEnvironmentFactoryTest {
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers =
brokersConfigs
.pods
.values()
.stream()
brokersConfigs.pods.values().stream()
.flatMap(p -> p.getSpec().getContainers().stream())
.collect(Collectors.toList());
assertEquals(containers.size(), 1);
@ -200,10 +194,7 @@ public class BrokerEnvironmentFactoryTest {
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers =
brokersConfigs
.pods
.values()
.stream()
brokersConfigs.pods.values().stream()
.flatMap(p -> p.getSpec().getContainers().stream())
.collect(Collectors.toList());
assertEquals(containers.size(), 1);
@ -225,10 +216,7 @@ public class BrokerEnvironmentFactoryTest {
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers =
brokersConfigs
.pods
.values()
.stream()
brokersConfigs.pods.values().stream()
.flatMap(p -> p.getSpec().getContainers().stream())
.collect(Collectors.toList());
assertEquals(containers.size(), 1);
@ -394,10 +382,7 @@ public class BrokerEnvironmentFactoryTest {
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers =
brokersConfigs
.pods
.values()
.stream()
brokersConfigs.pods.values().stream()
.flatMap(p -> p.getSpec().getContainers().stream())
.collect(Collectors.toList());
assertEquals(containers.size(), 1);

View File

@ -40,9 +40,7 @@ public class OpenShiftEnvironmentValidator extends KubernetesEnvironmentValidato
private void validateRoutesMatchServices(OpenShiftEnvironment env) throws ValidationException {
Set<String> recipeServices =
env.getServices()
.values()
.stream()
env.getServices().values().stream()
.map(s -> s.getMetadata().getName())
.collect(Collectors.toSet());
for (Route route : env.getRoutes().values()) {

View File

@ -193,8 +193,7 @@ public class OpenShiftProjectFactory extends KubernetesNamespaceFactory {
clientFactory.createOC().projects().withLabels(namespaceLabels).list().getItems();
if (!workspaceProjects.isEmpty()) {
Map<String, String> evaluatedAnnotations = evaluateAnnotationPlaceholders(namespaceCtx);
return workspaceProjects
.stream()
return workspaceProjects.stream()
.filter(p -> matchesAnnotations(p, evaluatedAnnotations))
.map(this::asNamespaceMeta)
.collect(Collectors.toList());

View File

@ -52,9 +52,7 @@ public class RouteServerResolver extends AbstractServerResolver {
@Override
public Map<String, ServerImpl> resolveExternalServers(String machineName) {
return routes
.get(machineName)
.stream()
return routes.get(machineName).stream()
.map(r -> resolveRouteServers(machineName, r))
.flatMap(m -> m.entrySet().stream())
.collect(Collectors.toMap(Entry::getKey, Entry::getValue, (v1, v2) -> v2));

View File

@ -360,10 +360,7 @@ public class OpenShiftEnvironmentFactoryTest {
PodData mergedPodData = k8sEnv.getPodsData().get("merged");
assertEquals(mergedPodData.getMetadata().getLabels().get(DEPLOYMENT_NAME_LABEL), "merged");
assertTrue(
k8sEnv
.getServices()
.values()
.stream()
k8sEnv.getServices().values().stream()
.allMatch(
s ->
ImmutableMap.of(DEPLOYMENT_NAME_LABEL, "merged")

View File

@ -166,9 +166,7 @@ public class OpenshiftTrustedCAProvisionerTest {
assertEquals(podSpec.getVolumes().size(), 1);
assertEquals(podSpec.getVolumes().get(0).getConfigMap().getName(), CONFIGMAP_NAME);
assertTrue(
podSpec
.getContainers()
.stream()
podSpec.getContainers().stream()
.allMatch(
c -> c.getVolumeMounts().get(0).getMountPath().equals(CERTIFICATE_MOUNT_PATH)));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -50,9 +50,7 @@ public final class DtoConverter {
return newDto(OrganizationDistributedResourcesDto.class)
.withOrganizationId(distributedResources.getOrganizationId())
.withResourcesCap(
distributedResources
.getResourcesCap()
.stream()
distributedResources.getResourcesCap().stream()
.map(org.eclipse.che.multiuser.resource.api.DtoConverter::asDto)
.collect(Collectors.toList()));
}

View File

@ -134,9 +134,7 @@ public class OrganizationResourcesDistributionService extends Service {
@Parameter(description = "Suborganization id") @PathParam("suborganizationId")
String suborganization)
throws NotFoundException, ConflictException, ServerException {
return resourcesDistributor
.getResourcesCaps(suborganization)
.stream()
return resourcesDistributor.getResourcesCaps(suborganization).stream()
.map(org.eclipse.che.multiuser.resource.api.DtoConverter::asDto)
.collect(toList());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -182,9 +182,7 @@ public class OrganizationResourcesDistributor {
String suborganizationId, List<? extends Resource> newResourcesCap)
throws NotFoundException, ConflictException, ServerException {
Map<String, Resource> usedResources =
resourceManager
.getUsedResources(suborganizationId)
.stream()
resourceManager.getUsedResources(suborganizationId).stream()
.collect(Collectors.toMap(Resource::getType, Function.identity()));
for (Resource resourceToCheck : newResourcesCap) {
Resource usedResource = usedResources.get(resourceToCheck.getType());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -136,8 +136,7 @@ public class OrganizationalAccountAvailableResourcesProvider implements Availabl
/** Returns formatted string for list of resources. */
private static String format(Collection<? extends Resource> resources) {
return '['
+ resources
.stream()
+ resources.stream()
.map(
resource -> resource.getAmount() + resource.getUnit() + " of " + resource.getType())
.collect(Collectors.joining(", "))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -106,8 +106,7 @@ public class SuborganizationResourcesProvider implements ResourcesProvider {
Collection<? extends Resource> source, List<? extends Resource> caps) {
final Map<String, Resource> resourcesCaps =
caps.stream().collect(toMap(Resource::getType, Function.identity()));
return source
.stream()
return source.stream()
.map(
resource -> {
Resource resourceCap = resourcesCaps.get(resource.getType());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -93,8 +93,7 @@ public class JpaOrganizationDistributedResourcesDao implements OrganizationDistr
.setParameter("parent", organizationId)
.getSingleResult();
return new Page<>(
distributedResources
.stream()
distributedResources.stream()
.map(OrganizationDistributedResourcesImpl::new)
.collect(Collectors.toList()),
skipCount,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -244,8 +244,7 @@ public class PermissionsManager {
throws ConflictException {
final Set<String> allowedActions = new HashSet<>(domain.getAllowedActions());
final Set<String> unsupportedActions =
actions
.stream()
actions.stream()
.filter(action -> !allowedActions.contains(action))
.collect(Collectors.toSet());
if (!unsupportedActions.isEmpty()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -48,15 +48,11 @@ public final class DtoConverter {
return DtoFactory.newDto(ResourcesDetailsDto.class)
.withAccountId(resourcesDetails.getAccountId())
.withTotalResources(
resourcesDetails
.getTotalResources()
.stream()
resourcesDetails.getTotalResources().stream()
.map(DtoConverter::asDto)
.collect(Collectors.toList()))
.withProvidedResources(
resourcesDetails
.getProvidedResources()
.stream()
resourcesDetails.getProvidedResources().stream()
.map(DtoConverter::asDto)
.collect(Collectors.toList()));
}
@ -69,9 +65,7 @@ public final class DtoConverter {
.withEndTime(providedResources.getEndTime())
.withProviderId(providedResources.getProviderId())
.withResources(
providedResources
.getResources()
.stream()
providedResources.getResources().stream()
.map(DtoConverter::asDto)
.collect(Collectors.toList()));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -78,8 +78,7 @@ public class NoEnoughResourcesException extends Exception {
private String resourcesToString(List<? extends Resource> resources) {
return '['
+ resources
.stream()
+ resources.stream()
.map(resource -> resource.getAmount() + resource.getUnit() + " " + resource.getType())
.collect(Collectors.joining(", "))
+ ']';

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -61,8 +61,7 @@ public class FreeResourcesProvider implements ResourcesProvider {
this.freeResourcesLimitManager = freeResourcesLimitManager;
this.accountManager = accountManager;
this.defaultResourcesProviders =
defaultResourcesProviders
.stream()
defaultResourcesProviders.stream()
.collect(toMap(DefaultResourcesProvider::getAccountType, Function.identity()));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -36,12 +36,10 @@ public class ResourceValidator {
@Inject
public ResourceValidator(Set<ResourceType> supportedResources) {
this.resourcesTypesToUnits =
supportedResources
.stream()
supportedResources.stream()
.collect(toMap(ResourceType::getId, ResourceType::getSupportedUnits));
this.resourcesTypesToDefaultUnit =
supportedResources
.stream()
supportedResources.stream()
.collect(toMap(ResourceType::getId, ResourceType::getDefaultUnit));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -73,8 +73,7 @@ public class DefaultAvailableResourcesProvider implements AvailableResourcesProv
/** Returns formatted string for list of resources. */
private static String format(Collection<? extends Resource> resources) {
return '['
+ resources
.stream()
+ resources.stream()
.map(
resource -> resource.getAmount() + resource.getUnit() + " of " + resource.getType())
.collect(Collectors.joining(", "))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -147,8 +147,7 @@ public class ResourceManager {
}
final List<Resource> allResources =
resources
.stream()
resources.stream()
.flatMap(providedResources -> providedResources.getResources().stream())
.collect(Collectors.toList());

View File

@ -70,9 +70,7 @@ public class ResourceService extends Service {
public List<ResourceDto> getTotalResources(
@Parameter(description = "Account id") @PathParam("accountId") String accountId)
throws NotFoundException, ServerException, ConflictException {
return resourceManager
.getTotalResources(accountId)
.stream()
return resourceManager.getTotalResources(accountId).stream()
.map(DtoConverter::asDto)
.collect(Collectors.toList());
}
@ -94,9 +92,7 @@ public class ResourceService extends Service {
})
public List<ResourceDto> getAvailableResources(@PathParam("accountId") String accountId)
throws NotFoundException, ServerException {
return resourceManager
.getAvailableResources(accountId)
.stream()
return resourceManager.getAvailableResources(accountId).stream()
.map(DtoConverter::asDto)
.collect(Collectors.toList());
}
@ -118,9 +114,7 @@ public class ResourceService extends Service {
})
public List<ResourceDto> getUsedResources(@PathParam("accountId") String accountId)
throws NotFoundException, ServerException {
return resourceManager
.getUsedResources(accountId)
.stream()
return resourceManager.getUsedResources(accountId).stream()
.map(DtoConverter::asDto)
.collect(Collectors.toList());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -52,8 +52,7 @@ public class ResourcesLocks {
this.accountManager = accountManager;
this.stripedLocks = new StripedLocks(16);
this.accountTypeToLockProvider =
resourceLockKeyProviders
.stream()
resourceLockKeyProviders.stream()
.collect(
Collectors.toMap(ResourceLockKeyProvider::getAccountType, Function.identity()));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2021 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@ -52,10 +52,7 @@ public class EnvironmentRamCalculator {
return 0;
}
try {
return getInternalEnvironment(environment)
.getMachines()
.values()
.stream()
return getInternalEnvironment(environment).getMachines().values().stream()
.mapToLong(
m -> parseMemoryAttributeValue(m.getAttributes().get(MEMORY_LIMIT_ATTRIBUTE)))
.sum()
@ -71,10 +68,7 @@ public class EnvironmentRamCalculator {
* @return summary RAM of all machines in runtime in megabytes
*/
public long calculate(Runtime runtime) {
return runtime
.getMachines()
.values()
.stream()
return runtime.getMachines().values().stream()
.mapToLong(
m -> parseMemoryAttributeValue(m.getAttributes().get(MEMORY_LIMIT_ATTRIBUTE)))
.sum()

View File

@ -77,8 +77,7 @@ public class MultiUserWorkspaceActivityManager extends WorkspaceActivityManager
return defaultTimeout;
}
Optional<? extends Resource> timeoutOpt =
availableResources
.stream()
availableResources.stream()
.filter(resource -> TimeoutResourceType.ID.equals(resource.getType()))
.findAny();

View File

@ -224,8 +224,7 @@ public class MultiuserMySqlTckModule extends TckModule {
@Override
public void createAll(Collection<? extends UserImpl> entities) throws TckRepositoryException {
final EntityManager manager = managerProvider.get();
entities
.stream()
entities.stream()
.map(
user ->
new UserImpl(

View File

@ -223,8 +223,7 @@ public class MultiuserPostgresqlTckModule extends TckModule {
@Override
public void createAll(Collection<? extends UserImpl> entities) throws TckRepositoryException {
final EntityManager manager = managerProvider.get();
entities
.stream()
entities.stream()
.map(
user ->
new UserImpl(

View File

@ -65,8 +65,7 @@ public class JpaUserDevfilePermissionDao
@Override
public List<UserDevfilePermissionImpl> getByUser(String userId) throws ServerException {
requireNonNull(userId, "User identifier required");
return doGetByUser(wildcardToNull(userId))
.stream()
return doGetByUser(wildcardToNull(userId)).stream()
.map(UserDevfilePermissionImpl::new)
.collect(toList());
}

View File

@ -56,8 +56,7 @@ public class ResourceServicePermissionsFilter extends CheMethodInvokerFilter {
AccountManager accountManager, Set<AccountPermissionsChecker> permissionsCheckers) {
this.accountManager = accountManager;
this.permissionsCheckers =
permissionsCheckers
.stream()
permissionsCheckers.stream()
.collect(toMap(AccountPermissionsChecker::getAccountType, identity()));
}

View File

@ -65,8 +65,7 @@ public class WorkspacePermissionsFilter extends CheMethodInvokerFilter {
this.workspaceManager = workspaceManager;
this.accountManager = accountManager;
this.accountTypeToPermissionsChecker =
accountPermissionsCheckers
.stream()
accountPermissionsCheckers.stream()
.collect(toMap(AccountPermissionsChecker::getAccountType, identity()));
this.superPrivilegesChecker = superPrivilegesChecker;
}

10
pom.xml
View File

@ -107,7 +107,7 @@
<maven.antrun.plugin.version>3.0.0</maven.antrun.plugin.version>
<maven.assembly.plugin.version>3.3.0</maven.assembly.plugin.version>
<maven.buildhelper.plugin.version>3.2.0</maven.buildhelper.plugin.version>
<maven.buildnumber.plugin.version>1.4</maven.buildnumber.plugin.version>
<maven.buildnumber.plugin.version>3.0.0</maven.buildnumber.plugin.version>
<maven.clean.plugin.version>3.1.0</maven.clean.plugin.version>
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
<maven.dependency.plugin.version>3.1.2</maven.dependency.plugin.version>
@ -115,11 +115,11 @@
<maven.exec.plugin.version>3.0.0</maven.exec.plugin.version>
<maven.fabric8io.docker.plugin.version>0.37.0</maven.fabric8io.docker.plugin.version>
<maven.failsafe.plugin.version>3.0.0-M5</maven.failsafe.plugin.version>
<maven.fmt.plugin.version>2.5.1</maven.fmt.plugin.version>
<maven.fmt.plugin.version>2.13</maven.fmt.plugin.version>
<maven.install.plugin.version>3.0.0-M1</maven.install.plugin.version>
<maven.jacoco.plugin.version>0.8.7</maven.jacoco.plugin.version>
<maven.jar.plugin.version>3.2.0</maven.jar.plugin.version>
<maven.mycila.license.plugin.version>3.0</maven.mycila.license.plugin.version>
<maven.mycila.license.plugin.version>4.1</maven.mycila.license.plugin.version>
<maven.plugin.plugin.version>3.6.1</maven.plugin.plugin.version>
<maven.resources.plugin.version>3.2.0</maven.resources.plugin.version>
<maven.sonar.plugin.version>3.9.0.2155</maven.sonar.plugin.version>
@ -135,7 +135,7 @@
<org.apache.httpcomponents.httpclient.version>4.5.13</org.apache.httpcomponents.httpclient.version>
<org.apache.httpcomponents.httpcore.version>4.4.15</org.apache.httpcomponents.httpcore.version>
<org.apache.maven.plugin-testing.maven-plugin-testing-harness.version>3.3.0</org.apache.maven.plugin-testing.maven-plugin-testing-harness.version>
<org.apache.maven.plugin-tools.plugin-annotations.version>3.2</org.apache.maven.plugin-tools.plugin-annotations.version>
<org.apache.maven.plugin-tools.plugin-annotations.version>3.6.2</org.apache.maven.plugin-tools.plugin-annotations.version>
<org.apache.maven.verson>3.8.4</org.apache.maven.verson>
<org.apache.tomcat.version>10.0.14</org.apache.tomcat.version>
<org.codehaus.plexus.utils.version>3.4.1</org.codehaus.plexus.utils.version>
@ -1801,7 +1801,7 @@
<buildNumberPropertyName>buildNumber</buildNumberPropertyName>
<revisionOnScmFailure>no_revision</revisionOnScmFailure>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<timestampFormat>{0, date,yyyyMMdd}</timestampFormat>
<timestampFormat>yyyyMMdd</timestampFormat>
</configuration>
</plugin>
<plugin>

View File

@ -254,9 +254,7 @@ public class DevfileService extends Service {
final Set<String> skip = ImmutableSet.of("token", "skipCount", "maxItems", "order");
Map<String, Set<String>> queryParams = URLEncodedUtils.parse(uriInfo.getRequestUri());
final List<Pair<String, String>> query =
queryParams
.entrySet()
.stream()
queryParams.entrySet().stream()
.filter(param -> !param.getValue().isEmpty())
.filter(param -> !skip.contains(param.getKey()))
.map(entry -> Pair.of(entry.getKey(), entry.getValue().iterator().next()))
@ -282,9 +280,7 @@ public class DevfileService extends Service {
userDevfileManager.getUserDevfiles(maxItems, skipCount, query, searchOrder);
List<UserDevfileDto> list =
userDevfilesPage
.getItems()
.stream()
userDevfilesPage.getItems().stream()
.map(DtoConverter::asDto)
.map(dto -> linksInjector.injectLinks(asDto(dto), getServiceContext()))
.collect(toList());

View File

@ -198,8 +198,7 @@ public class JpaUserDevfileDao implements UserDevfileDao {
throws ServerException {
if (filter != null && !filter.isEmpty()) {
List<Pair<String, String>> invalidFilter =
filter
.stream()
filter.stream()
.filter(p -> !VALID_SEARCH_FIELDS.contains(p.first.toLowerCase()))
.collect(toList());
if (!invalidFilter.isEmpty()) {
@ -210,8 +209,7 @@ public class JpaUserDevfileDao implements UserDevfileDao {
List<Pair<String, String>> effectiveOrder = DEFAULT_ORDER;
if (order != null && !order.isEmpty()) {
List<Pair<String, String>> invalidOrder =
order
.stream()
order.stream()
.filter(p -> !VALID_ORDER_FIELDS.contains(p.first.toLowerCase()))
.collect(toList());
if (!invalidOrder.isEmpty()) {
@ -220,8 +218,7 @@ public class JpaUserDevfileDao implements UserDevfileDao {
}
List<Pair<String, String>> invalidSortOrder =
order
.stream()
order.stream()
.filter(p -> !p.second.equalsIgnoreCase("asc") && !p.second.equalsIgnoreCase("desc"))
.collect(Collectors.toList());
if (!invalidSortOrder.isEmpty()) {

View File

@ -75,9 +75,7 @@ public class BitbucketServerPersonalAccessTokenFetcher implements PersonalAccess
LOG.debug("Current bitbucket user {} ", user);
// cleanup existed
List<BitbucketPersonalAccessToken> existingTokens =
bitbucketServerApiClient
.getPersonalAccessTokens(user.getSlug())
.stream()
bitbucketServerApiClient.getPersonalAccessTokens(user.getSlug()).stream()
.filter(p -> p.getName().equals(tokenName))
.collect(Collectors.toList());
for (BitbucketPersonalAccessToken existedToken : existingTokens) {

Some files were not shown because too many files have changed in this diff Show More