Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 22:56:29 -0400 (Sun, 27 Mar 2011)
New Revision: 10388
Modified:
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
trunk/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java
trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
Log:
merge Branch_2_2_eap -r10384:10387
Modified:
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2011-03-28
02:51:02 UTC (rev 10387)
+++
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2011-03-28
02:56:29 UTC (rev 10388)
@@ -55,12 +55,12 @@
protected void setUp() throws Exception
{
super.setUp();
- setupServer(JournalType.ASYNCIO);
+ setupServer(JournalType.NIO);
}
public void testProduceAndConsume() throws Throwable
{
- int numberOfConsumers = 60;
+ int numberOfConsumers = 5;
// this test assumes numberOfConsumers == numberOfProducers
int numberOfProducers = numberOfConsumers;
int produceMessage = 10000;
@@ -120,7 +120,7 @@
server.stop();
- setupServer(JournalType.ASYNCIO);
+ setupServer(JournalType.NIO);
ClientSession sess = sf.createSession(true, true);
Modified: trunk/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-03-28
02:51:02 UTC (rev 10387)
+++ trunk/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-03-28
02:56:29 UTC (rev 10388)
@@ -36,7 +36,6 @@
import org.hornetq.core.paging.cursor.PagedReference;
import org.hornetq.core.paging.cursor.impl.PageCursorProviderImpl;
import org.hornetq.core.paging.cursor.impl.PagePositionImpl;
-import org.hornetq.core.paging.cursor.impl.PageSubscriptionImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
@@ -527,12 +526,10 @@
assertNull(iterator.next());
}
- server.stop();
-
OperationContextImpl.clearContext();
+
+ ctx = generateCTX();
- createServer();
-
pageStore = lookupPageStore(ADDRESS);
cursor =
this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier().getSubscription(queue.getID());
@@ -563,12 +560,8 @@
assertEquals(i,
readMessage.getMessage().getIntProperty("key").intValue());
}
- server.stop();
-
OperationContextImpl.clearContext();
- createServer();
-
pageStore = lookupPageStore(ADDRESS);
cursor =
this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier().getSubscription(queue.getID());
@@ -919,63 +912,6 @@
}
- public void testCloseNonPersistentConsumer() throws Exception
- {
-
- final int NUM_MESSAGES = 100;
-
- PageCursorProvider cursorProvider = lookupCursorProvider();
-
- PageSubscription cursor = cursorProvider.createSubscription(11, null, false);
- PageSubscriptionImpl cursor2 =
(PageSubscriptionImpl)cursorProvider.createSubscription(12, null, false);
-
- this.queueList.add(new FakeQueue(new SimpleString("a"), 11));
-
- this.queueList.add(new FakeQueue(new SimpleString("b"), 12));
-
- int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
-
- System.out.println("NumberOfPages = " + numberOfPages);
-
- queue.getPageSubscription().close();
-
- PagedReference msg;
- LinkedListIterator<PagedReference> iterator = cursor.iterator();
- LinkedListIterator<PagedReference> iterator2 = cursor2.iterator();
-
- cursor2.bookmark(new PagePositionImpl(1, -1));
-
- int key = 0;
- while ((msg = iterator.next()) != null)
- {
- System.out.println("key = " + key);
- assertEquals(key++,
msg.getMessage().getIntProperty("key").intValue());
- cursor.ack(msg);
- }
- assertEquals(NUM_MESSAGES, key);
-
- forceGC();
-
- for (int i = 0; i < 10; i++)
- {
- assertTrue(iterator2.hasNext());
- msg = iterator2.next();
- assertEquals(i, msg.getMessage().getIntProperty("key").intValue());
- }
-
- assertSame(cursor2.getProvider(), cursorProvider);
-
- cursor2.close();
-
- lookupPageStore(ADDRESS).flushExecutors();
-
- server.stop();
- createServer();
- waitCleanup();
- assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
-
- }
-
public void testNoCursors() throws Exception
{
@@ -1000,54 +936,6 @@
}
- public void testFirstMessageInTheMiddle() throws Exception
- {
-
- final int NUM_MESSAGES = 100;
-
- PageCursorProvider cursorProvider = lookupCursorProvider();
-
- PageSubscription cursor = cursorProvider.createSubscription(2, null, false);
-
- queueList.add(new FakeQueue(new SimpleString("tmp"), 2));
-
- int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
-
- System.out.println("NumberOfPages = " + numberOfPages);
-
- PageCache cache = cursorProvider.getPageCache(new PagePositionImpl(5, 0));
-
- queue.getPageSubscription().close();
-
- PagePosition startingPos = new PagePositionImpl(5, cache.getNumberOfMessages() /
2);
- cursor.bookmark(startingPos);
- PagedMessage msg = cache.getMessage(startingPos.getMessageNr() + 1);
- msg.initMessage(server.getStorageManager());
- int key = msg.getMessage().getIntProperty("key").intValue();
-
- msg = null;
-
- cache = null;
- LinkedListIterator<PagedReference> iterator = cursor.iterator();
-
- PagedReference msgCursor = null;
- while ((msgCursor = iterator.next()) != null)
- {
- assertEquals(key++,
msgCursor.getMessage().getIntProperty("key").intValue());
- cursor.ack(msgCursor);
- }
- assertEquals(NUM_MESSAGES, key);
-
- forceGC();
-
- // assertTrue(cursorProvider.getCacheSize() < numberOfPages);
-
- server.stop();
- createServer();
- waitCleanup();
- assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
- }
-
public void testFirstMessageInTheMiddlePersistent() throws Exception
{
@@ -1264,6 +1152,8 @@
server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String,
AddressSettings>());
server.start();
+
+ queueList.clear();
try
{
Modified: trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2011-03-28
02:51:02 UTC (rev 10387)
+++ trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2011-03-28
02:56:29 UTC (rev 10388)
@@ -221,15 +221,9 @@
ClientConsumer consumers[] = new ClientConsumer[] {
session.createConsumer(queue[0]),
session.createConsumer(queue[1]) };
- int reads = 0;
-
while (true)
{
int msgs1 = readMessages(session, consumers[0], queue[0]);
- if (reads++ == 0)
- {
- Assert.assertTrue(msgs1 > 0 && msgs1 < NUMBER_OF_MESSAGES);
- }
int msgs2 = readMessages(session, consumers[1], queue[1]);
counters[0] += msgs1;
counters[1] += msgs2;