This is an automated email from the ASF dual-hosted git repository. clebertsuconic pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push: new e081543 ARTEMIS-2316 Reverting change on AMQPMessage, and changing test to be accurate new d602d81 This closes #2641 e081543 is described below commit e0815438d5b7c6adce241b0a4a189581fd101af2 Author: Clebert Suconic <clebertsuco...@apache.org> AuthorDate: Thu Apr 25 10:25:05 2019 -0400 ARTEMIS-2316 Reverting change on AMQPMessage, and changing test to be accurate This (kind of) reverts commit bd1162d9b8b3563437dd4fc2dafa0fd4e56cd8df. --- .../artemis/protocol/amqp/broker/AMQPMessage.java | 16 +--------- ...va => AmqpBridgeApplicationPropertiesTest.java} | 34 ++++++++++++++++++++-- .../BridgeApplicationPropertiesTransformer.java | 32 -------------------- .../DivertApplicationPropertiesTransformer.java | 34 ---------------------- 4 files changed, 32 insertions(+), 84 deletions(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java index a1c5830..df35115 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java @@ -1223,9 +1223,7 @@ public class AMQPMessage extends RefCountMessage { @Override public Object removeProperty(String key) { - Object removed = getApplicationPropertiesMap(false).remove(key); - messageChanged(); - return removed; + return getApplicationPropertiesMap(false).remove(key); } @Override @@ -1397,70 +1395,60 @@ public class AMQPMessage extends RefCountMessage { @Override public org.apache.activemq.artemis.api.core.Message putBooleanProperty(String key, boolean value) { getApplicationPropertiesMap(true).put(key, Boolean.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putByteProperty(String key, byte value) { getApplicationPropertiesMap(true).put(key, Byte.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putBytesProperty(String key, byte[] value) { getApplicationPropertiesMap(true).put(key, value); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putShortProperty(String key, short value) { getApplicationPropertiesMap(true).put(key, Short.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putCharProperty(String key, char value) { getApplicationPropertiesMap(true).put(key, Character.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putIntProperty(String key, int value) { getApplicationPropertiesMap(true).put(key, Integer.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putLongProperty(String key, long value) { getApplicationPropertiesMap(true).put(key, Long.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putFloatProperty(String key, float value) { getApplicationPropertiesMap(true).put(key, Float.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putDoubleProperty(String key, double value) { getApplicationPropertiesMap(true).put(key, Double.valueOf(value)); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putBooleanProperty(SimpleString key, boolean value) { getApplicationPropertiesMap(true).put(key.toString(), Boolean.valueOf(value)); - messageChanged(); return this; } @@ -1507,14 +1495,12 @@ public class AMQPMessage extends RefCountMessage { @Override public org.apache.activemq.artemis.api.core.Message putStringProperty(String key, String value) { getApplicationPropertiesMap(true).put(key, value); - messageChanged(); return this; } @Override public org.apache.activemq.artemis.api.core.Message putObjectProperty(String key, Object value) throws ActiveMQPropertyConversionException { getApplicationPropertiesMap(true).put(key, value); - messageChanged(); return this; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationProperties.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java similarity index 86% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationProperties.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java index 886d65e..43aea33 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationProperties.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java @@ -22,6 +22,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -35,11 +36,38 @@ import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.config.TransformerConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ComponentConfigurationRoutingType; +import org.apache.activemq.artemis.core.server.transformer.Transformer; import org.junit.Before; import org.junit.Test; -public class AmqpBridgeApplicationProperties extends AmqpClientTestSupport { +public class AmqpBridgeApplicationPropertiesTest extends AmqpClientTestSupport { + public static class DivertApplicationPropertiesTransformer implements Transformer { + + public static final String TRX_ID = "trxId"; + + @Override + public Message transform(final Message message) { + + message.putStringProperty("A", "1"); + message.putStringProperty("B", "2"); + message.reencode(); + + return message; + } + } + public static class BridgeApplicationPropertiesTransformer implements Transformer { + + @Override + public Message transform(final Message message) { + + message.putStringProperty("C", "3"); + message.putStringProperty("D", "4"); + message.reencode(); + + return message; + } + } private ActiveMQServer server0; private ActiveMQServer server1; @@ -76,7 +104,7 @@ public class AmqpBridgeApplicationProperties extends AmqpClientTestSupport { server0.getConfiguration().addConnectorConfiguration("notification-broker", getServer1URL()); server1.getConfiguration().addAcceptorConfiguration("acceptor", getServer1URL()); - DivertConfiguration customNotificationsDivert = new DivertConfiguration().setName("custom-notifications-divert").setAddress("*.Provider.*.Agent.*.CustomNotification").setForwardingAddress("FrameworkNotifications").setExclusive(true).setTransformerConfiguration(new TransformerConfiguration(DivertApplicationPropertiesTransformer.class.getCanonicalName())); + DivertConfiguration customNotificationsDivert = new DivertConfiguration().setName("custom-notifications-divert").setAddress("*.Provider.*.Agent.*.CustomNotification").setForwardingAddress("FrameworkNotifications").setExclusive(true).setTransformerConfiguration(new TransformerConfiguration(DivertApplicationPropertiesTransformer.class.getName())); DivertConfiguration frameworkNotificationsDivert = new DivertConfiguration().setName("framework-notifications-divert").setAddress("BridgeNotifications").setForwardingAddress("Notifications").setRoutingType(ComponentConfigurationRoutingType.MULTICAST).setExclusive(true); server0.getConfiguration().addDivertConfiguration(customNotificationsDivert); @@ -95,7 +123,7 @@ public class AmqpBridgeApplicationProperties extends AmqpClientTestSupport { server1.createQueue(bridgeNotificationsQueue, RoutingType.ANYCAST, bridgeNotificationsQueue, null, true, false); server1.createQueue(notificationsQueue, RoutingType.MULTICAST, notificationsQueue, null, true, false); - server0.deployBridge(new BridgeConfiguration().setName("notifications-bridge").setQueueName(frameworkNotificationsQueue.toString()).setForwardingAddress(bridgeNotificationsQueue.toString()).setConfirmationWindowSize(10).setStaticConnectors(Arrays.asList("notification-broker")).setTransformerConfiguration(new TransformerConfiguration(BridgeApplicationPropertiesTransformer.class.getCanonicalName()))); + server0.deployBridge(new BridgeConfiguration().setName("notifications-bridge").setQueueName(frameworkNotificationsQueue.toString()).setForwardingAddress(bridgeNotificationsQueue.toString()).setConfirmationWindowSize(10).setStaticConnectors(Arrays.asList("notification-broker")).setTransformerConfiguration(new TransformerConfiguration(BridgeApplicationPropertiesTransformer.class.getName()))); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BridgeApplicationPropertiesTransformer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BridgeApplicationPropertiesTransformer.java deleted file mode 100644 index 9efb2af..0000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BridgeApplicationPropertiesTransformer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.tests.integration.amqp; - -import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.core.server.transformer.Transformer; - -public class BridgeApplicationPropertiesTransformer implements Transformer { - - @Override - public Message transform(final Message message) { - - message.putStringProperty("C", "3"); - message.putStringProperty("D", "4"); - - return message; - } -} diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DivertApplicationPropertiesTransformer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DivertApplicationPropertiesTransformer.java deleted file mode 100644 index 6620dc4..0000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DivertApplicationPropertiesTransformer.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.tests.integration.amqp; - -import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.core.server.transformer.Transformer; - -public class DivertApplicationPropertiesTransformer implements Transformer { - - public static final String TRX_ID = "trxId"; - - @Override - public Message transform(final Message message) { - - message.putStringProperty("A", "1"); - message.putStringProperty("B", "2"); - - return message; - } -}