Propchange: qpid/branches/java-broker-0-10/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java:796196-816580 +/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java:796196-820933
Propchange: qpid/branches/java-broker-0-10/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java:796196-816580 +/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java:796196-820933 Propchange: qpid/branches/java-broker-0-10/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Contents/MacOS/qpidmc ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Contents/MacOS/qpidmc:796196-816580 +/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Contents/MacOS/qpidmc:796196-820933 Modified: qpid/branches/java-broker-0-10/qpid/java/module.xml URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/module.xml?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/module.xml (original) +++ qpid/branches/java-broker-0-10/qpid/java/module.xml Mon Oct 5 13:29:44 2009 @@ -261,6 +261,7 @@ <jvmarg value="${jvm.args}"/> <sysproperty key="amqj.logging.level" value="${amqj.logging.level}"/> + <sysproperty key="amqj.server.logging.level" value="${amqj.server.logging.level}"/> <sysproperty key="amqj.protocol.logging.level" value="${amqj.protocol.logging.level}"/> <sysproperty key="log4j.debug" value="${log4j.debug}"/> <sysproperty key="root.logging.level" value="${root.logging.level}"/> @@ -269,6 +270,7 @@ <sysproperty key="java.naming.provider.url" value="${java.naming.provider.url}"/> <sysproperty key="broker" value="${broker}"/> <sysproperty key="broker.clean" value="${broker.clean}"/> + <sysproperty key="broker.clean.between.tests" value="${broker.clean.between.tests}"/> <sysproperty key="broker.version" value="${broker.version}"/> <sysproperty key="broker.ready" value="${broker.ready}" /> <sysproperty key="broker.stopped" value="${broker.stopped}" /> Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java Mon Oct 5 13:29:44 2009 @@ -78,15 +78,23 @@ // Add an invalid value _broker += " -l invalid"; - // The release-bin build of the broker uses this log4j configuration - // so set up the broker environment to use it for this test. - // Also include -Dlog4j.debug so we can validate that it picked up this config - setBrokerEnvironment("QPID_OPTS", "-Dlog4j.debug -Dlog4j.configuration=file:" + System.getProperty(QPID_HOME) + "/../broker/src/main/java/log4j.properties"); + // The broker has a built in default log4j configuration set up + // so if the the broker cannot load the -l value it will use default + // use this default. Test that this is correctly loaded, by + // including -Dlog4j.debug so we can validate. + setBrokerEnvironment("QPID_OPTS", "-Dlog4j.debug"); // Disable all client logging so we can test for broker DEBUG only. - Logger.getRootLogger().setLevel(Level.WARN); - Logger.getLogger("qpid.protocol").setLevel(Level.WARN); - Logger.getLogger("org.apache.qpid").setLevel(Level.WARN); + setLoggerLevel(Logger.getRootLogger(), Level.WARN); + setLoggerLevel(Logger.getLogger("qpid.protocol"), Level.WARN); + setLoggerLevel(Logger.getLogger("org.apache.qpid"), Level.WARN); + + // Set the broker to use info level logging, which is the qpid-server + // default. Rather than debug which is the test default. + setBrokerOnlySystemProperty("amqj.server.logging.level", "info"); + // Set the logging defaults to info for this test. + setBrokerOnlySystemProperty("amqj.logging.level", "info"); + setBrokerOnlySystemProperty("root.logging.level", "info"); startBroker(); Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java Mon Oct 5 13:29:44 2009 @@ -160,7 +160,7 @@ // Set the broker.ready string to check for the _log4j default that // is still present on standard out. - System.setProperty(BROKER_READY, "Qpid Broker Ready"); + setTestClientSystemProperty(BROKER_READY, "Qpid Broker Ready"); startBroker(); Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java Mon Oct 5 13:29:44 2009 @@ -61,7 +61,7 @@ setupSession(); - _queue = _clientSession.createQueue(getName()+System.currentTimeMillis()); + _queue = _clientSession.createQueue(getTestQueueName()); _clientSession.createConsumer(_queue).close(); //Ensure there are no messages on the queue to start with. Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java Mon Oct 5 13:29:44 2009 @@ -22,64 +22,172 @@ import org.apache.qpid.test.utils.*; import javax.jms.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; +import junit.framework.ComparisonFailure; +import junit.framework.AssertionFailedError; /** - * RollbackOrderTest + * RollbackOrderTest, QPID-1864, QPID-1871 + * + * Description: + * + * The problem that this test is exposing is that the dispatcher used to be capable + * of holding on to a message when stopped. This ment that when the rollback was + * called and the dispatcher stopped it may have hold of a message. So after all + * the local queues(preDeliveryQueue, SynchronousQueue, PostDeliveryTagQueue) + * have been cleared the client still had a single message, the one the + * dispatcher was holding on to. + * + * As a result the TxRollback operation would run and then release the dispatcher. + * Whilst the dispatcher would then proceed to reject the message it was holiding + * the Broker would already have resent that message so the rejection would silently + * fail. + * + * And the client would receieve that single message 'early', depending on the + * number of messages already recevied when rollback was called. + * + * + * Aims: + * + * The tests puts 50 messages on to the queue. + * + * The test then tries to cause the dispatcher to stop whilst it is in the process + * of moving a message from the preDeliveryQueue to a consumers sychronousQueue. + * + * To exercise this path we have 50 message flowing to the client to give the + * dispatcher a bit of work to do moving messages. + * + * Then we loop - 10 times + * - Validating that the first message received is always message 1. + * - Receive a few more so that there are a few messages to reject. + * - call rollback, to try and catch the dispatcher mid process. + * + * Outcome: + * + * The hope is that we catch the dispatcher mid process and cause a BasicReject + * to fail. Which will be indicated in the log but will also cause that failed + * rejected message to be the next to be delivered which will not be message 1 + * as expected. + * + * We are testing a race condition here but we can check through the log file if + * the race condition occured. However, performing that check will only validate + * the problem exists and will not be suitable as part of a system test. * */ - public class RollbackOrderTest extends QpidTestCase { - private Connection conn; - private Queue queue; - private Session ssn; - private MessageProducer prod; - private MessageConsumer cons; + private Connection _connection; + private Queue _queue; + private Session _session; + private MessageConsumer _consumer; @Override public void setUp() throws Exception { super.setUp(); - conn = getConnection(); - conn.start(); - ssn = conn.createSession(true, Session.AUTO_ACKNOWLEDGE); - queue = ssn.createQueue("rollback-order-test-queue"); - prod = ssn.createProducer(queue); - cons = ssn.createConsumer(queue); - for (int i = 0; i < 5; i++) - { - TextMessage msg = ssn.createTextMessage("message " + (i+1)); - prod.send(msg); - } - ssn.commit(); + _connection = getConnection(); + + _session = _connection.createSession(true, Session.SESSION_TRANSACTED); + _queue = _session.createQueue(getTestQueueName()); + _consumer = _session.createConsumer(_queue); + + //Send more messages so it is more likely that the dispatcher is + // processing on rollback. + sendMessage(_session, _queue, 50); + _session.commit(); + } public void testOrderingAfterRollback() throws Exception { - for (int i = 0; i < 10; i++) + //Start the session now so we + _connection.start(); + + for (int i = 0; i < 20; i++) { - TextMessage msg = (TextMessage) cons.receive(); - assertEquals("message 1", msg.getText()); - ssn.rollback(); + Message msg = _consumer.receive(); + assertEquals("Incorrect Message Received", 0, msg.getIntProperty(INDEX)); + + // Pull additional messages through so we have some reject work to do + for (int m=0; m < 5 ; m++) + { + _consumer.receive(); + } + + System.err.println("ROT-Rollback"); + _logger.warn("ROT-Rollback"); + _session.rollback(); } } - @Override public void tearDown() throws Exception + public void testOrderingAfterRollbackOnMessage() throws Exception { - while (true) + final CountDownLatch count= new CountDownLatch(20); + final Exception exceptions[] = new Exception[20]; + final AtomicBoolean failed = new AtomicBoolean(false); + + _consumer.setMessageListener(new MessageListener() { - Message msg = cons.receiveNoWait(); - if (msg == null) + + public void onMessage(Message message) { - break; + + Message msg = message; + try + { + count.countDown(); + assertEquals("Incorrect Message Received", 0, msg.getIntProperty(INDEX)); + + _session.rollback(); + } + catch (JMSException e) + { + System.out.println("Error:" + e.getMessage()); + exceptions[(int)count.getCount()] = e; + } + catch (AssertionFailedError cf) + { + // End Test if Equality test fails + while (count.getCount() != 0) + { + count.countDown(); + } + + System.out.println("Error:" + cf.getMessage()); + System.err.println(cf.getMessage()); + cf.printStackTrace(); + failed.set(true); + } } - else + }); + //Start the session now so we + _connection.start(); + + count.await(); + + for (Exception e : exceptions) + { + if (e != null) { - msg.acknowledge(); + System.err.println(e.getMessage()); + e.printStackTrace(); + failed.set(true); } } - ssn.commit(); + +// _consumer.close(); + _connection.close(); + + assertFalse("Exceptions thrown during test run, Check Std.err.", failed.get()); + } + + @Override public void tearDown() throws Exception + { + + drainQueue(_queue); + super.tearDown(); } Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java Mon Oct 5 13:29:44 2009 @@ -22,9 +22,7 @@ import java.util.concurrent.CountDownLatch; -import javax.jms.Connection; import javax.jms.DeliveryMode; -import javax.jms.Destination; import javax.jms.InvalidSelectorException; import javax.jms.JMSException; import javax.jms.Message; @@ -35,15 +33,12 @@ import junit.framework.Assert; -import org.apache.log4j.BasicConfigurator; -import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQQueue; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.BasicMessageProducer; import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.url.URLSyntaxException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,7 +48,6 @@ private AMQConnection _connection; private AMQDestination _destination; - private AMQSession _session; private int count; public String _connectionString = "vm://:1"; private static final String INVALID_SELECTOR = "Cost LIKE 5"; @@ -66,40 +60,12 @@ protected void setUp() throws Exception { super.setUp(); - BasicConfigurator.configure(); init((AMQConnection) getConnection("guest", "guest")); } - protected void tearDown() throws Exception - { - super.tearDown(); - if (_session != null) - { - try - { - _session.close(); - } - catch (JMSException e) - { - fail("Error cleaning up:" + e.getMessage()); - } - } - if (_connection != null) - { - try - { - _connection.close(); - } - catch (JMSException e) - { - fail("Error cleaning up:" + e.getMessage()); - } - } - } - private void init(AMQConnection connection) throws JMSException { - init(connection, new AMQQueue(connection, randomize("SessionStartTest"), true)); + init(connection, new AMQQueue(connection, getTestQueueName(), true)); } private void init(AMQConnection connection, AMQDestination destination) throws JMSException @@ -107,23 +73,27 @@ _connection = connection; _destination = destination; connection.start(); + } + + public void onMessage(Message message) + { + count++; + _logger.info("Got Message:" + message); + _responseLatch.countDown(); + } - String selector = null; - selector = "Cost = 2 AND \"property-with-hyphen\" = 'wibble'"; + public void testUsingOnMessage() throws Exception + { + String selector = "Cost = 2 AND \"property-with-hyphen\" = 'wibble'"; // selector = "JMSType = Special AND Cost = 2 AND AMQMessageID > 0 AND JMSDeliveryMode=" + DeliveryMode.NON_PERSISTENT; - _session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE); + Session session = (AMQSession) _connection.createSession(false, AMQSession.NO_ACKNOWLEDGE); // _session.createConsumer(destination).setMessageListener(this); - _session.createConsumer(destination, selector).setMessageListener(this); - } + session.createConsumer(_destination, selector).setMessageListener(this); - public void test() throws Exception - { try { - init((AMQConnection) getConnection("guest", "guest", randomize("Client"))); - - Message msg = _session.createTextMessage("Message"); + Message msg = session.createTextMessage("Message"); msg.setJMSPriority(1); msg.setIntProperty("Cost", 2); msg.setStringProperty("property-with-hyphen", "wibble"); @@ -131,7 +101,7 @@ _logger.info("Sending Message:" + msg); - ((BasicMessageProducer) _session.createProducer(_destination)).send(msg, DeliveryMode.NON_PERSISTENT); + ((BasicMessageProducer) session.createProducer(_destination)).send(msg, DeliveryMode.NON_PERSISTENT); _logger.info("Message sent, waiting for response..."); _responseLatch.await(); @@ -163,40 +133,18 @@ { _logger.debug("IE :" + e.getClass().getSimpleName() + ":" + e.getMessage()); } - catch (URLSyntaxException e) - { - _logger.debug("URL:" + e.getClass().getSimpleName() + ":" + e.getMessage()); - fail("Wrong exception"); - } - catch (AMQException e) - { - _logger.debug("AMQ:" + e.getClass().getSimpleName() + ":" + e.getMessage()); - fail("Wrong exception"); - } - finally - { - if (_session != null) - { - _session.close(); - } - if (_connection != null) - { - _connection.close(); - } - } } public void testUnparsableSelectors() throws Exception { - Connection connection = getConnection("guest", "guest", randomize("Client")); - _session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE); + AMQSession session = (AMQSession) _connection.createSession(false, AMQSession.NO_ACKNOWLEDGE); boolean caught = false; //Try Creating a Browser try { - _session.createBrowser(_session.createQueue("Ping"), INVALID_SELECTOR); + session.createBrowser(session.createQueue("Ping"), INVALID_SELECTOR); } catch (JMSException e) { @@ -213,7 +161,7 @@ //Try Creating a Consumer try { - _session.createConsumer(_session.createQueue("Ping"), INVALID_SELECTOR); + session.createConsumer(session.createQueue("Ping"), INVALID_SELECTOR); } catch (JMSException e) { @@ -230,7 +178,7 @@ //Try Creating a Receiever try { - _session.createReceiver(_session.createQueue("Ping"), INVALID_SELECTOR); + session.createReceiver(session.createQueue("Ping"), INVALID_SELECTOR); } catch (JMSException e) { @@ -246,7 +194,7 @@ try { - _session.createReceiver(_session.createQueue("Ping"), BAD_MATHS_SELECTOR); + session.createReceiver(session.createQueue("Ping"), BAD_MATHS_SELECTOR); } catch (JMSException e) { @@ -264,9 +212,10 @@ public void testRuntimeSelectorError() throws JMSException { - MessageConsumer consumer = _session.createConsumer(_destination , "testproperty % 5 = 1"); - MessageProducer producer = _session.createProducer(_destination); - Message sentMsg = _session.createTextMessage(); + Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageConsumer consumer = session.createConsumer(_destination , "testproperty % 5 = 1"); + MessageProducer producer = session.createProducer(_destination); + Message sentMsg = session.createTextMessage(); sentMsg.setIntProperty("testproperty", 1); // 1 % 5 producer.send(sentMsg); @@ -289,9 +238,7 @@ public void testSelectorWithJMSMessageID() throws Exception { - Connection conn = getConnection(); - conn.start(); - Session session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE); + Session session = _connection.createSession(true, Session.SESSION_TRANSACTED); MessageProducer prod = session.createProducer(_destination); MessageConsumer consumer = session.createConsumer(_destination,"JMSMessageID IS NOT NULL"); @@ -332,18 +279,6 @@ Assert.assertNotNull("Msg5 should not be null", msg5); } - public void onMessage(Message message) - { - count++; - _logger.info("Got Message:" + message); - _responseLatch.countDown(); - } - - private static String randomize(String in) - { - return in + System.currentTimeMillis(); - } - public static void main(String[] argv) throws Exception { SelectorTest test = new SelectorTest(); @@ -357,7 +292,7 @@ { test.setUp(); } - test.test(); + test.testUsingOnMessage(); if (test._connectionString.contains("vm://:1")) { @@ -371,9 +306,4 @@ e.printStackTrace(); } } - - public static junit.framework.Test suite() - { - return new junit.framework.TestSuite(SelectorTest.class); - } } Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java Mon Oct 5 13:29:44 2009 @@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory; import javax.jms.Destination; +import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.ObjectMessage; @@ -105,7 +106,8 @@ assertEquals("JMS Type mismatch", sentMsg.getJMSType(), rm.getJMSType()); assertEquals("JMS Reply To mismatch", sentMsg.getJMSReplyTo(), rm.getJMSReplyTo()); assertTrue("JMSMessageID Does not start ID:", rm.getJMSMessageID().startsWith("ID:")); - + assertEquals("JMS Default priority should be 4",Message.DEFAULT_PRIORITY,rm.getJMSPriority()); + //Validate that the JMSX values are correct assertEquals("JMSXGroupID is not as expected:", JMSXGroupID_VALUE, rm.getStringProperty("JMSXGroupID")); assertEquals("JMSXGroupSeq is not as expected:", JMSXGroupSeq_VALUE, rm.getIntProperty("JMSXGroupSeq")); Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java Mon Oct 5 13:29:44 2009 @@ -22,13 +22,11 @@ import javax.jms.Connection; -import org.apache.qpid.util.FileUtils; - public class FailoverBaseCase extends QpidTestCase { public static int FAILING_VM_PORT = 2; - public static int FAILING_PORT = DEFAULT_PORT + 100; + public static int FAILING_PORT = Integer.parseInt(System.getProperty("test.port.alt")); protected int failingPort; @@ -54,7 +52,7 @@ protected void setUp() throws java.lang.Exception { super.setUp(); - setSystemProperty("QPID_WORK", System.getProperty("java.io.tmpdir")+"/"+getFailingPort()); + setSystemProperty("QPID_WORK", System.getProperty("QPID_WORK")+"/"+getFailingPort()); startBroker(failingPort); } @@ -78,7 +76,6 @@ { stopBroker(_broker.equals(VM)?FAILING_PORT:FAILING_PORT); super.tearDown(); - FileUtils.deleteDirectory(System.getProperty("java.io.tmpdir")+"/"+getFailingPort()); } Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java (original) +++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java Mon Oct 5 13:29:44 2009 @@ -32,6 +32,7 @@ import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry; import org.apache.qpid.server.store.DerbyMessageStore; import org.apache.qpid.url.URLSyntaxException; +import org.apache.log4j.Level; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,11 +71,14 @@ protected final String QpidHome = System.getProperty("QPID_HOME"); protected File _configFile = new File(System.getProperty("broker.config")); - private static final Logger _logger = LoggerFactory.getLogger(QpidTestCase.class); + protected static final Logger _logger = LoggerFactory.getLogger(QpidTestCase.class); protected long RECEIVE_TIMEOUT = 1000l; - private Map<String, String> _setProperties = new HashMap<String, String>(); + private Map<String, String> _propertiesSetForTestOnly = new HashMap<String, String>(); + private Map<String, String> _propertiesSetForBroker = new HashMap<String, String>(); + private Map<org.apache.log4j.Logger, Level> _loggerLevelSetForTest = new HashMap<org.apache.log4j.Logger, Level>(); + private XMLConfiguration _testConfiguration = new XMLConfiguration(); /** @@ -147,6 +151,7 @@ private static final String BROKER_LANGUAGE = "broker.language"; private static final String BROKER = "broker"; private static final String BROKER_CLEAN = "broker.clean"; + private static final String BROKER_CLEAN_BETWEEN_TESTS = "broker.clean.between.tests"; private static final String BROKER_VERSION = "broker.version"; protected static final String BROKER_READY = "broker.ready"; private static final String BROKER_STOPPED = "broker.stopped"; @@ -169,6 +174,7 @@ protected String _brokerLanguage = System.getProperty(BROKER_LANGUAGE, JAVA); protected String _broker = System.getProperty(BROKER, VM); private String _brokerClean = System.getProperty(BROKER_CLEAN, null); + private Boolean _brokerCleanBetweenTests = Boolean.getBoolean(BROKER_CLEAN_BETWEEN_TESTS); private String _brokerVersion = System.getProperty(BROKER_VERSION, VERSION_08); private String _output = System.getProperty(TEST_OUTPUT); @@ -187,6 +193,8 @@ public static final String TOPIC = "topic"; /** Map to hold test defined environment properties */ private Map<String, String> _env; + protected static final String INDEX = "index"; + ; public QpidTestCase(String name) { @@ -235,6 +243,19 @@ { _logger.error("exception stopping broker", e); } + + if(_brokerCleanBetweenTests) + { + try + { + cleanBroker(); + } + catch (Exception e) + { + _logger.error("exception cleaning up broker", e); + } + } + _logger.info("========== stop " + _testName + " =========="); if (redirected) @@ -451,6 +472,15 @@ env.put("QPID_PNAME", "-DPNAME=QPBRKR -DTNAME=\"" + _testName + "\""); env.put("QPID_WORK", System.getProperty("QPID_WORK")); + + // Use the environment variable to set amqj.logging.level for the broker + // The value used is a 'server' value in the test configuration to + // allow a differentiation between the client and broker logging levels. + if (System.getProperty("amqj.server.logging.level") != null) + { + setBrokerEnvironment("AMQJ_LOGGING_LEVEL", System.getProperty("amqj.server.logging.level")); + } + // Add all the environment settings the test requested if (!_env.isEmpty()) { @@ -460,13 +490,27 @@ } } + + // Add default test logging levels that are used by the log4j-test + // Use the convenience methods to push the current logging setting + // in to the external broker's QPID_OPTS string. + if (System.getProperty("amqj.protocol.logging.level") != null) + { + setSystemProperty("amqj.protocol.logging.level"); + } + if (System.getProperty("root.logging.level") != null) + { + setSystemProperty("root.logging.level"); + } + + String QPID_OPTS = " "; // Add all the specified system properties to QPID_OPTS - if (!_setProperties.isEmpty()) + if (!_propertiesSetForBroker.isEmpty()) { - for (String key : _setProperties.keySet()) + for (String key : _propertiesSetForBroker.keySet()) { - QPID_OPTS += "-D" + key + "=" + System.getProperty(key) + " "; + QPID_OPTS += "-D" + key + "=" + _propertiesSetForBroker.get(key) + " "; } if (env.containsKey("QPID_OPTS")) @@ -489,7 +533,7 @@ if (!p.await(30, TimeUnit.SECONDS)) { - _logger.info("broker failed to become ready:" + p.getStopLine()); + _logger.info("broker failed to become ready (" + p.ready + "):" + p.getStopLine()); //Ensure broker has stopped process.destroy(); cleanBroker(); @@ -667,28 +711,87 @@ } /** + * Set a System property that is to be applied only to the external test + * broker. + * + * This is a convenience method to enable the setting of a -Dproperty=value + * entry in QPID_OPTS + * + * This is only useful for the External Java Broker tests. + * + * @param property the property name + * @param value the value to set the property to + */ + protected void setBrokerOnlySystemProperty(String property, String value) + { + if (!_propertiesSetForBroker.containsKey(property)) + { + _propertiesSetForBroker.put(property, value); + } + + } + + /** + * Set a System (-D) property for this test run. + * + * This convenience method copies the current VMs System Property + * for the external VM Broker. + * + * @param property the System property to set + */ + protected void setSystemProperty(String property) + { + setSystemProperty(property, System.getProperty(property)); + } + + /** * Set a System property for the duration of this test. * * When the test run is complete the value will be reverted. * + * The values set using this method will also be propogated to the external + * Java Broker via a -D value defined in QPID_OPTS. + * + * If the value should not be set on the broker then use + * setTestClientSystemProperty(). + * * @param property the property to set * @param value the new value to use */ protected void setSystemProperty(String property, String value) { - if (!_setProperties.containsKey(property)) + // Record the value for the external broker + _propertiesSetForBroker.put(property, value); + + //Set the value for the test client vm aswell. + setTestClientSystemProperty(property, value); + } + + /** + * Set a System (-D) property for the external Broker of this test. + * + * @param property The property to set + * @param value the value to set it to. + */ + protected void setTestClientSystemProperty(String property, String value) + { + if (!_propertiesSetForTestOnly.containsKey(property)) { - _setProperties.put(property, System.getProperty(property)); - } + // Record the current value so we can revert it later. + _propertiesSetForTestOnly.put(property, System.getProperty(property)); + } System.setProperty(property, value); } + /** + * Restore the System property values that were set before this test run. + */ protected void revertSystemProperties() { - for (String key : _setProperties.keySet()) + for (String key : _propertiesSetForTestOnly.keySet()) { - String value = _setProperties.get(key); + String value = _propertiesSetForTestOnly.get(key); if (value != null) { System.setProperty(key, value); @@ -698,6 +801,12 @@ System.clearProperty(key); } } + + _propertiesSetForTestOnly.clear(); + + // We don't change the current VMs settings for Broker only properties + // so we can just clear this map + _propertiesSetForBroker.clear(); } /** @@ -712,6 +821,40 @@ } /** + * Adjust the VMs Log4j Settings just for this test run + * + * @param logger the logger to change + * @param level the level to set + */ + protected void setLoggerLevel(org.apache.log4j.Logger logger, Level level) + { + assertNotNull("Cannot set level of null logger", logger); + assertNotNull("Cannot set Logger("+logger.getName()+") to null level.",level); + + if (!_loggerLevelSetForTest.containsKey(logger)) + { + // Record the current value so we can revert it later. + _loggerLevelSetForTest.put(logger, logger.getLevel()); + } + + logger.setLevel(level); + } + + /** + * Restore the logging levels defined by this test. + */ + protected void revertLoggingLevels() + { + for (org.apache.log4j.Logger logger : _loggerLevelSetForTest.keySet()) + { + logger.setLevel(_loggerLevelSetForTest.get(logger)); + } + + _loggerLevelSetForTest.clear(); + + } + + /** * Check whether the broker is an 0.8 * * @return true if the broker is an 0_8 version, false otherwise. @@ -885,6 +1028,7 @@ } revertSystemProperties(); + revertLoggingLevels(); } /** @@ -961,7 +1105,12 @@ public Message createNextMessage(Session session, int msgCount) throws JMSException { - return session.createMessage(); + Message message = session.createMessage(); + + message.setIntProperty(INDEX, msgCount); + + return message; + } public ConnectionURL getConnectionURL() throws NamingException Modified: qpid/branches/java-broker-0-10/qpid/java/test-profiles/010Excludes URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/test-profiles/010Excludes?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/test-profiles/010Excludes (original) +++ qpid/branches/java-broker-0-10/qpid/java/test-profiles/010Excludes Mon Oct 5 13:29:44 2009 @@ -92,3 +92,10 @@ // QPID-2084 : this test needs more work for 0-10 org.apache.qpid.test.unit.client.DynamicQueueExchangeCreateTest#* + +// QPID-2118 : 0-10 Java client has differrent error handling to 0-8 code path +org.apache.qpid.test.client.message.SelectorTest#testRuntimeSelectorError + +//QPID-942 : Implemented Channel.Flow based Producer Side flow control to the Java Broker (not in CPP Broker) +org.apache.qpid.server.queue.ProducerFlowControlTest#* + Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/010Excludes ------------------------------------------------------------------------------ svn:executable = * Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/010Excludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/010Excludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/010Excludes:799241-820933 Modified: qpid/branches/java-broker-0-10/qpid/java/test-profiles/08Excludes URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/test-profiles/08Excludes?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/test-profiles/08Excludes (original) +++ qpid/branches/java-broker-0-10/qpid/java/test-profiles/08Excludes Mon Oct 5 13:29:44 2009 @@ -14,8 +14,6 @@ // QPID-1823: this takes ages to run org.apache.qpid.client.SessionCreateTest#* -org.apache.qpid.test.client.RollbackOrderTest#* - // QPID-2097 exclude it from the InVM test runs until InVM JMX Interface is reliable org.apache.qpid.management.jmx.ManagementActorLoggingTest#* org.apache.qpid.server.queue.ModelTest#* Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/08Excludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/08Excludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/08Excludes:799241-820933 Modified: qpid/branches/java-broker-0-10/qpid/java/test-profiles/08StandaloneExcludes URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/test-profiles/08StandaloneExcludes?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/test-profiles/08StandaloneExcludes (original) +++ qpid/branches/java-broker-0-10/qpid/java/test-profiles/08StandaloneExcludes Mon Oct 5 13:29:44 2009 @@ -39,8 +39,6 @@ // QPID-1823: this takes ages to run org.apache.qpid.client.SessionCreateTest#* -org.apache.qpid.test.client.RollbackOrderTest#* - // This test requires the standard configuration file for validation. // Excluding here does not reduce test coverage. org.apache.qpid.server.configuration.ServerConfigurationFileTest#* Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/08StandaloneExcludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes:799241-820933 Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/08TransientExcludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/08TransientExcludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/08TransientExcludes:799241-820933 Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/Excludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/Excludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/Excludes:799241-820933 Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/XAExcludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/XAExcludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/XAExcludes:799241-820933 Propchange: qpid/branches/java-broker-0-10/qpid/java/test-profiles/cpp.ssl.excludes ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 5 13:29:44 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes:799241-816580 +/qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes:799241-820933 Modified: qpid/branches/java-broker-0-10/qpid/java/test-profiles/default.testprofile URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/test-profiles/default.testprofile?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/test-profiles/default.testprofile (original) +++ qpid/branches/java-broker-0-10/qpid/java/test-profiles/default.testprofile Mon Oct 5 13:29:44 2009 @@ -11,11 +11,14 @@ log=debug amqj.logging.level=${log} +amqj.server.logging.level=${log} amqj.protocol.logging.level=${log} root.logging.level=warn log4j.configuration=file:///${test.profiles}/log4j-test.xml log4j.debug=false +# Note test-provider.properties also has variables of same name. +# Keep in sync test.port=15672 test.mport=18999 #Note : Management will start open second port on: mport + 100 : 19099 Modified: qpid/branches/java-broker-0-10/qpid/java/test-profiles/log4j-test.xml URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/test-profiles/log4j-test.xml?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/test-profiles/log4j-test.xml (original) +++ qpid/branches/java-broker-0-10/qpid/java/test-profiles/log4j-test.xml Mon Oct 5 13:29:44 2009 @@ -29,10 +29,10 @@ <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out"/> + <param name="ImmediateFlush" value="true"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%t %d %p [%c{4}] %m%n"/> </layout> - <param name="ImmediateFlush" value="true"/> </appender> <logger name="org.apache.qpid"> @@ -46,6 +46,10 @@ <logger name="org.apache.qpid.test.utils.QpidTestCase"> <level value="ALL"/> </logger> + + <logger name="org.apache.commons"> + <level value="WARN"/> + </logger> <root> <level value="${root.logging.level}"/> Modified: qpid/branches/java-broker-0-10/qpid/java/test-profiles/test-provider.properties URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/test-profiles/test-provider.properties?rev=821793&r1=821792&r2=821793&view=diff ============================================================================== --- qpid/branches/java-broker-0-10/qpid/java/test-profiles/test-provider.properties (original) +++ qpid/branches/java-broker-0-10/qpid/java/test-profiles/test-provider.properties Mon Oct 5 13:29:44 2009 @@ -19,10 +19,14 @@ # # -test.port=5672 -test.port.ssl=5671 -test.port.alt=5772 -test.port.alt.ssl=5771 +# Copied from default.testprofile +test.port=15672 +test.mport=18999 +#Note : Java Management will start open second port on: mport + 100 : 19099 +test.port.ssl=15671 +test.port.alt=25672 +test.port.alt.ssl=25671 + connectionfactory.default = amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port}' connectionfactory.default.vm = amqp://username:passw...@clientid/test?brokerlist='vm://:1' --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
