Skip to content

Commit

Permalink
ARTEMIS-2316 Reverting change on AMQPMessage, and changing test to be…
Browse files Browse the repository at this point in the history
… accurate

This (kind of) reverts commit bd1162d.
  • Loading branch information
clebertsuconic committed Apr 25, 2019
1 parent 93a5feb commit e081543
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 84 deletions.
Expand Up @@ -1223,9 +1223,7 @@ public Object removeProperty(SimpleString key) {

@Override
public Object removeProperty(String key) {
Object removed = getApplicationPropertiesMap(false).remove(key);
messageChanged();
return removed;
return getApplicationPropertiesMap(false).remove(key);
}

@Override
Expand Down Expand Up @@ -1397,70 +1395,60 @@ public SimpleString getSimpleStringProperty(String key) throws ActiveMQPropertyC
@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;
}

Expand Down Expand Up @@ -1507,14 +1495,12 @@ public org.apache.activemq.artemis.api.core.Message putDoubleProperty(SimpleStri
@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;
}

Expand Down
Expand Up @@ -22,6 +22,7 @@
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;
Expand All @@ -35,11 +36,38 @@
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;

Expand Down Expand Up @@ -76,7 +104,7 @@ public void setUp() throws Exception {
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);
Expand All @@ -95,7 +123,7 @@ public void setUp() throws Exception {
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
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit e081543

Please sign in to comment.