NO-JIRA: remove some test methods that are permanently disabled in one or more ways
This commit is contained in:
parent
30d27c6226
commit
5e7ecfcc8a
|
@ -328,8 +328,4 @@ public class JmsTempDestinationTest {
|
|||
Assert.assertTrue("failed to throw an exception", true);
|
||||
}
|
||||
}
|
||||
|
||||
//removed. the original test is only for vm transport. tcp transport will block anyway.
|
||||
public void testSlowConsumerDoesNotBlockFastTempUsers() throws Exception {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,34 +152,6 @@ public class ConfigTest {
|
|||
adapter.stop();
|
||||
}
|
||||
|
||||
public void testJdbcLockConfigDefault() throws Exception {
|
||||
|
||||
JDBCPersistenceAdapter adapter = new JDBCPersistenceAdapter();
|
||||
Mockery context = new Mockery();
|
||||
final DataSource dataSource = context.mock(DataSource.class);
|
||||
final Connection connection = context.mock(Connection.class);
|
||||
final DatabaseMetaData metadata = context.mock(DatabaseMetaData.class);
|
||||
final ResultSet result = context.mock(ResultSet.class);
|
||||
adapter.setDataSource(dataSource);
|
||||
adapter.setCreateTablesOnStartup(false);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
allowing(dataSource).getConnection();
|
||||
will(returnValue(connection));
|
||||
allowing(connection).getMetaData();
|
||||
will(returnValue(metadata));
|
||||
allowing(connection);
|
||||
allowing(metadata).getDriverName();
|
||||
will(returnValue("Some_Unknown_driver"));
|
||||
allowing(result).next();
|
||||
will(returnValue(true));
|
||||
}});
|
||||
|
||||
adapter.start();
|
||||
assertEquals("has the default locker", adapter.getLocker().getClass(), DefaultDatabaseLocker.class);
|
||||
adapter.stop();
|
||||
}
|
||||
|
||||
/*
|
||||
* This tests configuring the different broker properties using
|
||||
* xbeans-spring
|
||||
|
|
|
@ -63,166 +63,6 @@ public class AMQ1925Test extends OpenwireArtemisBaseTest implements ExceptionLis
|
|||
|
||||
private JMSException exception;
|
||||
|
||||
public void XtestAMQ1925_TXInProgress() throws Exception {
|
||||
Connection connection = cf.createConnection();
|
||||
connection.start();
|
||||
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
|
||||
MessageConsumer consumer = session.createConsumer(session.createQueue(QUEUE_NAME));
|
||||
|
||||
// The runnable is likely to interrupt during the session#commit, since
|
||||
// this takes the longest
|
||||
final CountDownLatch starter = new CountDownLatch(1);
|
||||
final AtomicBoolean restarted = new AtomicBoolean();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
starter.await();
|
||||
|
||||
// Simulate broker failure & restart
|
||||
bs.stop();
|
||||
bs = createNewServer();
|
||||
bs.start();
|
||||
|
||||
restarted.set(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
for (int i = 0; i < MESSAGE_COUNT; i++) {
|
||||
Message message = consumer.receive(500);
|
||||
Assert.assertNotNull("No Message " + i + " found", message);
|
||||
|
||||
if (i < 10)
|
||||
Assert.assertFalse("Timing problem, restarted too soon", restarted.get());
|
||||
if (i == 10) {
|
||||
starter.countDown();
|
||||
}
|
||||
if (i > MESSAGE_COUNT - 100) {
|
||||
Assert.assertTrue("Timing problem, restarted too late", restarted.get());
|
||||
}
|
||||
|
||||
Assert.assertEquals(i, message.getIntProperty(PROPERTY_MSG_NUMBER));
|
||||
session.commit();
|
||||
}
|
||||
Assert.assertNull(consumer.receive(500));
|
||||
|
||||
consumer.close();
|
||||
session.close();
|
||||
connection.close();
|
||||
|
||||
assertQueueEmpty();
|
||||
}
|
||||
|
||||
public void XtestAMQ1925_TXInProgress_TwoConsumers() throws Exception {
|
||||
Connection connection = cf.createConnection();
|
||||
connection.start();
|
||||
Session session1 = connection.createSession(true, Session.SESSION_TRANSACTED);
|
||||
MessageConsumer consumer1 = session1.createConsumer(session1.createQueue(QUEUE_NAME));
|
||||
Session session2 = connection.createSession(true, Session.SESSION_TRANSACTED);
|
||||
MessageConsumer consumer2 = session2.createConsumer(session2.createQueue(QUEUE_NAME));
|
||||
|
||||
// The runnable is likely to interrupt during the session#commit, since
|
||||
// this takes the longest
|
||||
final CountDownLatch starter = new CountDownLatch(1);
|
||||
final AtomicBoolean restarted = new AtomicBoolean();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
starter.await();
|
||||
|
||||
// Simulate broker failure & restart
|
||||
bs.stop();
|
||||
bs = createNewServer();
|
||||
bs.start();
|
||||
|
||||
restarted.set(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
Collection<Integer> results = new ArrayList<>(MESSAGE_COUNT);
|
||||
for (int i = 0; i < MESSAGE_COUNT; i++) {
|
||||
Message message1 = consumer1.receive(20);
|
||||
Message message2 = consumer2.receive(20);
|
||||
if (message1 == null && message2 == null) {
|
||||
if (results.size() < MESSAGE_COUNT) {
|
||||
message1 = consumer1.receive(500);
|
||||
message2 = consumer2.receive(500);
|
||||
|
||||
if (message1 == null && message2 == null) {
|
||||
// Missing messages
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i < 10)
|
||||
Assert.assertFalse("Timing problem, restarted too soon", restarted.get());
|
||||
if (i == 10) {
|
||||
starter.countDown();
|
||||
}
|
||||
if (i > MESSAGE_COUNT - 50) {
|
||||
Assert.assertTrue("Timing problem, restarted too late", restarted.get());
|
||||
}
|
||||
|
||||
if (message1 != null) {
|
||||
results.add(message1.getIntProperty(PROPERTY_MSG_NUMBER));
|
||||
session1.commit();
|
||||
}
|
||||
if (message2 != null) {
|
||||
results.add(message2.getIntProperty(PROPERTY_MSG_NUMBER));
|
||||
session2.commit();
|
||||
}
|
||||
}
|
||||
Assert.assertNull(consumer1.receive(500));
|
||||
Assert.assertNull(consumer2.receive(500));
|
||||
|
||||
consumer1.close();
|
||||
session1.close();
|
||||
consumer2.close();
|
||||
session2.close();
|
||||
connection.close();
|
||||
|
||||
int foundMissingMessages = 0;
|
||||
if (results.size() < MESSAGE_COUNT) {
|
||||
foundMissingMessages = tryToFetchMissingMessages();
|
||||
}
|
||||
for (int i = 0; i < MESSAGE_COUNT; i++) {
|
||||
Assert.assertTrue("Message-Nr " + i + " not found (" + results.size() + " total, " + foundMissingMessages + " have been found 'lingering' in the queue)", results.contains(i));
|
||||
}
|
||||
assertQueueEmpty();
|
||||
}
|
||||
|
||||
private int tryToFetchMissingMessages() throws JMSException {
|
||||
Connection connection = cf.createConnection();
|
||||
connection.start();
|
||||
Session session = connection.createSession(true, 0);
|
||||
MessageConsumer consumer = session.createConsumer(session.createQueue(QUEUE_NAME));
|
||||
|
||||
int count = 0;
|
||||
while (true) {
|
||||
Message message = consumer.receive(500);
|
||||
if (message == null)
|
||||
break;
|
||||
|
||||
log.info("Found \"missing\" message: " + message);
|
||||
count++;
|
||||
}
|
||||
|
||||
consumer.close();
|
||||
session.close();
|
||||
connection.close();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAMQ1925_TXBegin() throws Exception {
|
||||
Connection connection = cf.createConnection();
|
||||
|
|
|
@ -272,42 +272,6 @@ public class FailoverTransportBrokerTest extends OpenwireArtemisBaseTest {
|
|||
|
||||
}
|
||||
|
||||
public void testNoBrokersInBrokerInfo() throws Exception {
|
||||
final BrokerInfo info[] = new BrokerInfo[1];
|
||||
TransportListener listener = new TransportListener() {
|
||||
@Override
|
||||
public void onCommand(Object command) {
|
||||
LOG.info("Got command: " + command);
|
||||
if (command instanceof BrokerInfo) {
|
||||
info[0] = (BrokerInfo) command;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(IOException error) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transportInterupted() {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transportResumed() {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
};
|
||||
@SuppressWarnings("unused")
|
||||
StubConnection c = createFailoverConnection(listener);
|
||||
int count = 0;
|
||||
while (count++ < 20 && info[0] == null) {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
}
|
||||
Assert.assertNotNull("got a valid brokerInfo after 20 secs", info[0]);
|
||||
Assert.assertNull("no peer brokers present", info[0].getPeerBrokerInfos());
|
||||
}
|
||||
|
||||
protected StubConnection createFailoverConnection(TransportListener listener) throws Exception {
|
||||
URI failoverURI = new URI("failover://" + newURI(0) + "," + newURI(1) + "");
|
||||
Transport transport = TransportFactory.connect(failoverURI);
|
||||
|
|
Loading…
Reference in New Issue