This is an automated email from the ASF dual-hosted git repository.

vavrtom pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git


The following commit(s) were added to refs/heads/main by this push:
     new 8412614de4 QPID-8664: [Broker-J] Guava removal (3/10)
8412614de4 is described below

commit 8412614de420725d8dd992059d044d321104dd7a
Author: dakirily <[email protected]>
AuthorDate: Thu Mar 27 09:29:51 2025 +0100

    QPID-8664: [Broker-J] Guava removal (3/10)
    
    This commit replaces guava collection and collection utilities with 
built-in java collections and utilities
---
 .../store/berkeleydb/BDBAMQP10V0UpgradeTest.java       |  8 ++++----
 .../qpid/server/store/berkeleydb/BDBUpgradeTest.java   |  4 ++--
 .../store/berkeleydb/replication/GroupBrokerAdmin.java |  5 ++---
 .../store/berkeleydb/replication/MultiNodeTest.java    |  4 ++--
 .../EndToEndConversionTestBase.java                    |  4 +---
 .../end_to_end_conversion/SimpleConversionTest.java    | 14 +++-----------
 .../v0_8/extension/confirms/PublisherConfirmsTest.java |  5 ++---
 .../tests/protocol/v1_0/messaging/TransferTest.java    | 18 ++++++++----------
 .../tests/http/userprefs/UserPreferencesRestTest.java  | 11 +++++------
 .../systests/jms_1_1/acknowledge/AcknowledgeTest.java  |  5 ++---
 .../jms_1_1/extensions/acl/MessagingACLTest.java       |  4 +---
 11 files changed, 32 insertions(+), 50 deletions(-)

diff --git 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
index 4cd7b76356..dafb3fe44a 100644
--- 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
+++ 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBAMQP10V0UpgradeTest.java
@@ -23,6 +23,7 @@ import static 
org.apache.qpid.systests.JmsTestBase.DEFAULT_BROKER_CONFIG;
 import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import java.security.MessageDigest;
+import java.util.Objects;
 
 import javax.jms.BytesMessage;
 import javax.jms.Connection;
@@ -31,7 +32,6 @@ import javax.jms.MessageConsumer;
 import javax.jms.Queue;
 import javax.jms.Session;
 
-import com.google.common.base.Objects;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
@@ -62,7 +62,7 @@ public class BDBAMQP10V0UpgradeTest extends UpgradeTestBase
     {
         assumeTrue("BDB".equals(System.getProperty("virtualhostnode.type", 
"BDB")),
                 "System property 'virtualhostnode.type' should be 'BDB'");
-        assumeTrue(Objects.equal(getProtocol(), Protocol.AMQP_1_0), "AMQP 
protocol should be 1.0");
+        assumeTrue(Objects.equals(getProtocol(), Protocol.AMQP_1_0), "AMQP 
protocol should be 1.0");
     }
 
     @Test
@@ -85,11 +85,11 @@ public class BDBAMQP10V0UpgradeTest extends UpgradeTestBase
             byte[] content = new byte[(int) length];
             bytesMessage.readBytes(content);
 
-            assumeTrue(Objects.equal(EXPECTED_MESSAGE_LENGTH, length), 
"Unexpected content length");
+            assumeTrue(Objects.equals(EXPECTED_MESSAGE_LENGTH, length), 
"Unexpected content length");
             assumeTrue(expectedContentHash != null, "Message should carry 
expectedShaHash property");
 
             String contentHash = computeContentHash(content);
-            assumeTrue(Objects.equal(expectedContentHash, contentHash), 
"Unexpected content hash");
+            assumeTrue(Objects.equals(expectedContentHash, contentHash), 
"Unexpected content hash");
             session.commit();
         }
         finally
diff --git 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
index deda92de75..54bbcf063f 100644
--- 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
+++ 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
@@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.ThreadLocalRandom;
 
 import javax.jms.Connection;
@@ -51,7 +52,6 @@ import javax.jms.TopicPublisher;
 import javax.jms.TopicSession;
 import javax.jms.TopicSubscriber;
 
-import com.google.common.base.Objects;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
@@ -87,7 +87,7 @@ public class BDBUpgradeTest extends UpgradeTestBase
     {
         assumeTrue("BDB".equals(System.getProperty("virtualhostnode.type", 
"BDB")),
                 "System property 'virtualhostnode.type' should be 'BDB'");
-        assumeFalse(Objects.equal(getProtocol(), Protocol.AMQP_1_0), "AMQP 
protocol should be 1.0");
+        assumeFalse(Objects.equals(getProtocol(), Protocol.AMQP_1_0), "AMQP 
protocol should be 1.0");
     }
 
     /**
diff --git 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupBrokerAdmin.java
 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupBrokerAdmin.java
index c8b24c06c4..e538f58a07 100644
--- 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupBrokerAdmin.java
+++ 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupBrokerAdmin.java
@@ -41,7 +41,6 @@ import java.util.stream.Stream;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Joiner;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
@@ -448,8 +447,8 @@ public class GroupBrokerAdmin
 
         if (roles.values().stream().noneMatch(role -> ROLE_MASTER.equals(role) 
|| ROLE_REPLICA.equals(role)))
         {
-            throw new BrokerAdminException("Unexpected node roles " + 
Joiner.on(", ").withKeyValueSeparator(" -> ")
-                                                                            
.join(roles));
+            throw new BrokerAdminException("Unexpected node roles " + 
roles.entrySet().stream()
+                    .map(entry -> entry.getKey() + " -> " + 
entry.getValue()).collect(Collectors.joining(", ")));
         }
     }
 
diff --git 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
index 35d6f6f4c4..055a73771f 100644
--- 
a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
+++ 
b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
@@ -35,6 +35,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
@@ -56,7 +57,6 @@ import javax.jms.TextMessage;
 import javax.jms.TransactionRolledBackException;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Objects;
 import com.sleepycat.je.Durability;
 import com.sleepycat.je.EnvironmentConfig;
 import com.sleepycat.je.rep.ReplicatedEnvironment;
@@ -946,7 +946,7 @@ public class MultiNodeTest extends GroupJmsTestBase
             {
                 final Message message = consumer.receive(getReceiveTimeout());
                 assumeTrue(message instanceof TextMessage,"Message should be a 
text message");
-                assumeTrue(Objects.equal(m, ((TextMessage) 
message).getText()),"Message text should be " + m);
+                assumeTrue(Objects.equals(m, ((TextMessage) 
message).getText()),"Message text should be " + m);
             }
         }
         finally
diff --git 
a/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/EndToEndConversionTestBase.java
 
b/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/EndToEndConversionTestBase.java
index 40df957d22..61fcef3be3 100644
--- 
a/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/EndToEndConversionTestBase.java
+++ 
b/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/EndToEndConversionTestBase.java
@@ -36,7 +36,6 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -237,8 +236,7 @@ public class EndToEndConversionTestBase extends 
BrokerAdminUsingTestBase
         {
             serverSocket.setSoTimeout(SERVER_SOCKET_TIMEOUT);
             String classPath = classpathQuery.getClasspath();
-            final List<String> arguments = Lists.newArrayList("java", 
"-showversion",
-                                                              "-cp", 
classPath);
+            final List<String> arguments = new ArrayList<>(List.of("java", 
"-showversion", "-cp", classPath));
             arguments.addAll(additionalJavaArguments);
             arguments.add(classpathQuery.getClientClass().getName());
             arguments.add(String.valueOf(serverSocket.getLocalPort()));
diff --git 
a/systests/end-to-end-conversion-tests/src/test/java/org/apache/qpid/systests/end_to_end_conversion/SimpleConversionTest.java
 
b/systests/end-to-end-conversion-tests/src/test/java/org/apache/qpid/systests/end_to_end_conversion/SimpleConversionTest.java
index 5bedc86737..65bcc79603 100644
--- 
a/systests/end-to-end-conversion-tests/src/test/java/org/apache/qpid/systests/end_to_end_conversion/SimpleConversionTest.java
+++ 
b/systests/end-to-end-conversion-tests/src/test/java/org/apache/qpid/systests/end_to_end_conversion/SimpleConversionTest.java
@@ -28,6 +28,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assumptions.assumeFalse;
 import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
+import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
@@ -35,7 +36,6 @@ import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 
@@ -121,16 +121,8 @@ public class SimpleConversionTest extends 
EndToEndConversionTestBase
     {
         final MessageDescription messageDescription = new MessageDescription();
         
messageDescription.setMessageType(MessageDescription.MessageType.STREAM_MESSAGE);
-        messageDescription.setContent(Lists.newArrayList(true,
-                                                         (byte) -7,
-                                                         (short) 259,
-                                                         Integer.MAX_VALUE,
-                                                         Long.MAX_VALUE,
-                                                         37.5f,
-                                                         38.5,
-                                                         "testString",
-                                                         null,
-                                                         new byte[]{0x24, 
0x00, (byte) 0xFF}));
+        messageDescription.setContent(Arrays.asList(true, (byte) -7, (short) 
259, Integer.MAX_VALUE, Long.MAX_VALUE,
+                37.5f, 38.5, "testString", null, new byte[]{ 0x24, 0x00, 
(byte) 0xFF }));
 
         performSimpleTest(messageDescription);
     }
diff --git 
a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/confirms/PublisherConfirmsTest.java
 
b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/confirms/PublisherConfirmsTest.java
index 7757509e10..68400ca591 100644
--- 
a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/confirms/PublisherConfirmsTest.java
+++ 
b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/confirms/PublisherConfirmsTest.java
@@ -24,9 +24,9 @@ import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 
+import java.util.HashSet;
 import java.util.Set;
 
-import com.google.common.collect.Sets;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -192,8 +192,7 @@ public class PublisherConfirmsTest extends 
BrokerAdminUsingTestBase
 
             interaction.tx().commit();
 
-            final Set<Class<?>> outstanding = 
Sets.newHashSet(TxCommitOkBody.class, BasicReturnBody.class,
-                                                              
ContentHeaderBody.class);
+            final Set<Class<?>> outstanding = new 
HashSet<>(Set.of(TxCommitOkBody.class, BasicReturnBody.class, 
ContentHeaderBody.class));
 
             while (!outstanding.isEmpty())
             {
diff --git 
a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
 
b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
index 1a46dd7887..27c1c57cc3 100644
--- 
a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
+++ 
b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
@@ -38,16 +38,14 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
+import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 import java.util.stream.LongStream;
 import java.util.stream.Stream;
 
-import com.google.common.collect.Sets;
-
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
@@ -1051,9 +1049,9 @@ public class TransferTest extends BrokerAdminUsingTestBase
                        .transferPayloadData(contents[2])
                        .transfer();
 
-            TreeSet<UnsignedInteger> expectedDeliveryIds = 
Sets.newTreeSet(Arrays.asList(UnsignedInteger.ZERO,
-                                                                               
          UnsignedInteger.ONE,
-                                                                               
          UnsignedInteger.valueOf(2)));
+            TreeSet<UnsignedInteger> expectedDeliveryIds = new 
TreeSet<>(Set.of(UnsignedInteger.ZERO,
+                    UnsignedInteger.ONE,
+                    UnsignedInteger.valueOf(2)));
             assertDeliveries(interaction, expectedDeliveryIds);
 
             // verify that no unexpected performative is received by closing
@@ -1099,10 +1097,10 @@ public class TransferTest extends 
BrokerAdminUsingTestBase
 
             interaction.txnSendDischarge(false);
 
-            assertDeliveries(interaction, 
Sets.newTreeSet(Arrays.asList(UnsignedInteger.ONE,
-                                                                        
UnsignedInteger.valueOf(2),
-                                                                        
UnsignedInteger.valueOf(3),
-                                                                        
UnsignedInteger.valueOf(4))));
+            assertDeliveries(interaction, new 
TreeSet<>(Set.of(UnsignedInteger.ONE,
+                    UnsignedInteger.valueOf(2),
+                    UnsignedInteger.valueOf(3),
+                    UnsignedInteger.valueOf(4))));
         }
         assertTestQueueMessages(contents);
     }
diff --git 
a/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/userprefs/UserPreferencesRestTest.java
 
b/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/userprefs/UserPreferencesRestTest.java
index c49438c231..e547090ca9 100644
--- 
a/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/userprefs/UserPreferencesRestTest.java
+++ 
b/systests/qpid-systests-http-management/src/test/java/org/apache/qpid/tests/http/userprefs/UserPreferencesRestTest.java
@@ -26,6 +26,7 @@ import static jakarta.servlet.http.HttpServletResponse.SC_OK;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -34,8 +35,6 @@ import java.util.Set;
 
 import com.fasterxml.jackson.core.type.TypeReference;
 
-import com.google.common.collect.Lists;
-
 import org.junit.jupiter.api.Test;
 
 import 
org.apache.qpid.server.management.plugin.preferences.QueryPreferenceValue;
@@ -298,8 +297,8 @@ public class UserPreferencesRestTest extends HttpTestBase
             pref2Attributes.put(Preference.TYPE_ATTRIBUTE, pref2Type);
 
             final Map<String, List<Map<String, Object>>> payload = new 
HashMap<>();
-            payload.put(pref1Type, Lists.newArrayList(pref1Attributes));
-            payload.put(pref2Type, Lists.newArrayList(pref2Attributes));
+            payload.put(pref1Type, new ArrayList<>(List.of(pref1Attributes)));
+            payload.put(pref2Type, new ArrayList<>(List.of(pref2Attributes)));
 
             getHelper().submitRequest(rootUrl, "PUT", payload, SC_OK);
         }
@@ -338,8 +337,8 @@ public class UserPreferencesRestTest extends HttpTestBase
             pref4Attributes.put(Preference.TYPE_ATTRIBUTE, pref3Type);
 
             final Map<String, List<Map<String, Object>>> payload = new 
HashMap<>();
-            payload.put(pref1Type, Lists.newArrayList(pref3Attributes));
-            payload.put(pref3Type, Lists.newArrayList(pref4Attributes));
+            payload.put(pref1Type, new ArrayList<>(List.of(pref3Attributes)));
+            payload.put(pref3Type, new ArrayList<>(List.of(pref4Attributes)));
 
             getHelper().submitRequest(rootUrl, "PUT", payload, SC_OK);
         }
diff --git 
a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
 
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
index e9fd19d19b..a3bd7ae2f3 100644
--- 
a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
+++ 
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
@@ -26,6 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
@@ -43,8 +44,6 @@ import javax.jms.Queue;
 import javax.jms.Session;
 import javax.naming.NamingException;
 
-import com.google.common.collect.Sets;
-
 import org.junit.jupiter.api.Test;
 
 import org.apache.qpid.systests.JmsTestBase;
@@ -157,7 +156,7 @@ public class AcknowledgeTest extends JmsTestBase
                 session.commit();
             }
 
-            Set<Integer> pendingMessages = Sets.newHashSet(messageIndices);
+            Set<Integer> pendingMessages = new HashSet<>(messageIndices);
             AtomicReference<Exception> exception = new AtomicReference<>();
             CountDownLatch completionLatch = new CountDownLatch(1);
 
diff --git 
a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/acl/MessagingACLTest.java
 
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/acl/MessagingACLTest.java
index 1a4d0a4b07..9ca015dc78 100644
--- 
a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/acl/MessagingACLTest.java
+++ 
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/acl/MessagingACLTest.java
@@ -54,8 +54,6 @@ import javax.jms.TextMessage;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-import com.google.common.collect.Sets;
-
 import org.junit.jupiter.api.Test;
 
 import org.slf4j.Logger;
@@ -278,7 +276,7 @@ public class MessagingACLTest extends JmsTestBase
             catch (JMSException e)
             {
                 final String expectedMessage =
-                        Sets.newHashSet(Protocol.AMQP_1_0, 
Protocol.AMQP_0_10).contains(getProtocol())
+                        Set.of(Protocol.AMQP_1_0, 
Protocol.AMQP_0_10).contains(getProtocol())
                                 ? "Permission CREATE is denied for : Consumer"
                                 : "403(access refused)";
                 assertJMSExceptionMessageContains(e, expectedMessage);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to