use of org.apache.qpid.server.model.Queue in project qpid-broker-j by apache.
the class Session_1_0Test method testReceiveAttachSharedTopicNonDurableNoContainer.
public void testReceiveAttachSharedTopicNonDurableNoContainer() throws Exception {
final String linkName = "testLink";
final String address = "amq.direct/" + TOPIC_NAME;
Attach attach = createSharedTopicAttach(false, linkName, address, true);
Attach attach2 = createSharedTopicAttach(false, linkName, address, true);
_session.receiveAttach(attach);
assertAttachSent(_connection, _session, attach);
assertQueues(TOPIC_NAME, LifetimePolicy.DELETE_ON_NO_OUTBOUND_LINKS);
AMQPConnection_1_0 secondConnection = createAmqpConnection_1_0();
Session_1_0 secondSession = createSession_1_0(secondConnection, 0);
secondSession.receiveAttach(attach2);
assertAttachSent(secondConnection, secondSession, attach2);
assertQueues(TOPIC_NAME, LifetimePolicy.DELETE_ON_NO_OUTBOUND_LINKS);
final Collection<Queue> queues = _virtualHost.getChildren(Queue.class);
assertEquals("Unexpected number of queues after attach", 1, queues.size());
Queue<?> queue = queues.iterator().next();
Collection<QueueConsumer<?, ?>> consumers = queue.getConsumers();
assertEquals("Unexpected number of consumers", 2, consumers.size());
}
use of org.apache.qpid.server.model.Queue in project qpid-broker-j by apache.
the class Session_1_0Test method testReceiveAttachTopicDurableWithContainer.
public void testReceiveAttachTopicDurableWithContainer() throws Exception {
final String linkName = "testLink";
final String address = "amq.direct/" + TOPIC_NAME;
Attach attach = createTopicAttach(true, linkName + "|1", address, false);
_session.receiveAttach(attach);
assertAttachSent(_connection, _session, attach);
assertQueues(TOPIC_NAME, LifetimePolicy.PERMANENT);
AMQPConnection_1_0 secondConnection = createAmqpConnection_1_0("testContainerId2");
Session_1_0 secondSession = createSession_1_0(secondConnection, 0);
Attach attach2 = createTopicAttach(true, linkName + "|2", address, false);
secondSession.receiveAttach(attach2);
assertAttachSent(secondConnection, secondSession, attach2);
Collection<Queue> queues = _virtualHost.getChildren(Queue.class);
assertEquals("Unexpected number of queues after second subscription with the same subscription name but different container id ", 2, queues.size());
}
use of org.apache.qpid.server.model.Queue in project qpid-broker-j by apache.
the class Session_1_0Test method testReceiveAttachForInvalidUnsubscribe.
public void testReceiveAttachForInvalidUnsubscribe() throws Exception {
final String linkName = "testLink";
final String address = "amq.direct/" + TOPIC_NAME;
Attach unsubscribeAttach = createTopicAttach(true, linkName, address, false);
unsubscribeAttach.setSource(null);
_session.receiveAttach(unsubscribeAttach);
assertAttachFailed(_connection, _session, unsubscribeAttach);
Collection<Queue> queues = _virtualHost.getChildren(Queue.class);
assertEquals("Unexpected number of queues after unsubscribe", 0, queues.size());
}
use of org.apache.qpid.server.model.Queue in project qpid-broker-j by apache.
the class Session_1_0Test method testReceiveAttachSharedTopicNonDurableWithContainer.
public void testReceiveAttachSharedTopicNonDurableWithContainer() throws Exception {
final String linkName = "testLink";
final String address = "amq.direct/" + TOPIC_NAME;
Attach attach = createSharedTopicAttach(false, linkName, address, false);
Attach attach2 = createSharedTopicAttach(false, linkName, address, false);
_session.receiveAttach(attach);
assertAttachSent(_connection, _session, attach);
assertQueues(TOPIC_NAME, LifetimePolicy.DELETE_ON_NO_OUTBOUND_LINKS);
AMQPConnection_1_0 secondConnection = createAmqpConnection_1_0("testContainerId2");
Session_1_0 secondSession = createSession_1_0(secondConnection, 0);
secondSession.receiveAttach(attach2);
assertAttachSent(secondConnection, secondSession, attach2);
final Collection<Queue> queues = _virtualHost.getChildren(Queue.class);
assertEquals("Unexpected number of queues after attach", 2, queues.size());
for (Queue<?> queue : queues) {
Collection<QueueConsumer<?, ?>> consumers = queue.getConsumers();
assertEquals("Unexpected number of consumers on queue " + queue.getName(), 1, consumers.size());
}
}
use of org.apache.qpid.server.model.Queue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10 method getReplyTo.
private ReplyTo getReplyTo(final NamedAddressSpace addressSpace, final String origReplyTo) {
DestinationAddress destinationAddress = new DestinationAddress(addressSpace, origReplyTo);
MessageDestination messageDestination = destinationAddress.getMessageDestination();
return new ReplyTo(ensureStr8("reply-to[\"exchange\"]", messageDestination instanceof Exchange ? messageDestination.getName() : ""), ensureStr8("reply-to[\"routing-key\"]", messageDestination instanceof Queue ? messageDestination.getName() : destinationAddress.getRoutingKey()));
}
Aggregations