use of org.apache.activemq.broker.region.policy.DispatchPolicy in project activemq-artemis by apache.
the class XBeanConfigTest method testBrokerConfiguredCorrectly.
public void testBrokerConfiguredCorrectly() throws Exception {
// Validate the system properties are being evaluated in xbean.
assertEquals("testbroker", brokerService.getBrokerName());
Topic topic = (Topic) broker.addDestination(context, new ActiveMQTopic("FOO.BAR"), true);
DispatchPolicy dispatchPolicy = topic.getDispatchPolicy();
assertTrue("dispatchPolicy should be RoundRobinDispatchPolicy: " + dispatchPolicy, dispatchPolicy instanceof RoundRobinDispatchPolicy);
SubscriptionRecoveryPolicy subscriptionRecoveryPolicy = topic.getSubscriptionRecoveryPolicy();
subscriptionRecoveryPolicy = ((RetainedMessageSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy).getWrapped();
assertTrue("subscriptionRecoveryPolicy should be LastImageSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy, subscriptionRecoveryPolicy instanceof LastImageSubscriptionRecoveryPolicy);
LOG.info("destination: " + topic);
LOG.info("dispatchPolicy: " + dispatchPolicy);
LOG.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy);
topic = (Topic) broker.addDestination(context, new ActiveMQTopic("ORDERS.BOOKS"), true);
dispatchPolicy = topic.getDispatchPolicy();
assertTrue("dispatchPolicy should be StrictOrderDispatchPolicy: " + dispatchPolicy, dispatchPolicy instanceof StrictOrderDispatchPolicy);
subscriptionRecoveryPolicy = topic.getSubscriptionRecoveryPolicy();
subscriptionRecoveryPolicy = ((RetainedMessageSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy).getWrapped();
assertTrue("subscriptionRecoveryPolicy should be TimedSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy, subscriptionRecoveryPolicy instanceof TimedSubscriptionRecoveryPolicy);
TimedSubscriptionRecoveryPolicy timedSubscriptionPolicy = (TimedSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy;
assertEquals("getRecoverDuration()", 60000, timedSubscriptionPolicy.getRecoverDuration());
LOG.info("destination: " + topic);
LOG.info("dispatchPolicy: " + dispatchPolicy);
LOG.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy);
}
Aggregations