Search in sources :

Example 1 with ErrorBroker

use of org.apache.activemq.broker.ErrorBroker in project activemq-artemis by apache.

the class RedeliveryPluginTest method testInstallPluginValidation.

public void testInstallPluginValidation() throws Exception {
    RedeliveryPolicyMap redeliveryPolicyMap = new RedeliveryPolicyMap();
    RedeliveryPolicy defaultEntry = new RedeliveryPolicy();
    defaultEntry.setInitialRedeliveryDelay(500);
    redeliveryPolicyMap.setDefaultEntry(defaultEntry);
    underTest.setRedeliveryPolicyMap(redeliveryPolicyMap);
    final BrokerService brokerService = new BrokerService();
    brokerService.setSchedulerSupport(false);
    Broker broker = new ErrorBroker("hi") {

        @Override
        public BrokerService getBrokerService() {
            return brokerService;
        }
    };
    try {
        underTest.installPlugin(broker);
        fail("expect exception on no scheduler support");
    } catch (Exception expected) {
        LOG.info("expected: " + expected);
    }
    brokerService.setSchedulerSupport(true);
    try {
        underTest.installPlugin(broker);
        fail("expect exception on small initial delay");
    } catch (Exception expected) {
        LOG.info("expected: " + expected);
    }
    defaultEntry.setInitialRedeliveryDelay(5000);
    defaultEntry.setRedeliveryDelay(500);
    brokerService.setSchedulerSupport(true);
    try {
        underTest.installPlugin(broker);
        fail("expect exception on small redelivery delay");
    } catch (Exception expected) {
        LOG.info("expected: " + expected);
    }
}
Also used : Broker(org.apache.activemq.broker.Broker) ErrorBroker(org.apache.activemq.broker.ErrorBroker) ErrorBroker(org.apache.activemq.broker.ErrorBroker) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) RedeliveryPolicyMap(org.apache.activemq.broker.region.policy.RedeliveryPolicyMap) BrokerService(org.apache.activemq.broker.BrokerService)

Aggregations

RedeliveryPolicy (org.apache.activemq.RedeliveryPolicy)1 Broker (org.apache.activemq.broker.Broker)1 BrokerService (org.apache.activemq.broker.BrokerService)1 ErrorBroker (org.apache.activemq.broker.ErrorBroker)1 RedeliveryPolicyMap (org.apache.activemq.broker.region.policy.RedeliveryPolicyMap)1