use of org.apache.activemq.artemis.core.paging.cursor.PageSubscription in project activemq-artemis by apache.
the class PageCursorStressTest method testMultipleIterators.
@Test
public void testMultipleIterators() throws Exception {
final int NUM_MESSAGES = 10;
int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
System.out.println("NumberOfPages = " + numberOfPages);
PageCursorProvider cursorProvider = lookupCursorProvider();
PageSubscription cursor = cursorProvider.getSubscription(queue.getID());
LinkedListIterator<PagedReference> iter = cursor.iterator();
LinkedListIterator<PagedReference> iter2 = cursor.iterator();
assertTrue(iter.hasNext());
PagedReference msg1 = iter.next();
PagedReference msg2 = iter2.next();
assertEquals(tstProperty(msg1.getMessage()), tstProperty(msg2.getMessage()));
System.out.println("property = " + tstProperty(msg1.getMessage()));
msg1 = iter.next();
assertEquals(1, tstProperty(msg1.getMessage()));
iter.remove();
msg2 = iter2.next();
assertEquals(2, tstProperty(msg2.getMessage()));
iter2.repeat();
msg2 = iter2.next();
assertEquals(2, tstProperty(msg2.getMessage()));
iter2.repeat();
assertEquals(2, tstProperty(msg2.getMessage()));
msg1 = iter.next();
assertEquals(2, tstProperty(msg1.getMessage()));
iter.repeat();
msg1 = iter.next();
assertEquals(2, tstProperty(msg1.getMessage()));
assertTrue(iter2.hasNext());
}
use of org.apache.activemq.artemis.core.paging.cursor.PageSubscription in project activemq-artemis by apache.
the class PagingCounterTest method locateCounter.
/**
* @param queue
* @return
* @throws Exception
*/
private PageSubscriptionCounter locateCounter(Queue queue) throws Exception {
PageSubscription subscription = server.getPagingManager().getPageStore(new SimpleString("A1")).getCursorProvider().getSubscription(queue.getID());
PageSubscriptionCounter counter = subscription.getCounter();
return counter;
}
Aggregations