Author: ritchiem Date: Thu Aug 6 17:03:15 2009 New Revision: 801728 URL: http://svn.apache.org/viewvc?rev=801728&view=rev Log: QPID-2002 : Improved Channel/ConnectionLogging Test to report that it had no logged messages when that situation occurs. Rather than -1 index exceptions. Update to BrokerLoggingTest to ensure it is monitoring the right file.
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java?rev=801728&r1=801727&r2=801728&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java Thu Aug 6 17:03:15 2009 @@ -49,16 +49,6 @@ { public void setUp() throws Exception { - // set QPID_WORK to be [QPID_WORK|io.tmpdir]/<testName> - setSystemProperty("QPID_WORK", - System.getProperty("QPID_WORK", - System.getProperty("java.io.tmpdir")) - + File.separator + getName()); - -// makeVirtualHostPersistent("test"); - - _monitor = new LogMonitor(_outputFile); - //We explicitly do not call super.setUp as starting up the broker is //part of the test case. } @@ -92,6 +82,10 @@ { startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + + String configFilePath = _configFile.toString(); List<String> results = _monitor.findMatches("BRK-"); @@ -159,11 +153,12 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + // Ensure broker has fully started up. getConnection(); - String configFilePath = _configFile.toString(); - List<String> results = _monitor.findMatches("BRK-"); try { @@ -255,6 +250,10 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + + // Ensure broker has fully started up. getConnection(); @@ -341,6 +340,9 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + List<String> results = _monitor.findMatches("BRK-"); try { @@ -418,6 +420,9 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + // Ensure broker has fully started up. getConnection(); @@ -515,6 +520,9 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + // Ensure broker has fully started up. getConnection(); @@ -693,6 +701,9 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + stopBroker(); //Give broker time to shutdown and flush log @@ -794,6 +805,10 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + + // //Clear any startup messages as we don't need them for validation // _monitor.reset(); //Stop the broker to get the log messages for testing @@ -874,6 +889,9 @@ startBroker(); + // Now we can create the monitor as _outputFile will now be defined + _monitor = new LogMonitor(_outputFile); + getConnection().close(); stopBroker(); @@ -931,6 +949,14 @@ } } + /** + * Test that a socket on the given port is closed. + * + * Does this by attempting to connect to the port and expecting a + * ConnectionRefused IOException or a ConnectionException + * + * @param port the port number + */ private void checkSocketClosed(int port) { try @@ -953,6 +979,15 @@ } } + /** + * Test that a socket on the given port is open. + * + * Does this by attempting to connect to the port and expecting a + * The connection to succeed. + * It then closes the socket and expects that to work cleanly. + * + * @param port the port number + */ private void testSocketOpen(int port) { try @@ -962,7 +997,8 @@ } catch (IOException e) { - fail("Unable to open and close socket to port:" + port + ". Due to:" + e.getMessage()); + fail("Unable to open and close socket to port:" + port + + ". Due to:" + e.getMessage()); } } } Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java?rev=801728&r1=801727&r2=801728&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java Thu Aug 6 17:03:15 2009 @@ -119,6 +119,8 @@ List<String> results = _monitor.findMatches(CHANNEL_PREFIX); + assertTrue("No CHN messages logged", results.size() > 0); + // The last channel message should be: // // INFO - MESSAGE [con:0(gu...@anonymous(4205299)/test)/ch:1] [con:0(gu...@anonymous(4205299)/test)/ch:1] CHN-1002 : Flow Off @@ -171,6 +173,8 @@ List<String> results = _monitor.findMatches(CHANNEL_PREFIX); + assertTrue("No CHN messages logged", results.size() > 0); + // The last two channel messages should be: // // INFO - MESSAGE [con:0(gu...@anonymous(4205299)/test)/ch:1] [con:0(gu...@anonymous(4205299)/test)/ch:1] CHN-1002 : Flow On @@ -218,6 +222,8 @@ List<String> results = _monitor.findMatches(CHANNEL_PREFIX); + assertTrue("No CHN messages logged", results.size() > 0); + // The last two channel messages should be: // // INFO - MESSAGE [con:0(gu...@anonymous(4205299)/test)/ch:1] [con:0(gu...@anonymous(4205299)/test)/ch:1] CHN-1002 : Flow On @@ -263,6 +269,8 @@ List<String> results = _monitor.findMatches(CHANNEL_PREFIX); + assertTrue("No CHN messages logged", results.size() > 0); + // The last two channel messages should be: // // INFO - MESSAGE [con:0(gu...@anonymous(4205299)/test)/ch:1] [con:0(gu...@anonymous(4205299)/test)/ch:1] CHN-1002 : Flow On Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java?rev=801728&r1=801727&r2=801728&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java Thu Aug 6 17:03:15 2009 @@ -66,6 +66,8 @@ List<String> results = _monitor.findMatches(CONNECTION_PREFIX); + assertTrue("No CON messages logged", results.size() > 0); + // Validation // We should have at least three messages when running InVM but when running External // we will get 0-10 negotiation on con:0 whcih may close at some random point --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org