You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2011/10/21 03:20:13 UTC
svn commit: r1187150 [38/43] - in /qpid/branches/QPID-2519: ./ bin/ cpp/
cpp/bindings/ cpp/bindings/qmf/python/ cpp/bindings/qmf/ruby/
cpp/bindings/qmf/tests/ cpp/bindings/qmf2/ cpp/bindings/qmf2/examples/cpp/
cpp/bindings/qmf2/python/ cpp/bindings/qmf...
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java Fri Oct 21 01:19:00 2011
@@ -27,7 +27,6 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import javax.jms.Connection;
import javax.jms.JMSException;
@@ -52,7 +51,6 @@ public class AMQPEncodedMapMessageTest e
private Session _session;
MessageConsumer _consumer;
MessageProducer _producer;
- UUID myUUID = UUID.randomUUID();
public void setUp() throws Exception
{
@@ -121,8 +119,7 @@ public class AMQPEncodedMapMessageTest e
m.setFloat("Float", Integer.MAX_VALUE + 5000);
m.setInt("Int", Integer.MAX_VALUE - 5000);
m.setShort("Short", (short)58);
- m.setString("String", "Hello");
- m.setObject("uuid", myUUID);
+ m.setString("String", "Hello");
_producer.send(m);
AMQPEncodedMapMessage msg = (AMQPEncodedMapMessage)_consumer.receive(RECEIVE_TIMEOUT);
@@ -143,7 +140,6 @@ public class AMQPEncodedMapMessageTest e
assertEquals(Integer.MAX_VALUE - 5000,m.getInt("Int"));
assertEquals((short)58,m.getShort("Short"));
assertEquals("Hello",m.getString("String"));
- assertEquals(myUUID,(UUID)m.getObject("uuid"));
}
@@ -153,11 +149,7 @@ public class AMQPEncodedMapMessageTest e
List<Integer> myList = getList();
- m.setObject("List", myList);
-
- List<UUID> uuidList = new ArrayList<UUID>();
- uuidList.add(myUUID);
- m.setObject("uuid-list", uuidList);
+ m.setObject("List", myList);
_producer.send(m);
AMQPEncodedMapMessage msg = (AMQPEncodedMapMessage)_consumer.receive(RECEIVE_TIMEOUT);
@@ -175,10 +167,6 @@ public class AMQPEncodedMapMessageTest e
assertEquals(i,j.intValue());
i++;
}
-
- List<UUID> list2 = (List<UUID>)msg.getObject("uuid-list");
- assertNotNull("UUID List not received",list2);
- assertEquals(myUUID,list2.get(0));
}
public void testMessageWithMapEntries() throws JMSException
@@ -186,12 +174,8 @@ public class AMQPEncodedMapMessageTest e
MapMessage m = _session.createMapMessage();
Map<String,String> myMap = getMap();
- m.setObject("Map", myMap);
-
- Map<String,UUID> uuidMap = new HashMap<String,UUID>();
- uuidMap.put("uuid", myUUID);
- m.setObject("uuid-map", uuidMap);
+ m.setObject("Map", myMap);
_producer.send(m);
AMQPEncodedMapMessage msg = (AMQPEncodedMapMessage)_consumer.receive(RECEIVE_TIMEOUT);
@@ -207,10 +191,6 @@ public class AMQPEncodedMapMessageTest e
assertEquals("String" + i,map.get("Key" + i));
i++;
}
-
- Map<String,UUID> map2 = (Map<String,UUID>)msg.getObject("uuid-map");
- assertNotNull("Map not received",map2);
- assertEquals(myUUID,map2.get("uuid"));
}
public void testMessageWithNestedListsAndMaps() throws JMSException
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java Fri Oct 21 01:19:00 2011
@@ -31,72 +31,62 @@ import org.apache.qpid.test.utils.QpidBr
import org.apache.qpid.transport.Connection;
public class SSLTest extends QpidBrokerTestCase
-{
- private static final String KEYSTORE = "test-profiles/test_resources/ssl/java_client_keystore.jks";
- private static final String KEYSTORE_PASSWORD = "password";
- private static final String TRUSTSTORE = "test-profiles/test_resources/ssl/java_client_truststore.jks";
- private static final String TRUSTSTORE_PASSWORD = "password";
- private static final String CERT_ALIAS_APP1 = "app1";
- private static final String CERT_ALIAS_APP2 = "app2";
-
+{
+
@Override
protected void setUp() throws Exception
{
- if(isJavaBroker())
- {
- setTestClientSystemProperty("profile.use_ssl", "true");
- setConfigurationProperty("connector.ssl.enabled", "true");
- setConfigurationProperty("connector.ssl.sslOnly", "true");
- }
-
- // set the ssl system properties
- setSystemProperty("javax.net.ssl.keyStore", KEYSTORE);
- setSystemProperty("javax.net.ssl.keyStorePassword", KEYSTORE_PASSWORD);
- setSystemProperty("javax.net.ssl.trustStore", TRUSTSTORE);
- setSystemProperty("javax.net.ssl.trustStorePassword", TRUSTSTORE_PASSWORD);
- setSystemProperty("javax.net.debug", "ssl");
+ System.setProperty("javax.net.debug", "ssl");
super.setUp();
}
- public void testCreateSSLConnectionUsingConnectionURLParams() throws Exception
+ @Override
+ protected void tearDown() throws Exception
+ {
+ System.setProperty("javax.net.debug", "");
+ super.tearDown();
+ }
+
+ public void testCreateSSLContextFromConnectionURLParams()
{
if (Boolean.getBoolean("profile.use_ssl"))
- {
- // Clear the ssl system properties
- setSystemProperty("javax.net.ssl.keyStore", null);
- setSystemProperty("javax.net.ssl.keyStorePassword", null);
- setSystemProperty("javax.net.ssl.trustStore", null);
- setSystemProperty("javax.net.ssl.trustStorePassword", null);
-
+ {
String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s" +
"?ssl='true'&ssl_verify_hostname='true'" +
"&key_store='%s'&key_store_password='%s'" +
"&trust_store='%s'&trust_store_password='%s'" +
"'";
- url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT,
- KEYSTORE,KEYSTORE_PASSWORD,TRUSTSTORE,TRUSTSTORE_PASSWORD);
-
- AMQConnection con = new AMQConnection(url);
- assertNotNull("connection should be successful", con);
- Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
- assertNotNull("create session should be successful", ssn);
- }
- }
-
- public void testCreateSSLConnectionUsingSystemProperties() throws Exception
- {
- if (Boolean.getBoolean("profile.use_ssl"))
- {
-
- String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s?ssl='true''";
-
- url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT);
-
- AMQConnection con = new AMQConnection(url);
- assertNotNull("connection should be successful", con);
- Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
- assertNotNull("create session should be successful", ssn);
+ String keyStore = System.getProperty("javax.net.ssl.keyStore");
+ String keyStorePass = System.getProperty("javax.net.ssl.keyStorePassword");
+ String trustStore = System.getProperty("javax.net.ssl.trustStore");
+ String trustStorePass = System.getProperty("javax.net.ssl.trustStorePassword");
+
+ url = String.format(url,System.getProperty("test.port.ssl"),
+ keyStore,keyStorePass,trustStore,trustStorePass);
+
+ // temporarily set the trust/key store jvm args to something else
+ // to ensure we only read from the connection URL param.
+ System.setProperty("javax.net.ssl.trustStore","fessgsdgd");
+ System.setProperty("javax.net.ssl.trustStorePassword","fessgsdgd");
+ System.setProperty("javax.net.ssl.keyStore","fessgsdgd");
+ System.setProperty("javax.net.ssl.keyStorePassword","fessgsdgd");
+ try
+ {
+ AMQConnection con = new AMQConnection(url);
+ Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
+ }
+ catch (Exception e)
+ {
+ fail("SSL Connection should be successful");
+ }
+ finally
+ {
+ System.setProperty("javax.net.ssl.trustStore",trustStore);
+ System.setProperty("javax.net.ssl.trustStorePassword",trustStorePass);
+ System.setProperty("javax.net.ssl.keyStore",keyStore);
+ System.setProperty("javax.net.ssl.keyStorePassword",keyStorePass);
+ }
}
}
@@ -105,8 +95,8 @@ public class SSLTest extends QpidBrokerT
if (Boolean.getBoolean("profile.use_ssl"))
{
String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" +
- QpidBrokerTestCase.DEFAULT_SSL_PORT +
- "?ssl='true'&ssl_cert_alias='" + CERT_ALIAS_APP1 + "''";
+ System.getProperty("test.port.ssl") +
+ "?ssl='true'&ssl_cert_alias='app1''";
AMQTestConnection_0_10 con = new AMQTestConnection_0_10(url);
Connection transportCon = con.getConnection();
@@ -115,8 +105,8 @@ public class SSLTest extends QpidBrokerT
con.close();
url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" +
- QpidBrokerTestCase.DEFAULT_SSL_PORT +
- "?ssl='true'&ssl_cert_alias='" + CERT_ALIAS_APP2 + "''";
+ System.getProperty("test.port.ssl") +
+ "?ssl='true'&ssl_cert_alias='app2''";
con = new AMQTestConnection_0_10(url);
transportCon = con.getConnection();
@@ -126,12 +116,12 @@ public class SSLTest extends QpidBrokerT
}
}
- public void testVerifyHostNameWithIncorrectHostname()
+ public void testVerifyHostName()
{
if (Boolean.getBoolean("profile.use_ssl"))
{
String url = "amqp://guest:guest@test/?brokerlist='tcp://127.0.0.1:" +
- QpidBrokerTestCase.DEFAULT_SSL_PORT +
+ System.getProperty("test.port.ssl") +
"?ssl='true'&ssl_verify_hostname='true''";
try
@@ -150,53 +140,42 @@ public class SSLTest extends QpidBrokerT
}
}
- public void testVerifyLocalHost() throws Exception
+ public void testVerifyLocalHost()
{
if (Boolean.getBoolean("profile.use_ssl"))
{
String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" +
- QpidBrokerTestCase.DEFAULT_SSL_PORT +
+ System.getProperty("test.port.ssl") +
"?ssl='true'&ssl_verify_hostname='true''";
-
- AMQConnection con = new AMQConnection(url);
- assertNotNull("connection should have been created", con);
- }
+
+ try
+ {
+ AMQConnection con = new AMQConnection(url);
+ }
+ catch (Exception e)
+ {
+ fail("Hostname verification should succeed");
+ }
+ }
}
- public void testVerifyLocalHostLocalDomain() throws Exception
+ public void testVerifyLocalHostLocalDomain()
{
if (Boolean.getBoolean("profile.use_ssl"))
{
String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost.localdomain:" +
- QpidBrokerTestCase.DEFAULT_SSL_PORT +
+ System.getProperty("test.port.ssl") +
"?ssl='true'&ssl_verify_hostname='true''";
-
- AMQConnection con = new AMQConnection(url);
- assertNotNull("connection should have been created", con);
- }
- }
-
- public void testCreateSSLConnectionUsingConnectionURLParamsTrustStoreOnly() throws Exception
- {
- if (Boolean.getBoolean("profile.use_ssl"))
- {
- // Clear the ssl system properties
- setSystemProperty("javax.net.ssl.keyStore", null);
- setSystemProperty("javax.net.ssl.keyStorePassword", null);
- setSystemProperty("javax.net.ssl.trustStore", null);
- setSystemProperty("javax.net.ssl.trustStorePassword", null);
- String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s" +
- "?ssl='true'&ssl_verify_hostname='true'" +
- "&trust_store='%s'&trust_store_password='%s'" +
- "'";
-
- url = String.format(url,QpidBrokerTestCase.DEFAULT_SSL_PORT, TRUSTSTORE,TRUSTSTORE_PASSWORD);
-
- AMQConnection con = new AMQConnection(url);
- assertNotNull("connection should be successful", con);
- Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
- assertNotNull("create session should be successful", ssn);
+ try
+ {
+ AMQConnection con = new AMQConnection(url);
+ }
+ catch (Exception e)
+ {
+ fail("Hostname verification should succeed");
+ }
+
}
}
}
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -68,6 +68,61 @@ public class ManagementActorLoggingTest
/**
* Description:
+ * When a JMX Management connection is made then this will be logged out.
+ *
+ * Input:
+ *
+ * 1. Running Broker
+ * 2. Connect Management client via JMX
+ * Output:
+ *
+ * <date> MNG-1007 : Open <user>
+ *
+ * Validation Steps:
+ * 1. The MNG ID is correct
+ * 2. The user is correct
+ *
+ * On connection close a MNG-1008 is expected
+ *
+ * * <date> MNG-1008 : Close
+ *
+ * Validation Steps:
+ * 1. The MNG ID is correct
+ *
+ * @throws java.io.IOException - if there is a problem reseting the log monitor
+ */
+ public void testJMXManagementConsoleConnection() throws IOException
+ {
+ List<String> results = waitAndFindMatches("MNG-1007");
+
+ assertEquals("Unexpected Management Connection count", 1, results.size());
+
+ String log = getLogMessage(results, 0);
+
+ validateMessageID("MNG-1007", log);
+
+ assertTrue("User not in log message:" + log, log.endsWith(USER));
+ // Extract the id from the log string
+ // MESSAGE [mng:1(rmi://169.24.29.116)] MNG-1007 : Open : User admin
+ int connectionID = Integer.parseInt(fromActor(getLog(results.get(0))).charAt(4) + "");
+
+ results = findMatches("MNG-1008");
+
+ assertEquals("Unexpected Management Connection close count", 0, results.size());
+
+ _jmxUtils.close();
+ _closed = true;
+
+ results = waitAndFindMatches("MNG-1008");
+
+ assertEquals("Unexpected Management Connection count", 1, results.size());
+
+ assertEquals("Close does not have same id as open,", connectionID,
+ Integer.parseInt(fromActor(getLog(results.get(0))).charAt(4) + ""));
+ }
+
+ /**
+ * Description:
* When a connected client has its connection closed via the Management Console this will be logged as a CON-1002 message.
* Input:
*
@@ -106,7 +161,7 @@ public class ManagementActorLoggingTest
});
//Remove the connection close from any 0-10 connections
- _monitor.markDiscardPoint();
+ _monitor.reset();
// Get a managedConnection
ManagedConnection mangedConnection = _jmxUtils.getManagedObject(ManagedConnection.class, "org.apache.qpid:type=VirtualHost.Connection,*");
@@ -147,7 +202,7 @@ public class ManagementActorLoggingTest
*/
public void testCreateExchangeDirectTransientViaManagementConsole() throws IOException, JMException
{
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createExchange("test", getName(), "direct", false);
@@ -171,7 +226,7 @@ public class ManagementActorLoggingTest
public void testCreateExchangeTopicTransientViaManagementConsole() throws IOException, JMException
{
//Remove any previous exchange declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createExchange("test", getName(), "topic", false);
@@ -196,7 +251,7 @@ public class ManagementActorLoggingTest
public void testCreateExchangeFanoutTransientViaManagementConsole() throws IOException, JMException
{
//Remove any previous exchange declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createExchange("test", getName(), "fanout", false);
@@ -221,7 +276,7 @@ public class ManagementActorLoggingTest
public void testCreateExchangeHeadersTransientViaManagementConsole() throws IOException, JMException
{
//Remove any previous exchange declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createExchange("test", getName(), "headers", false);
@@ -265,7 +320,7 @@ public class ManagementActorLoggingTest
public void testCreateQueueTransientViaManagementConsole() throws IOException, JMException
{
//Remove any previous queue declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createQueue("test", getName(), null, false);
@@ -308,7 +363,7 @@ public class ManagementActorLoggingTest
public void testQueueDeleteViaManagementConsole() throws IOException, JMException
{
//Remove any previous queue declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createQueue("test", getName(), null, false);
@@ -354,7 +409,7 @@ public class ManagementActorLoggingTest
public void testBindingCreateOnDirectViaManagementConsole() throws IOException, JMException
{
//Remove any previous queue declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createQueue("test", getName(), null, false);
@@ -381,7 +436,7 @@ public class ManagementActorLoggingTest
public void testBindingCreateOnTopicViaManagementConsole() throws IOException, JMException
{
//Remove any previous queue declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createQueue("test", getName(), null, false);
@@ -408,7 +463,7 @@ public class ManagementActorLoggingTest
public void testBindingCreateOnFanoutViaManagementConsole() throws IOException, JMException
{
//Remove any previous queue declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createQueue("test", getName(), null, false);
@@ -455,7 +510,7 @@ public class ManagementActorLoggingTest
public void testUnRegisterExchangeViaManagementConsole() throws IOException, JMException
{
//Remove any previous queue declares
- _monitor.markDiscardPoint();
+ _monitor.reset();
_jmxUtils.createExchange("test", getName(), "direct", false);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/BrokerStartupTest.java Fri Oct 21 01:19:00 2011
@@ -70,13 +70,13 @@ public class BrokerStartupTest extends A
{
// This logging startup code only occurs when you run a Java broker,
// that broker must be started via Main so not an InVM broker.
- if (isJavaBroker() && isExternalBroker() && !isInternalBroker())
+ if (isJavaBroker() && isExternalBroker())
{
//Remove test Log4j config from the commandline
- _brokerCommand = _brokerCommand.substring(0, _brokerCommand.indexOf("-l"));
+ _broker = _broker.substring(0, _broker.indexOf("-l"));
// Add an invalid value
- _brokerCommand += " -l invalid";
+ _broker += " -l invalid";
// 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
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java Fri Oct 21 01:19:00 2011
@@ -61,6 +61,21 @@ public class ServerConfigurationFileTest
_serverConfig.getConfig().getProperty(property));
}
+ public void testProtectIOEnabled() throws ConfigurationException
+ {
+ validatePropertyDefinedInFile(ServerConfiguration.CONNECTOR_PROTECTIO_ENABLED);
+ }
+
+ public void testProtectIOReadBufferLimitSize() throws ConfigurationException
+ {
+ validatePropertyDefinedInFile(ServerConfiguration.CONNECTOR_PROTECTIO_READ_BUFFER_LIMIT_SIZE);
+ }
+
+ public void testProtectIOWriteBufferLimitSize() throws ConfigurationException
+ {
+ validatePropertyDefinedInFile(ServerConfiguration.CONNECTOR_PROTECTIO_WRITE_BUFFER_LIMIT_SIZE);
+ }
+
public void testStatusUpdates() throws ConfigurationException
{
validatePropertyDefinedInFile(ServerConfiguration.STATUS_UPDATES);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java Fri Oct 21 01:19:00 2011
@@ -83,9 +83,15 @@ public class MessagingTestConfigProperti
/** Holds the name of the default connection factory configuration property. */
public static final String CONNECTION_PROPNAME = "connectionfactory.broker";
+ /** Defeins the default connection configuration. */
+ public static final String CONNECTION_DEFAULT = "amqp://guest:guest@clientid/?brokerlist='vm://:1'";
+
/** Holds the name of the property to get the test broker url from. */
public static final String BROKER_PROPNAME = "qpid.test.broker";
+ /** Holds the default broker url for the test. */
+ public static final String BROKER_DEFAULT = "vm://:1";
+
/** Holds the name of the property to get the test broker virtual path. */
public static final String VIRTUAL_HOST_PROPNAME = "virtualHost";
@@ -268,6 +274,7 @@ public class MessagingTestConfigProperti
static
{
defaults.setPropertyIfNull(INITIAL_CONTEXT_FACTORY_PROPNAME, INITIAL_CONTEXT_FACTORY_DEFAULT);
+ defaults.setPropertyIfNull(CONNECTION_PROPNAME, CONNECTION_DEFAULT);
defaults.setPropertyIfNull(MESSAGE_SIZE_PROPNAME, MESSAGE_SIZE_DEAFULT);
defaults.setPropertyIfNull(PUBLISHER_PRODUCER_BIND_PROPNAME, PUBLISHER_PRODUCER_BIND_DEFAULT);
defaults.setPropertyIfNull(PUBLISHER_CONSUMER_BIND_PROPNAME, PUBLISHER_CONSUMER_BIND_DEFAULT);
@@ -277,6 +284,7 @@ public class MessagingTestConfigProperti
defaults.setPropertyIfNull(RECEIVE_DESTINATION_NAME_ROOT_PROPNAME, RECEIVE_DESTINATION_NAME_ROOT_DEFAULT);
defaults.setPropertyIfNull(PERSISTENT_MODE_PROPNAME, PERSISTENT_MODE_DEFAULT);
defaults.setPropertyIfNull(TRANSACTED_PROPNAME, TRANSACTED_DEFAULT);
+ defaults.setPropertyIfNull(BROKER_PROPNAME, BROKER_DEFAULT);
defaults.setPropertyIfNull(VIRTUAL_HOST_PROPNAME, VIRTUAL_HOST_DEFAULT);
defaults.setPropertyIfNull(RATE_PROPNAME, RATE_DEFAULT);
defaults.setPropertyIfNull(VERBOSE_PROPNAME, VERBOSE_DEFAULT);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java Fri Oct 21 01:19:00 2011
@@ -20,40 +20,58 @@
*/
package org.apache.qpid.server.failover;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
+import junit.framework.TestCase;
-import org.apache.qpid.AMQConnectionClosedException;
import org.apache.qpid.AMQDisconnectedException;
import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQConnectionURL;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
+import org.apache.qpid.url.URLSyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionListener
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import java.util.concurrent.CountDownLatch;
+
+public class FailoverMethodTest extends InternalBrokerBaseCase implements ExceptionListener
{
private CountDownLatch _failoverComplete = new CountDownLatch(1);
protected static final Logger _logger = LoggerFactory.getLogger(FailoverMethodTest.class);
+ @Override
+ public void createBroker() throws Exception
+ {
+ super.createBroker();
+ TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ }
+ @Override
+ public void stopBroker()
+ {
+ TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ super.stopBroker();
+ }
/**
* Test that the round robin method has the correct delays.
- * The first connection will work but the localhost connection should fail but the duration it takes
+ * The first connection to vm://:1 will work but the localhost connection should fail but the duration it takes
* to report the failure is what is being tested.
*
+ * @throws URLSyntaxException
+ * @throws InterruptedException
+ * @throws JMSException
*/
- public void testFailoverRoundRobinDelay() throws Exception
+ public void testFailoverRoundRobinDelay() throws URLSyntaxException, InterruptedException, JMSException
{
- //note: The first broker has no connect delay and the default 1 retry
+ //note: The VM broker has no connect delay and the default 1 retry
// while the tcp:localhost broker has 3 retries with a 2s connect delay
String connectionString = "amqp://guest:guest@/test?brokerlist=" +
- "'tcp://:" + getPort() +
+ "'vm://:" + ApplicationRegistry.DEFAULT_INSTANCE +
";tcp://localhost:5670?connectdelay='2000',retries='3''";
AMQConnectionURL url = new AMQConnectionURL(connectionString);
@@ -61,15 +79,13 @@ public class FailoverMethodTest extends
try
{
long start = System.currentTimeMillis();
- AMQConnection connection = new AMQConnection(url);
+ AMQConnection connection = new AMQConnection(url, null);
connection.setExceptionListener(this);
stopBroker();
- _failoverComplete.await(30, TimeUnit.SECONDS);
- assertEquals("failoverLatch was not decremented in given timeframe",
- 0, _failoverComplete.getCount());
+ _failoverComplete.await();
long end = System.currentTimeMillis();
@@ -96,24 +112,23 @@ public class FailoverMethodTest extends
}
}
- public void testFailoverSingleDelay() throws Exception
+ public void testFailoverSingleDelay() throws URLSyntaxException, AMQVMBrokerCreationException,
+ InterruptedException, JMSException
{
- String connectionString = "amqp://guest:guest@/test?brokerlist='tcp://localhost:" + getPort() + "?connectdelay='2000',retries='3''";
+ String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='2000',retries='3''";
AMQConnectionURL url = new AMQConnectionURL(connectionString);
try
{
long start = System.currentTimeMillis();
- AMQConnection connection = new AMQConnection(url);
+ AMQConnection connection = new AMQConnection(url, null);
connection.setExceptionListener(this);
stopBroker();
- _failoverComplete.await(30, TimeUnit.SECONDS);
- assertEquals("failoverLatch was not decremented in given timeframe",
- 0, _failoverComplete.getCount());
+ _failoverComplete.await();
long end = System.currentTimeMillis();
@@ -129,8 +144,8 @@ public class FailoverMethodTest extends
assertTrue("Failover took less than 6 seconds", duration > 6000);
// Ensure we don't have delays before initial connection and reconnection.
- // We allow 3 second for initial connection and failover logic on top of 6s of sleep.
- assertTrue("Failover took more than 9 seconds:(" + duration + ")", duration < 9000);
+ // We allow 1 second for initial connection and failover logic on top of 6s of sleep.
+ assertTrue("Failover took more than 7 seconds:(" + duration + ")", duration < 7000);
}
catch (AMQException e)
{
@@ -140,15 +155,11 @@ public class FailoverMethodTest extends
public void onException(JMSException e)
{
- if (e.getLinkedException() instanceof AMQDisconnectedException || e.getLinkedException() instanceof AMQConnectionClosedException)
+ if (e.getLinkedException() instanceof AMQDisconnectedException)
{
_logger.debug("Received AMQDisconnectedException");
_failoverComplete.countDown();
}
- else
- {
- _logger.error("Unexpected underlying exception", e.getLinkedException());
- }
}
/**
@@ -157,37 +168,28 @@ public class FailoverMethodTest extends
*
* Test validates that there is a connection delay as required on initial
* connection.
+ *
+ * @throws URLSyntaxException
+ * @throws AMQVMBrokerCreationException
+ * @throws InterruptedException
+ * @throws JMSException
*/
- public void testNoFailover() throws Exception
+ public void testNoFailover() throws URLSyntaxException, AMQVMBrokerCreationException,
+ InterruptedException, JMSException
{
- if (!isInternalBroker())
- {
- // QPID-3359
- // These tests always used to be inVM tests, then QPID-2815, with removal of ivVM,
- // converted the test to use QpidBrokerTestCase. However, since then we notice this
- // test fails on slower CI boxes. It turns out the test design is *extremely*
- // sensitive the length of time the broker takes to start up.
- //
- // Making the test a same-VM test to temporarily avoid the issue. In long term, test
- // needs redesigned to avoid the issue.
- return;
- }
-
int CONNECT_DELAY = 2000;
- String connectionString = "amqp://guest:guest@/test?brokerlist='tcp://localhost:" + getPort() + "?connectdelay='" + CONNECT_DELAY + "'," +
+ String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='" + CONNECT_DELAY + "'," +
"retries='3'',failover='nofailover'";
-
AMQConnectionURL url = new AMQConnectionURL(connectionString);
- Thread brokerStart = null;
try
{
//Kill initial broker
stopBroker();
//Create a thread to start the broker asynchronously
- brokerStart = new Thread(new Runnable()
+ Thread brokerStart = new Thread(new Runnable()
{
public void run()
{
@@ -196,7 +198,7 @@ public class FailoverMethodTest extends
//Wait before starting broker
// The wait should allow atleast 1 retries to fail before broker is ready
Thread.sleep(750);
- startBroker();
+ createBroker();
}
catch (Exception e)
{
@@ -210,8 +212,9 @@ public class FailoverMethodTest extends
brokerStart.start();
long start = System.currentTimeMillis();
+
//Start the connection so it will use the retries
- AMQConnection connection = new AMQConnection(url);
+ AMQConnection connection = new AMQConnection(url, null);
long end = System.currentTimeMillis();
@@ -225,16 +228,13 @@ public class FailoverMethodTest extends
//Ensure we collect the brokerStart thread
brokerStart.join();
- brokerStart = null;
start = System.currentTimeMillis();
//Kill connection
stopBroker();
- _failoverComplete.await(30, TimeUnit.SECONDS);
- assertEquals("failoverLatch was not decremented in given timeframe",
- 0, _failoverComplete.getCount());
+ _failoverComplete.await();
end = System.currentTimeMillis();
@@ -249,23 +249,6 @@ public class FailoverMethodTest extends
{
fail(e.getMessage());
}
- finally
- {
- // Guard against the case where the broker took too long to start
- // and the initial connection failed to be formed.
- if (brokerStart != null)
- {
- brokerStart.join();
- }
- }
- }
-
- public void stopBroker(int port) throws Exception
- {
- if (isBrokerPresent(port))
- {
- super.stopBroker(port);
- }
}
}
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java Fri Oct 21 01:19:00 2011
@@ -20,10 +20,13 @@
*/
package org.apache.qpid.server.failover;
+import org.apache.mina.common.WriteTimeoutException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.protocol.AMQProtocolSession;
import org.apache.qpid.jms.ConnectionListener;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.test.utils.FailoverBaseCase;
+import org.apache.qpid.AMQConnectionClosedException;
import javax.jms.Destination;
import javax.jms.Message;
@@ -31,7 +34,6 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@@ -193,7 +195,7 @@ public class MessageDisappearWithIOExcep
// Send IO Exception - causing failover
_connection.getProtocolHandler().
- exception(new IOException("IOException to cause failover."));
+ exception(new WriteTimeoutException("WriteTimeoutException to cause failover."));
// Verify Failover occured through ConnectionListener
assertTrue("Failover did not occur",
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java Fri Oct 21 01:19:00 2011
@@ -349,7 +349,7 @@ public class AbstractTestLogging extends
public boolean waitForMessage(String message, long wait) throws FileNotFoundException, IOException
{
- return _monitor.waitForMessage(message, wait);
+ return _monitor.waitForMessage(message, wait, true);
}
/**
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java Fri Oct 21 01:19:00 2011
@@ -46,7 +46,7 @@ public class AlertingTest extends Abstra
{
// Update the configuration to make our virtualhost Persistent.
makeVirtualHostPersistent(VIRTUALHOST);
- setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "5000");
+ setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod", "5000");
_numMessages = 50;
@@ -136,7 +136,7 @@ public class AlertingTest extends Abstra
stopBroker();
// Rest the monitoring clearing the current output file.
- _monitor.markDiscardPoint();
+ _monitor.reset();
startBroker();
wasAlertFired();
}
@@ -169,14 +169,14 @@ public class AlertingTest extends Abstra
stopBroker();
- _monitor.markDiscardPoint();
+ _monitor.reset();
// Change max message count to 5, start broker and make sure that that's triggered at the right time
setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5");
startBroker();
- if (isInternalBroker())
+ if (!isExternalBroker())
{
assertEquals("Alert Max Msg Count is not correct", 5, ApplicationRegistry.getInstance().getVirtualHostRegistry().
getVirtualHost(VIRTUALHOST).getQueueRegistry().getQueue(new AMQShortString(_destination.getQueueName())).
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -55,7 +55,7 @@ public class BindingLoggingTest extends
{
super.setUp();
//Ignore broker startup messages
- _monitor.markDiscardPoint();
+ _monitor.reset();
_connection = getConnection();
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/BrokerLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -21,8 +21,6 @@
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;
@@ -153,12 +151,12 @@ public class BrokerLoggingTest extends A
{
// This logging startup code only occurs when you run a Java broker,
// that broker must be started via Main so not an InVM broker.
- if (isJavaBroker() && isExternalBroker() && !isInternalBroker())
+ if (isJavaBroker() && isExternalBroker())
{
String TESTID = "BRK-1007";
//Remove test Log4j config from the commandline
- _brokerCommand = _brokerCommand.substring(0, _brokerCommand.indexOf("-l"));
+ _broker = _broker.substring(0, _broker.indexOf("-l"));
startBroker();
@@ -205,7 +203,7 @@ public class BrokerLoggingTest extends A
1, findMatches(TESTID).size());
//3
- String defaultLog4j = System.getProperty(QPID_HOME) + "/" + BrokerOptions.DEFAULT_LOG_CONFIG_FILE;
+ String defaultLog4j = _configFile.getParent() + "/" + Main.DEFAULT_LOG_CONFIG_FILENAME;
assertTrue("Log4j file(" + defaultLog4j + ") details not correctly logged:" + getMessageString(log),
getMessageString(log).endsWith(defaultLog4j));
@@ -242,11 +240,12 @@ public class BrokerLoggingTest extends A
*/
public void testBrokerStartupCustomLog4j() throws Exception
{
- // This logging startup code only occurs when you run a Java broker
+ // This logging startup code only occurs when you run a Java broker,
+ // that broker must be started via Main so not an InVM broker.
if (isJavaBroker() && isExternalBroker())
{
// Get custom -l value used during testing for the broker startup
- String customLog4j = _brokerCommand.substring(_brokerCommand.indexOf("-l") + 2).trim();
+ String customLog4j = _broker.substring(_broker.indexOf("-l") + 2);
String TESTID = "BRK-1007";
@@ -519,7 +518,7 @@ public class BrokerLoggingTest extends A
setConfigurationProperty("connector.ssl.keyStorePath", getConfigurationStringProperty("management.ssl.keyStorePath"));
setConfigurationProperty("connector.ssl.keyStorePassword", getConfigurationStringProperty("management.ssl.keyStorePassword"));
- Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.ssl.port"));
+ Integer sslPort = Integer.parseInt(getConfigurationStringProperty("connector.sslport"));
startBroker();
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ChannelLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -77,7 +77,7 @@ public class ChannelLoggingTest extends
validateMessageID("CHN-1001", log);
assertEquals("Incorrect Channel in actor:"+fromActor(log), isBroker010()? 0 : 1, getChannelID(fromActor(log)));
- if (!isBroker010())
+ if (isBroker08())
{
// Wait to ensure that the CHN-1004 message is logged
waitForMessage("CHN-1004");
@@ -89,7 +89,7 @@ public class ChannelLoggingTest extends
log = getLogMessage(results, 0);
// MESSAGE [con:0(guest@anonymous(3273383)/test)/ch:1] CHN-1004 : Prefetch Size (bytes) {0,number} : Count {1,number}
validateMessageID("CHN-1004", log);
- assertEquals("Incorrect Channel in actor:"+fromActor(log), 1, getChannelID(fromActor(log)));
+ assertEquals("Incorrect Channel in actor:"+fromActor(log), isBroker010()? 0 : 1, getChannelID(fromActor(log)));
assertTrue("Prefetch Count not correct",getMessageString(fromMessage(log)).endsWith("Count "+PREFETCH));
}
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -496,7 +496,7 @@ public class DerbyMessageStoreLoggingTes
stopBroker();
// Clear our monitor
- _monitor.markDiscardPoint();
+ _monitor.reset();
startBroker();
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -58,7 +58,7 @@ public class DurableQueueLoggingTest ext
{
super.setUp();
//Ensure we only have logs from our test
- _monitor.markDiscardPoint();
+ _monitor.reset();
_connection = getConnection();
_session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -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_0_10;
import org.apache.qpid.framing.AMQFrame;
@@ -38,6 +28,13 @@ import org.apache.qpid.framing.ExchangeD
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.Queue;
+import javax.jms.Session;
+import java.io.IOException;
+import java.util.List;
+
/**
* Exchange
*
@@ -125,7 +122,7 @@ public class ExchangeLoggingTest extends
public void testExchangeCreate() throws JMSException, IOException
{
//Ignore broker startup messages
- _monitor.markDiscardPoint();
+ _monitor.reset();
_session.createConsumer(_queue);
// Ensure we have received the EXH log msg.
@@ -179,7 +176,7 @@ public class ExchangeLoggingTest extends
public void testExchangeDelete() throws Exception, IOException
{
//Ignore broker startup messages
- _monitor.markDiscardPoint();
+ _monitor.reset();
//create the exchange by creating a consumer
_session.createConsumer(_queue);
@@ -217,38 +214,4 @@ public class ExchangeLoggingTest extends
}
- public void testDiscardedMessage() throws Exception
- {
- //Ignore broker startup messages
- _monitor.markDiscardPoint();
-
- if (!isBroker010())
- {
- // Default 0-8..-0-9-1 behaviour is for messages to be rejected (returned to client).
- setTestClientSystemProperty("qpid.default_mandatory", "false");
- }
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Do not create consumer so queue is not created and message will be discarded.
- final MessageProducer producer = _session.createProducer(_queue);
-
- // Sending message
- final TextMessage msg = _session.createTextMessage("msg");
- producer.send(msg);
-
- final String expectedMessageBody = "Discarded Message : Name: " + _name + " Routing Key: " + _queue.getQueueName();
-
- // Ensure we have received the EXH log msg.
- waitForMessage("EXH-1003");
-
- List<String> results = findMatches(EXH_PREFIX);
- assertEquals("Result set larger than expected.", 2, results.size());
-
- final String log = getLogMessage(results, 1);
- validateMessageID("EXH-1003", log);
-
- final String message = getMessageString(fromMessage(log));
- assertEquals("Log Message not as expected", expectedMessageBody, message);
- }
}
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -22,7 +22,6 @@ package org.apache.qpid.server.logging;
import junit.framework.AssertionFailedError;
-import org.apache.qpid.server.configuration.ServerConfiguration;
import org.apache.qpid.util.LogMonitor;
import java.util.List;
@@ -77,8 +76,9 @@ public class ManagementLoggingTest exten
*/
public void testManagementStartupEnabled() throws Exception
{
- // This test only works on java brokers
- if (isJavaBroker())
+ // This test only works on external java brokers due to the fact that
+ // Management is disabled on InVM brokers.
+ if (isJavaBroker() && isExternalBroker())
{
startBrokerAndCreateMonitor(true, false);
@@ -130,7 +130,9 @@ public class ManagementLoggingTest exten
*/
public void testManagementStartupDisabled() throws Exception
{
- if (isJavaBroker())
+ // This test only works on external java brokers due to the fact that
+ // Management is disabled on InVM brokers.
+ if (isJavaBroker() && isExternalBroker())
{
startBrokerAndCreateMonitor(false, false);
@@ -189,7 +191,9 @@ public class ManagementLoggingTest exten
*/
public void testManagementStartupRMIEntries() throws Exception
{
- if (isJavaBroker())
+ // This test only works on external java brokers due to the fact that
+ // Management is disabled on InVM brokers.
+ if (isJavaBroker() && isExternalBroker())
{
startBrokerAndCreateMonitor(true, false);
@@ -207,7 +211,7 @@ public class ManagementLoggingTest exten
validateMessageID("MNG-1002", log);
//Check the RMI Registry port is as expected
- int mPort = getManagementPort(getPort());
+ int mPort = getPort() + (DEFAULT_MANAGEMENT_PORT - DEFAULT_PORT);
assertTrue("RMI Registry port not as expected(" + mPort + ").:" + getMessageString(log),
getMessageString(log).endsWith(String.valueOf(mPort)));
@@ -218,7 +222,7 @@ public class ManagementLoggingTest exten
// We expect the RMI Registry port (the defined 'management port') to be
// 100 lower than the JMX RMIConnector Server Port (the actual JMX server)
- int jmxPort = mPort + ServerConfiguration.JMXPORT_CONNECTORSERVER_OFFSET;
+ int jmxPort = mPort + 100;
assertTrue("JMX RMIConnectorServer port not as expected(" + jmxPort + ").:" + getMessageString(log),
getMessageString(log).endsWith(String.valueOf(jmxPort)));
}
@@ -246,7 +250,9 @@ public class ManagementLoggingTest exten
*/
public void testManagementStartupSSLKeystore() throws Exception
{
- if (isJavaBroker())
+ // This test only works on external java brokers due to the fact that
+ // Management is disabled on InVM brokers.
+ if (isJavaBroker() && isExternalBroker())
{
startBrokerAndCreateMonitor(true, true);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/QueueLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -53,7 +53,7 @@ public class QueueLoggingTest extends Ab
{
super.setUp();
//Remove broker startup logging messages
- _monitor.markDiscardPoint();
+ _monitor.reset();
_connection = getConnection();
_session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java Fri Oct 21 01:19:00 2011
@@ -58,7 +58,7 @@ public class SubscriptionLoggingTest ext
{
super.setUp();
//Remove broker startup logging messages
- _monitor.markDiscardPoint();
+ _monitor.reset();
_connection = getConnection();
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java Fri Oct 21 01:19:00 2011
@@ -78,10 +78,21 @@ public class NoLocalAfterRecoveryTest ex
BrokerDetails details = _connectionURL.getBrokerDetails(0);
- // This will attempt to failover for 3 seconds.
- // Local testing suggests failover takes 2 seconds
- details.setProperty(BrokerDetails.OPTIONS_RETRY, "10");
- details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, "500");
+ // Due to the problem with SingleServer delaying on all connection
+ // attempts. So using a high retry value.
+ if (_broker.equals(VM))
+ {
+ // Local testing suggests InVM restart takes under a second
+ details.setProperty(BrokerDetails.OPTIONS_RETRY, "5");
+ details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, "200");
+ }
+ else
+ {
+ // This will attempt to failover for 3 seconds.
+ // Local testing suggests failover takes 2 seconds
+ details.setProperty(BrokerDetails.OPTIONS_RETRY, "10");
+ details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, "500");
+ }
super.setUp();
}
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/PriorityTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/PriorityTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/PriorityTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/PriorityTest.java Fri Oct 21 01:19:00 2011
@@ -23,6 +23,7 @@ package org.apache.qpid.server.queue;
import junit.framework.TestCase;
import junit.framework.Assert;
import org.apache.log4j.Logger;
+import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.AMQQueue;
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java Fri Oct 21 01:19:00 2011
@@ -64,7 +64,7 @@ public class ProducerFlowControlTest ext
_jmxUtilConnected=false;
super.setUp();
- _monitor.markDiscardPoint();
+ _monitor.reset();
producerConnection = getConnection();
producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java Fri Oct 21 01:19:00 2011
@@ -110,13 +110,18 @@ public class QueueDepthWithSelectorTest
try
{
Connection connection = getConnection();
- AMQSession session = (AMQSession)connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- long queueDepth = session.getQueueDepth((AMQDestination) _queue);
+ Thread.sleep(2000);
+ long queueDepth = ((AMQSession) session).getQueueDepth((AMQDestination) _queue);
assertEquals("Session reports Queue depth not as expected", expectedDepth, queueDepth);
connection.close();
}
+ catch (InterruptedException e)
+ {
+ fail(e.getMessage());
+ }
catch (AMQException e)
{
fail(e.getMessage());
@@ -153,10 +158,6 @@ public class QueueDepthWithSelectorTest
{
assertTrue("Message " + msgId + " not received.", msgIdRecevied[msgId]);
}
-
- //do a synchronous op to ensure the acks are processed
- //on the broker before proceeding
- ((AMQSession)_clientSession).sync();
}
/**
Modified: qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java (original)
+++ qpid/branches/QPID-2519/java/systests/src/main/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java Fri Oct 21 01:19:00 2011
@@ -52,6 +52,7 @@ import org.apache.qpid.url.URLSyntaxExce
*
* TODO move the pre broker-startup setup method invocation code to {@link QpidBrokerTestCase}
*
+ * @see SimpleACLTest
* @see ExternalACLTest
* @see ExternalACLFileTest
* @see ExternalACLJMXTest
@@ -64,7 +65,10 @@ public abstract class AbstractACLTestCas
protected CountDownLatch _exceptionReceived;
/** Override this to return the name of the configuration XML file. */
- public abstract String getConfig();
+ public String getConfig()
+ {
+ return "config-systests-acl.xml";
+ }
/** Override this to setup external ACL files for virtual hosts. */
public List<String> getHostList()
@@ -83,8 +87,14 @@ public abstract class AbstractACLTestCas
@Override
public void setUp() throws Exception
{
+ if (QpidHome == null)
+ {
+ fail("QPID_HOME not set");
+ }
+
// Initialise ACLs.
- _configFile = new File("build" + File.separator + "etc" + File.separator + getConfig());
+ _configFile = new File(QpidHome, "etc" + File.separator + getConfig());
+
// Initialise ACL files
for (String virtualHost : getHostList())
{
@@ -150,7 +160,7 @@ public abstract class AbstractACLTestCas
*/
public void setUpACLFile(String virtualHost) throws IOException, ConfigurationException
{
- String path = "build" + File.separator + "etc";
+ String path = QpidHome + File.separator + "etc";
String className = StringUtils.substringBeforeLast(getClass().getSimpleName().toLowerCase(), "test");
String testName = StringUtils.substringAfter(getName(), "test").toLowerCase();
@@ -190,7 +200,7 @@ public abstract class AbstractACLTestCas
}
PrintWriter out = new PrintWriter(new FileWriter(aclFile));
- out.println(String.format("# %s", getTestName()));
+ out.println(String.format("# %s", _testName));
for (String line : rules)
{
out.println(line);
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org