@Override
  public void setUp() throws Exception {
    super.setUp();

    SystemConfig systemConfig = mock(SystemConfig.class);
    when(systemConfig.getEventLogger()).thenReturn(mock(EventLogger.class));
    Broker<?> broker = mock(Broker.class);
    when(broker.getParent(SystemConfig.class)).thenReturn(systemConfig);
    when(broker.getModel()).thenReturn(BrokerModel.getInstance());
    when(broker.getSecurityManager()).thenReturn(new SecurityManager(broker, false));

    _taskExecutor = new TaskExecutorImpl();
    _taskExecutor.start();
    when(broker.getTaskExecutor()).thenReturn(_taskExecutor);
    when(broker.getChildExecutor()).thenReturn(_taskExecutor);

    _node = mock(VirtualHostNode.class);
    when(_node.getParent(Broker.class)).thenReturn(broker);
    when(_node.getModel()).thenReturn(BrokerModel.getInstance());
    when(_node.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_node.getChildExecutor()).thenReturn(_taskExecutor);
    when(_node.getConfigurationStore()).thenReturn(mock(DurableConfigurationStore.class));
    when(_node.getCategoryClass()).thenReturn(VirtualHostNode.class);

    _failingStore = mock(MessageStore.class);
    doThrow(new RuntimeException("Cannot open store"))
        .when(_failingStore)
        .openMessageStore(any(ConfiguredObject.class));
  }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   _configuredObjectBinding = ConfiguredObjectBinding.getInstance();
   _object =
       new ConfiguredObjectRecordImpl(
           UUIDGenerator.generateRandomUUID(), DUMMY_TYPE_STRING, DUMMY_ATTRIBUTES_MAP);
 }
 @Override
 public void tearDown() throws Exception {
   try {
     if (_taskExecutor != null) {
       _taskExecutor.stop();
     }
   } finally {
     super.tearDown();
   }
 }
Exemplo n.º 4
0
  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();
  }
 protected void setUp() throws Exception {
   super.setUp();
   _store = mock(DurableConfigurationStore.class);
   _listener = new StoreConfigurationChangeListener(_store);
 }
Exemplo n.º 6
0
 public void tearDown() throws Exception {
   FileUtils.delete(new File(_storePath), true);
   super.tearDown();
 }