diff options
Diffstat (limited to 'qpid/java/systests/src/main/java/org/apache/qpid/server/logging')
13 files changed, 83 insertions, 86 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java index 484c2afeb5..b666b1f424 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java @@ -20,14 +20,8 @@ */ package org.apache.qpid.server.logging; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - import org.apache.commons.configuration.ConfigurationException; + import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import org.apache.qpid.server.registry.ApplicationRegistry; @@ -35,6 +29,13 @@ import org.apache.qpid.server.util.InternalBrokerBaseCase; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.util.LogMonitor; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + /** * Abstract superclass for logging test set up and utility methods. * @@ -46,7 +47,7 @@ public class AbstractTestLogging extends QpidBrokerTestCase public static final String TEST_LOG_PREFIX = "MESSAGE"; protected LogMonitor _monitor; - InternalBrokerBaseCase _configLoader; + private InternalBrokerBaseCase _configLoader; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java index e7da4472f5..4b7b3f0cf0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java @@ -18,18 +18,17 @@ */ package org.apache.qpid.server.logging; -import java.util.List; - -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.Session; - import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQSession; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.security.acl.AbstractACLTestCase; +import javax.jms.Connection; +import javax.jms.JMSException; +import javax.jms.Session; +import java.util.List; + /** * ACL version 2/3 file testing to verify that ACL actor logging works correctly. * diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java index aef98b8a2a..02c41e14c0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java @@ -20,10 +20,6 @@ */ package org.apache.qpid.server.logging; -import javax.jms.Connection; -import javax.jms.Queue; -import javax.jms.Session; - import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; import org.apache.qpid.framing.AMQShortString; @@ -31,6 +27,10 @@ import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.util.FileUtils; +import javax.jms.Connection; +import javax.jms.Queue; +import javax.jms.Session; + public class AlertingTest extends AbstractTestLogging { private String VIRTUALHOST = "test"; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java index be2da128bc..2c7288de14 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java @@ -45,10 +45,10 @@ public class BindingLoggingTest extends AbstractTestLogging static final String BND_PREFIX = "BND-"; - Connection _connection; - Session _session; - Queue _queue; - Topic _topic; + private Connection _connection; + private Session _session; + private Queue _queue; + private Topic _topic; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java index 7969ffc059..dee593b12b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java @@ -23,11 +23,9 @@ package org.apache.qpid.server.logging; import junit.framework.AssertionFailedError; import org.apache.qpid.server.BrokerOptions; -import org.apache.qpid.server.Main; import org.apache.qpid.transport.ConnectionException; import org.apache.qpid.util.LogMonitor; -import java.io.File; import java.io.IOException; import java.net.Socket; import java.util.List; @@ -39,7 +37,7 @@ import java.util.List; * * BRK-1001 : Startup : Version: <Version> Build: <Build> * BRK-1002 : Starting : Listening on <Transport> port <Port> - * BRK-1003 : Shuting down : <Transport> port <Port> + * BRK-1003 : Shutting down : <Transport> port <Port> * BRK-1004 : Ready * BRK-1005 : Stopped * BRK-1006 : Using configuration : <path> @@ -809,7 +807,7 @@ public class BrokerLoggingTest extends AbstractTestLogging setConfigurationProperty("connector.ssl.keyStorePath", getConfigurationStringProperty("management.ssl.keyStorePath")); setConfigurationProperty("connector.ssl.keyStorePassword", getConfigurationStringProperty("management.ssl.keyStorePassword")); - Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.sslport")); + Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.ssl.port")); startBroker(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java index d28429aa39..ffe25a5cbe 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ConnectionLoggingTest.java @@ -21,8 +21,11 @@ package org.apache.qpid.server.logging; import javax.jms.Connection; -import java.util.List; + +import org.apache.qpid.common.QpidProperties; + import java.util.HashMap; +import java.util.List; import java.util.TreeSet; public class ConnectionLoggingTest extends AbstractTestLogging @@ -58,7 +61,7 @@ public class ConnectionLoggingTest extends AbstractTestLogging // Wait until opened waitForMessage("CON-1001"); - // Close the conneciton + // Close the connection connection.close(); // Wait to ensure that the desired message is logged @@ -66,18 +69,10 @@ public class ConnectionLoggingTest extends AbstractTestLogging List<String> results = waitAndFindMatches("CON-1001"); - // 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 - // MESSAGE [con:0(/127.0.0.1:46926)] CON-1001 : Open - // MESSAGE [con:0(/127.0.0.1:46926)] CON-1001 : Open : Protocol Version : 0-10 // MESSAGE [con:1(/127.0.0.1:46927)] CON-1001 : Open // MESSAGE [con:1(/127.0.0.1:46927)] CON-1001 : Open : Protocol Version : 0-9 - // MESSAGE [con:0(/127.0.0.1:46926)] CON-1002 : Close - // MESSAGE [con:1(/127.0.0.1:46927)] CON-1001 : Open : Client ID : clientid : Protocol Version : 0-9 - - //So check how many connections we have in the result set and extract the last one. - // When running InVM we will have con:0 and externally con:1 + // MESSAGE [con:1(/127.0.0.1:46927)] CON-1001 : Open : Client ID : clientid : Protocol Version : 0-9 : Client Version : 1.2.3_4 + // MESSAGE [con:0(/127.0.0.1:46927)] CON-1002 : Close HashMap<Integer, List<String>> connectionData = splitResultsOnConnectionID(results); @@ -87,31 +82,26 @@ public class ConnectionLoggingTest extends AbstractTestLogging //Use just the data from the last connection for the test results = connectionData.get(connectionID); - // If we are running inVM or with 0-10 we will get three open messagse - // if running externally with 0-8/0-9 we will also have open and close messages from the failed 0-10 negotiation - assertTrue("CON messages not logged:" + results.size(), results.size() >= 3); + assertEquals("Unexpected CON-1001 messages count", 3, results.size()); String log = getLogMessage(results, 0); // MESSAGE [con:1(/127.0.0.1:52540)] CON-1001 : Open //1 & 2 validateMessageID("CON-1001",log); - // validate the last three CON- messages. - // This is because when running externally we may also have logged the failed - // 0-10 negotiation messages if using 0-8/0-9 on the broker. - - // 3 - Assert the options are correct - // MESSAGE [con:1(/127.0.0.1:52540)] CON-1001 : Open : Client ID : clientid : Protocol Version : 0-9 - validateConnectionOpen(results, 0, true, true, clientid); + // validate the last three CON-1001 messages. + // MESSAGE [con:1(/127.0.0.1:52540)] CON-1001 : Open : Client ID : clientid : Protocol Version : 0-9 : Client Version : 1.2.3_4 + validateConnectionOpen(results, 0, true, true, clientid, true, QpidProperties.getReleaseVersion()); // MESSAGE [con:1(/127.0.0.1:52540)] CON-1001 : Open : Protocol Version : 0-9 - validateConnectionOpen(results, 1, true, false, null); + validateConnectionOpen(results, 1, true, false, null, false, null); - validateConnectionOpen(results, 2, false, false, null); + // MESSAGE [con:1(/127.0.0.1:52540)] CON-1001 : Open + validateConnectionOpen(results, 2, false, false, null, false, null); } private void validateConnectionOpen(List<String> results, int positionFromEnd, - boolean protocolVersionPresent, boolean clientIdOptionPresent, String clientIdValue) + boolean protocolVersionPresent, boolean clientIdOptionPresent, String clientIdValue, boolean clientVersionPresent, String clientVersionValue) { String log = getLogMessageFromEnd(results, positionFromEnd); @@ -128,6 +118,13 @@ public class ConnectionLoggingTest extends AbstractTestLogging protocolVersionPresent, fromMessage(log).contains("Protocol Version :")); //fixme there is no way currently to find out the negotiated protocol version // The delegate is the versioned class ((AMQConnection)connection)._delegate + + assertEquals("unexpected Client ID option state", clientVersionPresent, fromMessage(log).contains("Client Version :")); + + if(clientVersionPresent && clientVersionValue != null) + { + assertTrue("Client version value is not present: " + clientVersionValue, fromMessage(log).contains(clientVersionValue)); + } } /** diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java index d45bde2d98..e32edff692 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java @@ -20,15 +20,14 @@ */ package org.apache.qpid.server.logging; -import org.apache.commons.configuration.Configuration; import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import javax.jms.Connection; import javax.jms.Queue; import javax.jms.Session; -import java.util.List; import java.io.File; +import java.util.List; /** * The MessageStore test suite validates that the follow log messages as diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java index 07faf1ef3e..edffa7c0c0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java @@ -20,16 +20,6 @@ */ package org.apache.qpid.server.logging; -import java.io.IOException; -import java.util.List; - -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; - import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.AMQSession_0_10; @@ -39,6 +29,15 @@ import org.apache.qpid.framing.ExchangeDeleteBody; import org.apache.qpid.framing.ExchangeDeleteOkBody; import org.apache.qpid.framing.amqp_8_0.MethodRegistry_8_0; +import javax.jms.Connection; +import javax.jms.JMSException; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.TextMessage; +import java.io.IOException; +import java.util.List; + /** * Exchange * @@ -54,11 +53,11 @@ public class ExchangeLoggingTest extends AbstractTestLogging static final String EXH_PREFIX = "EXH-"; - Connection _connection; - Session _session; - Queue _queue; - String _name; - String _type; + private Connection _connection; + private Session _session; + private Queue _queue; + private String _name; + private String _type; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java index ed9109ebba..c8a6d02761 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java @@ -25,8 +25,8 @@ import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.test.utils.JMXTestUtils; import org.apache.qpid.util.LogMonitor; -import java.util.List; import java.io.File; +import java.util.List; /** * Management Console Test Suite diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java index 34d9e1f057..e6e1196cc6 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java @@ -20,13 +20,13 @@ */ package org.apache.qpid.server.logging; -import java.util.Arrays; -import java.util.List; - import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import org.apache.qpid.util.LogMonitor; +import java.util.Arrays; +import java.util.List; + /** * The MessageStore test suite validates that the follow log messages as * specified in the Functional Specification. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java index 76ebda0ebd..1c7b4c6be8 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java @@ -20,19 +20,19 @@ */ package org.apache.qpid.server.logging; +import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.failover.FailoverException; -import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.AMQException; +import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import javax.jms.Connection; -import javax.jms.Session; -import javax.jms.Queue; import javax.jms.JMSException; +import javax.jms.Queue; +import javax.jms.Session; import javax.naming.NamingException; -import java.util.List; import java.io.IOException; +import java.util.List; /** * The Queue test suite validates that the follow log messages as specified in diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java index b6efe53580..236202f323 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java @@ -20,16 +20,18 @@ */ package org.apache.qpid.server.logging; +import javax.jms.QueueBrowser; import junit.framework.AssertionFailedError; + import org.apache.qpid.client.AMQConnection; import javax.jms.Connection; import javax.jms.JMSException; +import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.Topic; -import javax.jms.Message; import java.io.IOException; import java.util.List; @@ -48,10 +50,10 @@ public class SubscriptionLoggingTest extends AbstractTestLogging { static final String SUB_PREFIX = "SUB-"; - Connection _connection; - Session _session; - Queue _queue; - Topic _topic; + private Connection _connection; + private Session _session; + private Queue _queue; + private Topic _topic; @Override public void setUp() throws Exception @@ -165,8 +167,10 @@ public class SubscriptionLoggingTest extends AbstractTestLogging */ public void testSubscriptionCreateQueueBrowser() throws JMSException, IOException { - _session.createBrowser(_queue); + _connection.start(); + QueueBrowser browser = _session.createBrowser(_queue); + browser.getEnumeration(); //Validate //Ensure that we wait for the SUB log message waitAndFindMatches("SUB-1001"); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java index a23e40ecce..5f96215269 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java @@ -21,13 +21,13 @@ package org.apache.qpid.server.logging; -import java.util.Arrays; -import java.util.List; - import junit.framework.AssertionFailedError; import org.apache.qpid.server.configuration.ServerConfiguration; +import java.util.Arrays; +import java.util.List; + /** * Virtualhost Test Cases * The virtualhost test suite validates that the follow log messages as specified in the Functional Specification. |