Пример #1
0
  public void testBindQueue() throws Exception {
    AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false);
    Binding binding =
        new Binding(
            UUIDGenerator.generateRandomUUID(),
            ROUTING_KEY,
            queue,
            _exchange,
            FieldTable.convertToMap(_bindingArgs));
    _store.bindQueue(binding);

    reopenStore();

    ByteBuffer argsAsBytes = ByteBuffer.wrap(_bindingArgs.getDataAsBytes());

    verify(_bindingRecoveryHandler)
        .binding(binding.getId(), _exchange.getId(), queue.getId(), ROUTING_KEY, argsAsBytes);
  }
Пример #2
0
 private AMQQueue createTestQueue(
     String queueName, String queueOwner, boolean exclusive, Exchange alternateExchange)
     throws AMQStoreException {
   AMQQueue queue = mock(AMQQueue.class);
   when(queue.getName()).thenReturn(queueName);
   when(queue.getNameShortString()).thenReturn(AMQShortString.valueOf(queueName));
   when(queue.getOwner()).thenReturn(AMQShortString.valueOf(queueOwner));
   when(queue.isExclusive()).thenReturn(exclusive);
   when(queue.getId()).thenReturn(_queueId);
   when(queue.getAlternateExchange()).thenReturn(alternateExchange);
   return queue;
 }