private StoreContext _storeContext = new StoreContext();
private AMQQueue _queue;
Scenario(int messageCount, List<Long> acked, List<Long> unacked) throws Exception
{
TransactionalContext txnContext = new NonTransactionalContext(new TestMemoryMessageStore(),
_storeContext, null,
new LinkedList<RequiredDeliveryException>()
);
PropertiesConfiguration env = new PropertiesConfiguration();
env.setProperty("name", "test");
VirtualHost virtualHost = new VirtualHost(new VirtualHostConfiguration("test", env), null);
_queue = AMQQueueFactory.createAMQQueueImpl(new AMQShortString("test"), false, null, false,
virtualHost, null);
for (int i = 0; i < messageCount; i++)
{
long deliveryTag = i + 1;
MessagePublishInfo info = new MessagePublishInfo()
{
public AMQShortString getExchange()
{
return null;
}
public void setExchange(AMQShortString exchange)
{
//To change body of implemented methods use File | Settings | File Templates.
}
public boolean isImmediate()
{
return false;
}
public boolean isMandatory()
{
return false;
}
public AMQShortString getRoutingKey()
{
return null;
}
};
TestMessage message = new TestMessage(deliveryTag, i, info, txnContext.getStoreContext());
_map.add(deliveryTag, _queue.enqueue(new StoreContext(), message));
}
_acked = acked;
_unacked = unacked;
}