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);
}
}
Aggregations