[
https://issues.apache.org/jira/browse/ARTEMIS-4568?focusedWorklogId=900446&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-900446
]
ASF GitHub Bot logged work on ARTEMIS-4568:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Jan/24 15:03
Start Date: 18/Jan/24 15:03
Worklog Time Spent: 10m
Work Description: gemmellr commented on code in PR #4742:
URL: https://github.com/apache/activemq-artemis/pull/4742#discussion_r1457558346
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/amqpBrokerConnectivity/AMQPBrokerConnectionElement.java:
##########
@@ -95,4 +98,31 @@ public void setName(String name) {
this.name = name;
}
+ @Override
+ public int hashCode() {
+ // Don't pass the parent into hash or you will get a loop of hash code
computations.
+ return Objects.hash(matchAddress, name, queueName, type) +
System.identityHashCode(parent);
Review Comment:
Might having parent here allow for two objects that are equals() (which
doesnt consider the parent) to then have a different hashCode, which isnt
allowed?
##########
artemis-server/src/test/java/org/apache/activemq/artemis/core/config/amqpBrokerConnectivity/AMQPBrokerConnectionElementTest.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.core.config.amqpBrokerConnectivity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import org.junit.Test;
+
+/**
+ * Test basic API functionality of the AMQPBrokerConnectionElement type
+ */
+public class AMQPBrokerConnectionElementTest {
+
+ @Test
+ public void testEquals() {
+ AMQPBrokerConnectionElement element1 = new AMQPBrokerConnectionElement();
+ AMQPBrokerConnectionElement element2 = new AMQPBrokerConnectionElement();
+
+ assertEquals(element1, element2);
+
+ // Name
+ element1.setName("test");
+ assertNotEquals(element1, element2);
+ element2.setName("test");
+ assertEquals(element1, element2);
+
+ // Match Address
+ element1.setMatchAddress("test");
+ assertNotEquals(element1, element2);
+ element2.setMatchAddress("test");
+ assertEquals(element1, element2);
+
+ // Queue Name
+ element1.setQueueName("test");
+ assertNotEquals(element1, element2);
+ element2.setQueueName("test");
+ assertEquals(element1, element2);
+
+ // Type
+ element1.setType(AMQPBrokerConnectionAddressType.MIRROR);
+ assertNotEquals(element1, element2);
+ element2.setType(AMQPBrokerConnectionAddressType.MIRROR);
+ assertEquals(element1, element2);
+ }
+
+ @Test
+ public void testHashCode() {
+ AMQPBrokerConnectionElement element1 = new AMQPBrokerConnectionElement();
+ AMQPBrokerConnectionElement element2 = new AMQPBrokerConnectionElement();
+
+ assertEquals(element1.hashCode(), element2.hashCode());
+
+ // Name
+ element1.setName("test");
+ assertNotEquals(element1.hashCode(), element2.hashCode());
+ element2.setName("test");
+ assertEquals(element1.hashCode(), element2.hashCode());
+
+ // Match Address
+ element1.setMatchAddress("test");
+ assertNotEquals(element1.hashCode(), element2.hashCode());
+ element2.setMatchAddress("test");
+ assertEquals(element1.hashCode(), element2.hashCode());
+
+ // Queue Name
+ element1.setQueueName("test");
+ assertNotEquals(element1.hashCode(), element2.hashCode());
+ element2.setQueueName("test");
+ assertEquals(element1.hashCode(), element2.hashCode());
+
+ // Type
+ element1.setType(AMQPBrokerConnectionAddressType.MIRROR);
+ assertNotEquals(element1.hashCode(), element2.hashCode());
+ element2.setType(AMQPBrokerConnectionAddressType.MIRROR);
+ assertEquals(element1.hashCode(), element2.hashCode());
+
+ // Parent
+ final AMQPBrokerConnectConfiguration parent = new
AMQPBrokerConnectConfiguration();
+
+ element1.setParent(parent);
+ assertNotEquals(element1.hashCode(), element2.hashCode());
+ element2.setParent(parent);
+ assertEquals(element1.hashCode(), element2.hashCode());
Review Comment:
Specifically, also checking equals() here would presumably show it violating
the joint contract (the 2 beeing equal throughput but having different, and
changing, hashCodes).
Issue Time Tracking
-------------------
Worklog Id: (was: 900446)
Time Spent: 20m (was: 10m)
> Support reloading AMQP broker federation configuration
> ------------------------------------------------------
>
> Key: ARTEMIS-4568
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4568
> Project: ActiveMQ Artemis
> Issue Type: New Feature
> Components: AMQP, Configuration
> Affects Versions: 2.31.2
> Reporter: Timothy A. Bish
> Assignee: Timothy A. Bish
> Priority: Minor
> Fix For: 2.32.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Add support for reload of AMQP federation broker connection configuration
> from XML and broker properties such that active federations are stopped and
> updated with new configuration settings, and support add and remove of AMQP
> federation broker connections.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)