Reduce dependency on Guava (#1589)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-02 22:21:46 +02:00
committed by GitHub
parent 0ee916e8cb
commit bce69676d2
63 changed files with 222 additions and 332 deletions

View File

@@ -62,10 +62,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@@ -9,7 +9,6 @@
*/
package org.eclipse.hawkbit.amqp;
import com.google.common.collect.Maps;
import org.eclipse.hawkbit.api.ArtifactUrlHandler;
import org.eclipse.hawkbit.api.HostnameResolver;
import org.eclipse.hawkbit.cache.DownloadIdCache;
@@ -54,6 +53,7 @@ import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.ErrorHandler;
import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -366,10 +366,9 @@ public class AmqpConfiguration {
}
private static Map<String, Object> getTTLMaxArgsAuthenticationQueue() {
final Map<String, Object> args = Maps.newHashMapWithExpectedSize(2);
final Map<String, Object> args = new HashMap<>(2);
args.put("x-message-ttl", Duration.ofSeconds(30).toMillis());
args.put("x-max-length", 1_000);
return args;
}
}
}

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.amqp;
import java.util.ArrayList;
import java.util.List;
import jakarta.annotation.PostConstruct;
@@ -33,8 +34,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
import com.google.common.collect.Lists;
/**
*
* A controller which handles the DMF AMQP authentication.
@@ -93,7 +92,7 @@ public class AmqpControllerAuthentication {
}
private void addFilter() {
filterChain = Lists.newArrayListWithExpectedSize(5);
filterChain = new ArrayList<>(5);
final ControllerPreAuthenticatedGatewaySecurityTokenFilter gatewaySecurityTokenFilter = new ControllerPreAuthenticatedGatewaySecurityTokenFilter(
tenantConfigurationManagement, tenantAware, systemSecurityContext);

View File

@@ -10,13 +10,12 @@
package org.eclipse.hawkbit.amqp;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.context.properties.ConfigurationProperties;
import com.google.common.collect.Maps;
/**
* Bean which holds the necessary properties for configuring the AMQP deadletter
* queue.
@@ -39,7 +38,7 @@ public class AmqpDeadletterProperties {
* @return map which holds the properties
*/
public Map<String, Object> getDeadLetterExchangeArgs(final String exchange) {
final Map<String, Object> args = Maps.newHashMapWithExpectedSize(1);
final Map<String, Object> args = new HashMap<>(1);
args.put("x-dead-letter-exchange", exchange);
return args;
}
@@ -56,7 +55,7 @@ public class AmqpDeadletterProperties {
}
private Map<String, Object> getTTLArgs() {
final Map<String, Object> args = Maps.newHashMapWithExpectedSize(1);
final Map<String, Object> args = new HashMap<>(1);
args.put("x-message-ttl", getTtl());
return args;
}

View File

@@ -25,6 +25,7 @@ import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import com.google.common.collect.Iterables;
import org.eclipse.hawkbit.api.ApiType;
import org.eclipse.hawkbit.api.ArtifactUrl;
import org.eclipse.hawkbit.api.ArtifactUrlHandler;
@@ -79,8 +80,6 @@ import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.CollectionUtils;
import com.google.common.collect.Iterables;
/**
* {@link AmqpMessageDispatcherService} create all outgoing AMQP messages and
* delegate the messages to a {@link AmqpMessageSenderService}.