@Override protected void setUp() throws Exception { super.setUp(); _configuredObjectBinding = ConfiguredObjectBinding.getInstance(); _object = new ConfiguredObjectRecordImpl( UUIDGenerator.generateRandomUUID(), DUMMY_TYPE_STRING, DUMMY_ATTRIBUTES_MAP); }
private Record getTestRecord(long messageNumber) { UUID queueId1 = UUIDGenerator.generateRandomUUID(); TransactionLogResource queue1 = mock(TransactionLogResource.class); when(queue1.getId()).thenReturn(queueId1); EnqueableMessage message1 = mock(EnqueableMessage.class); when(message1.isPersistent()).thenReturn(true); when(message1.getMessageNumber()).thenReturn(messageNumber); when(message1.getStoredMessage()).thenReturn(new MockStoredMessage(messageNumber)); Record enqueueRecord = new TestRecord(queue1, message1); return enqueueRecord; }
public void setUp() throws Exception { super.setUp(); _queueId = UUIDGenerator.generateRandomUUID(); _exchangeId = UUIDGenerator.generateRandomUUID(); _storeName = getName(); _storePath = TMP_FOLDER + File.separator + _storeName; FileUtils.delete(new File(_storePath), true); setTestSystemProperty("QPID_WORK", TMP_FOLDER); _configuration = mock(Configuration.class); _recoveryHandler = mock(ConfigurationRecoveryHandler.class); _queueRecoveryHandler = mock(QueueRecoveryHandler.class); _exchangeRecoveryHandler = mock(ExchangeRecoveryHandler.class); _bindingRecoveryHandler = mock(BindingRecoveryHandler.class); _storedMessageRecoveryHandler = mock(StoredMessageRecoveryHandler.class); _logRecoveryHandler = mock(TransactionLogRecoveryHandler.class); _messageStoreRecoveryHandler = mock(MessageStoreRecoveryHandler.class); _queueEntryRecoveryHandler = mock(TransactionLogRecoveryHandler.QueueEntryRecoveryHandler.class); _dtxRecordRecoveryHandler = mock(TransactionLogRecoveryHandler.DtxRecordRecoveryHandler.class); when(_messageStoreRecoveryHandler.begin()).thenReturn(_storedMessageRecoveryHandler); when(_recoveryHandler.begin(isA(MessageStore.class))).thenReturn(_exchangeRecoveryHandler); when(_exchangeRecoveryHandler.completeExchangeRecovery()).thenReturn(_queueRecoveryHandler); when(_queueRecoveryHandler.completeQueueRecovery()).thenReturn(_bindingRecoveryHandler); when(_logRecoveryHandler.begin(any(MessageStore.class))).thenReturn(_queueEntryRecoveryHandler); when(_queueEntryRecoveryHandler.completeQueueEntryRecovery()) .thenReturn(_dtxRecordRecoveryHandler); when(_exchange.getNameShortString()).thenReturn(AMQShortString.valueOf(EXCHANGE_NAME)); when(_exchange.getId()).thenReturn(_exchangeId); when(_configuration.getString(eq(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY), anyString())) .thenReturn(_storePath); _bindingArgs = new FieldTable(); AMQShortString argKey = AMQPFilterTypes.JMS_SELECTOR.getValue(); String argValue = "some selector expression"; _bindingArgs.put(argKey, argValue); reopenStore(); }
public void testUnbindQueue() 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); _store.unbindQueue(binding); reopenStore(); verify(_bindingRecoveryHandler, never()) .binding( any(UUID.class), any(UUID.class), any(UUID.class), anyString(), isA(ByteBuffer.class)); }
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); }