mirror of https://github.com/apache/activemq.git
Tweaking some unit tests to improve reliability
This commit is contained in:
parent
ee4672baaf
commit
d2bd152960
|
@ -64,6 +64,9 @@ public class AutoNIOTransport extends NIOTransport {
|
|||
if (nextFrameSize == -1) {
|
||||
readSize = 4;
|
||||
this.initBuffer.buffer.flip();
|
||||
if (this.initBuffer.buffer.remaining() < 8) {
|
||||
throw new IOException("Protocol type could not be determined.");
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
currentBuffer.put(initBuffer.buffer.get());
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
|
|||
verifyStoreStats(dest, 0, 0);
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testTopicMessageSize() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -205,7 +205,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
|
|||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testTopicNonPersistentMessageSize() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -232,7 +232,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
|
|||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testTopicPersistentAndNonPersistentMessageSize() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -261,7 +261,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
|
|||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeOneDurable() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
|
||||
|
@ -286,7 +286,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
|
|||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeOneDurablePartialConsumption() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -312,7 +312,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
|
|||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeTwoDurables() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class KahaDBPendingMessageCursorTest extends
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testDurableMessageSizeAfterRestartAndPublish() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class KahaDBPendingMessageCursorTest extends
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testNonPersistentDurableMessageSize() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
|
|||
|
||||
protected abstract void initPersistence(BrokerService brokerService) throws IOException;
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSize() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -100,7 +100,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
|
|||
verifyStats(dest, 200, publishedMessageSize.get());
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeAfterConsumption() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -112,7 +112,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
|
|||
verifyStats(dest, 0, 0);
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeOneDurable() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
|
||||
|
@ -133,7 +133,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
|
|||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeTwoDurables() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
|
||||
|
|
|
@ -65,7 +65,7 @@ public class KahaDBMessageStoreSizeStatTest extends
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeAfterRestartAndPublish() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
Destination dest = publishTestQueueMessages(200, publishedMessageSize);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeAfterRestartAndPublish() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
|
|||
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Test(timeout=60000)
|
||||
public void testMessageSizeAfterRestartAndPublishMultiQueue() throws Exception {
|
||||
AtomicLong publishedMessageSize = new AtomicLong();
|
||||
AtomicLong publishedMessageSize2 = new AtomicLong();
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class AutoTransportMaxConnectionsTest {
|
||||
|
@ -95,18 +94,22 @@ public class AutoTransportMaxConnectionsTest {
|
|||
return new ActiveMQConnectionFactory(connectionUri);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout=60000)
|
||||
public void testMaxConnectionControl() throws Exception {
|
||||
final ConnectionFactory cf = createConnectionFactory();
|
||||
final CountDownLatch startupLatch = new CountDownLatch(1);
|
||||
|
||||
for(int i = 0; i < maxConnections + 20; i++) {
|
||||
//create an extra 10 connections above max
|
||||
for(int i = 0; i < maxConnections + 10; i++) {
|
||||
final int count = i;
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Connection conn = null;
|
||||
try {
|
||||
startupLatch.await();
|
||||
//sleep for a short period of time
|
||||
Thread.sleep(count * 3);
|
||||
conn = cf.createConnection();
|
||||
conn.start();
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue