use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class DestinationMapMemoryTest method testVeryLongestinationPaths.
public void testVeryLongestinationPaths() throws Exception {
for (int i = 1; i < 100; i++) {
String name = "1";
for (int j = 2; j <= i; j++) {
name += "." + j;
}
// System.out.println("Checking: " + name);
try {
ActiveMQDestination d1 = createDestination(name);
DestinationMap map = new DestinationMap();
map.put(d1, d1);
} catch (Throwable e) {
fail("Destination name too long: " + name + " : " + e);
}
}
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class DestinationMapTest method remove.
protected void remove(String name, Object value) {
ActiveMQDestination destination = createDestination(name);
map.remove(destination, value);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class ActiveMQDestinationTestSupport method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQDestination info = (ActiveMQDestination) object;
info.setPhysicalName("PhysicalName:1");
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class MessageTransformationTest method testTransformDestination.
/**
* Tests transforming destinations into ActiveMQ's destination
* implementation.
*/
public void testTransformDestination() throws Exception {
assertTrue("Transforming a TempQueue destination to an ActiveMQTempQueue", ActiveMQMessageTransformation.transformDestination(new ActiveMQTempQueue()) instanceof ActiveMQTempQueue);
assertTrue("Transforming a TempTopic destination to an ActiveMQTempTopic", ActiveMQMessageTransformation.transformDestination(new ActiveMQTempTopic()) instanceof ActiveMQTempTopic);
assertTrue("Transforming a Queue destination to an ActiveMQQueue", ActiveMQMessageTransformation.transformDestination(new ActiveMQQueue()) instanceof ActiveMQQueue);
assertTrue("Transforming a Topic destination to an ActiveMQTopic", ActiveMQMessageTransformation.transformDestination(new ActiveMQTopic()) instanceof ActiveMQTopic);
assertTrue("Transforming a Destination to an ActiveMQDestination", ActiveMQMessageTransformation.transformDestination(new ActiveMQTopic()) instanceof ActiveMQDestination);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class XARecoveryBrokerTest method testTopicPersistentPreparedAcksNotLostOnRestart.
public void testTopicPersistentPreparedAcksNotLostOnRestart() throws Exception {
ActiveMQDestination destination = new ActiveMQTopic("TryTopic");
// Setup the producer and send the message.
StubConnection connection = createConnection();
ConnectionInfo connectionInfo = createConnectionInfo();
connectionInfo.setClientId("durable");
SessionInfo sessionInfo = createSessionInfo(connectionInfo);
ProducerInfo producerInfo = createProducerInfo(sessionInfo);
connection.send(connectionInfo);
connection.send(sessionInfo);
connection.send(producerInfo);
// setup durable subs
ConsumerInfo consumerInfo = createConsumerInfo(sessionInfo, destination);
consumerInfo.setSubscriptionName("durable");
connection.send(consumerInfo);
final int numMessages = 4;
for (int i = 0; i < numMessages; i++) {
Message message = createMessage(producerInfo, destination);
message.setPersistent(true);
connection.send(message);
}
// Begin the transaction.
XATransactionId txid = createXATransaction(sessionInfo);
connection.send(createBeginTransaction(connectionInfo, txid));
final int messageCount = expectedMessageCount(numMessages, destination);
Message m = null;
for (int i = 0; i < messageCount; i++) {
m = receiveMessage(connection);
assertNotNull("unexpected null on: " + i, m);
}
// one ack with last received, mimic a beforeEnd synchronization
MessageAck ack = createAck(consumerInfo, m, messageCount, MessageAck.STANDARD_ACK_TYPE);
ack.setTransactionId(txid);
connection.send(ack);
connection.request(createPrepareTransaction(connectionInfo, txid));
// restart the broker.
restartBroker();
connection = createConnection();
connectionInfo = createConnectionInfo();
connectionInfo.setClientId("durable");
connection.send(connectionInfo);
// validate recovery
TransactionInfo recoverInfo = new TransactionInfo(connectionInfo.getConnectionId(), null, TransactionInfo.RECOVER);
DataArrayResponse dataArrayResponse = (DataArrayResponse) connection.request(recoverInfo);
assertEquals("there is a prepared tx", 1, dataArrayResponse.getData().length);
assertEquals("it matches", txid, dataArrayResponse.getData()[0]);
sessionInfo = createSessionInfo(connectionInfo);
connection.send(sessionInfo);
consumerInfo = createConsumerInfo(sessionInfo, destination);
consumerInfo.setSubscriptionName("durable");
connection.send(consumerInfo);
// no redelivery, exactly once semantics unless there is rollback
m = receiveMessage(connection);
assertNull(m);
assertNoMessagesLeft(connection);
connection.request(createCommitTransaction2Phase(connectionInfo, txid));
// validate recovery complete
dataArrayResponse = (DataArrayResponse) connection.request(recoverInfo);
assertEquals("there are no prepared tx", 0, dataArrayResponse.getData().length);
}
Aggregations