You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gr...@apache.org on 2010/10/13 17:06:27 UTC
svn commit: r1022127 [14/15] - in
/qpid/branches/grkvlt-network-20101013/qpid/java: ./
broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/
broker-plugins/access-control/src/test/java/org/apache/qpid/server/securi...
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java Wed Oct 13 15:05:29 2010
@@ -54,18 +54,18 @@ import org.apache.commons.lang.StringUti
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
+import org.apache.qpid.BrokerOptions;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQConnectionFactory;
import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.jms.BrokerDetails;
import org.apache.qpid.jms.ConnectionURL;
import org.apache.qpid.management.common.mbeans.ConfigurationManagement;
import org.apache.qpid.server.configuration.ServerConfiguration;
import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
import org.apache.qpid.server.store.DerbyMessageStore;
+import org.apache.qpid.transport.vm.VmBroker;
import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.util.LogMonitor;
@@ -82,8 +82,6 @@ public class QpidBrokerTestCase extends
protected long RECEIVE_TIMEOUT = 1000l;
- private Map<String, String> _propertiesSetForTestOnly = new HashMap<String, String>();
- private Map<String, String> _propertiesSetForBroker = new HashMap<String, String>();
private Map<Logger, Level> _loggerLevelSetForTest = new HashMap<Logger, Level>();
private XMLConfiguration _testConfiguration = new XMLConfiguration();
@@ -123,6 +121,7 @@ public class QpidBrokerTestCase extends
protected static final String VM = "vm";
protected static final String EXTERNAL = "external";
private static final String VERSION_08 = "0-8";
+ private static final String VERSION_09 = "0-9";
private static final String VERSION_010 = "0-10";
protected static final String QPID_HOME = "QPID_HOME";
@@ -449,27 +448,13 @@ public class QpidBrokerTestCase extends
setConfigurationProperty("management.jmxport", String.valueOf(getManagementPort(port)));
setConfigurationProperty(ServerConfiguration.MGMT_CUSTOM_REGISTRY_SOCKET, String.valueOf(false));
saveTestConfiguration();
-
- // create an in_VM broker
- final ConfigurationFileApplicationRegistry registry = new ConfigurationFileApplicationRegistry(_configFile);
- try
- {
- ApplicationRegistry.initialise(registry, port);
- }
- catch (Exception e)
- {
- _logger.error("Broker initialise failed due to:",e);
- try
- {
- registry.close();
- }
- catch (Throwable closeE)
- {
- closeE.printStackTrace();
- }
- throw e;
- }
- TransportConnection.createVMBroker(port);
+
+ BrokerOptions options = new BrokerOptions();
+ options.setProtocol("vm");
+ options.setBind("localhost");
+ options.setPorts(port);
+ options.setConfigFile(_configFile.getAbsolutePath());
+ VmBroker.createVMBroker(options);
}
else if (!_broker.equals(EXTERNAL))
{
@@ -510,6 +495,7 @@ public class QpidBrokerTestCase extends
}
}
+ setSystemProperty("amqj.protocol.debug", System.getProperty("amqj.protocol.debug", "false"));
// Add default test logging levels that are used by the log4j-test
// Use the convenience methods to push the current logging setting
@@ -655,7 +641,7 @@ public class QpidBrokerTestCase extends
{
port = getPort(port);
- _logger.info("stopping broker: " + getBrokerCommand(port));
+ _logger.info("stopping broker: " + getBrokerCommand(port) + " on port " + port);
Process process = _brokers.remove(port);
if (process != null)
{
@@ -665,8 +651,7 @@ public class QpidBrokerTestCase extends
}
else if (_broker.equals(VM))
{
- TransportConnection.killVMBroker(port);
- ApplicationRegistry.remove(port);
+ VmBroker.killVMBroker();
}
}
@@ -754,105 +739,6 @@ public class QpidBrokerTestCase extends
}
/**
- * 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)
- {
- // 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))
- {
- // 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 : _propertiesSetForTestOnly.keySet())
- {
- String value = _propertiesSetForTestOnly.get(key);
- if (value != null)
- {
- System.setProperty(key, value);
- }
- else
- {
- 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();
- }
-
- /**
* Add an environtmen variable for the external broker environment
*
* @param property the property to set
@@ -906,6 +792,11 @@ public class QpidBrokerTestCase extends
{
return _brokerVersion.equals(VERSION_08);
}
+
+ public boolean isBroker09()
+ {
+ return _brokerVersion.startsWith(VERSION_09);
+ }
public boolean isBroker010()
{
@@ -972,17 +863,10 @@ public class QpidBrokerTestCase extends
*/
public AMQConnectionFactory getConnectionFactory() throws NamingException
{
- _logger.info("get ConnectionFactory");
+ _logger.info("get default connection factory");
if (_connectionFactory == null)
{
- if (Boolean.getBoolean("profile.use_ssl"))
- {
- _connectionFactory = getConnectionFactory("default.ssl");
- }
- else
- {
- _connectionFactory = getConnectionFactory("default");
- }
+ _connectionFactory = getConnectionFactory("default");
}
return _connectionFactory;
}
@@ -994,7 +878,7 @@ public class QpidBrokerTestCase extends
*
* @return A conection factory
*
- * @throws Exception if there is an error getting the tactory
+ * @throws Exception if there is an error getting the factory
*/
public AMQConnectionFactory getConnectionFactory(String factoryName) throws NamingException
{
@@ -1002,6 +886,14 @@ public class QpidBrokerTestCase extends
{
factoryName += ".vm";
}
+ else if (Boolean.getBoolean("profile.use_ssl"))
+ {
+ factoryName += ".ssl";
+ }
+ else if (Boolean.getBoolean("profile.udp"))
+ {
+ factoryName += ".udp";
+ }
return (AMQConnectionFactory) getInitialContext().lookup(factoryName);
}
@@ -1079,7 +971,7 @@ public class QpidBrokerTestCase extends
}
- protected void tearDown() throws java.lang.Exception
+ protected void tearDown() throws Exception
{
try
{
@@ -1089,9 +981,10 @@ public class QpidBrokerTestCase extends
c.close();
}
}
- finally{
+ finally
+ {
// Ensure any problems with close does not interfer with property resets
- revertSystemProperties();
+ super.tearDown();
revertLoggingLevels();
}
}
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/util/LogMonitorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/util/LogMonitorTest.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/util/LogMonitorTest.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/systests/src/main/java/org/apache/qpid/util/LogMonitorTest.java Wed Oct 13 15:05:29 2010
@@ -20,14 +20,14 @@
*/
package org.apache.qpid.util;
-import junit.framework.TestCase;
-import org.apache.log4j.Logger;
-
import java.io.File;
import java.io.IOException;
import java.util.List;
-public class LogMonitorTest extends TestCase
+import org.apache.log4j.Logger;
+import org.apache.qpid.test.utils.QpidTestCase;
+
+public class LogMonitorTest extends QpidTestCase
{
private LogMonitor _monitor;
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/08StandaloneExcludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/08StandaloneExcludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/08StandaloneExcludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/08StandaloneExcludes Wed Oct 13 15:05:29 2010
@@ -10,9 +10,13 @@ org.apache.qpid.test.client.message.JMSD
// The new addressing based sytanx is not supported for AMQP 0-8/0-9 versions
org.apache.qpid.test.client.destination.AddressBasedDestinationTest#*
+
org.apache.qpid.test.client.queue.QueuePolicyTest#testRingPolicy
org.apache.qpid.test.client.queue.QueuePolicyTest#testRejectPolicy
// Those tests are written against the 0.10 path
org.apache.qpid.test.unit.message.UTF8Test#*
org.apache.qpid.client.MessageListenerTest#testSynchronousRecieveNoWait
+
+// XA Needs 0-10
+org.apache.qpid.test.unit.xa.*
\ No newline at end of file
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Excludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Excludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Excludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Excludes Wed Oct 13 15:05:29 2010
@@ -1,4 +1,9 @@
+//======================================================================
+//These tests are *always* excluded
+//======================================================================
+
org.apache.qpid.client.MultipleJCAProviderRegistrationTest#test
+
// QPID-1715, QPID-1715 : Client Error Handling on close is still broken
org.apache.qpid.server.queue.QueueCreateTest#testCreatePriorityString
org.apache.qpid.server.queue.QueueCreateTest#testCreateFlowToDiskValidNoSize
@@ -23,12 +28,10 @@ org.apache.qpid.test.unit.ack.Acknowledg
org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#testDirtyClientAck
org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#testClientAck
-
// QPID-143 : Failover can occur between receive and ack but we don't stop the ack.
// Just fully disable both tests as they are highlighting to many Java Client race conditions
org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverOnMessageTest#*
org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#*
// QPID-2418 : The queue backing the dur sub is not currently deleted at subscription change, so the test will fail.
-org.apache.qpid.test.unit.ct.DurableSubscriberTest#testResubscribeWithChangedSelectorAndRestart
-
+org.apache.qpid.test.unit.ct.DurableSubscriberTest#testResubscribeWithChangedSelectorAndRestart
\ No newline at end of file
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Java010Excludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Java010Excludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Java010Excludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/Java010Excludes Wed Oct 13 15:05:29 2010
@@ -1,3 +1,7 @@
+//======================================================================
+//These tests will not work over AMQP 0-10
+//======================================================================
+
// Those tests are testing 0.8 specific semantics
org.apache.qpid.test.testcases.ImmediateMessageTest#test_QPID_517_ImmediateFailsConsumerDisconnectedNoTxP2P
org.apache.qpid.test.testcases.ImmediateMessageTest#test_QPID_517_ImmediateFailsConsumerDisconnectedTxP2P
@@ -58,7 +62,7 @@ org.apache.qpid.test.unit.client.Dynamic
org.apache.qpid.server.queue.ProducerFlowControlTest#*
//QPID-1950 : Commit to test this failure. This is a MINA only failure so it cannot be tested when using 010.
-org.apache.qpid.server.failover.MessageDisappearWithIOExceptionTest#*
+//org.apache.qpid.server.failover.MessageDisappearWithIOExceptionTest#*
//QPID-2471 : Issues with 0-10 recovery
org.apache.qpid.test.unit.ack.RecoverTest#testRecoverInAutoAckListener
@@ -71,9 +75,5 @@ org.apache.qpid.test.unit.publish.DirtyT
org.apache.qpid.test.client.RollbackOrderTest#testOrderingAfterRollbackOnMessage
org.apache.qpid.test.unit.ack.RecoverTest#testRecoverInAutoAckListener
-//Temporarily adding the following until the issues are sorted out.
-//Should probably raise JIRAs for them.
-org.apache.qpid.transport.network.mina.MINANetworkDriverTest#*
-org.apache.qpid.test.unit.basic.LargeMessageTest#*
-org.apache.qpid.test.client.destination.AddressBasedDestinationTest#testCreateExchange
+// Requires ring-queue support
org.apache.qpid.test.client.destination.AddressBasedDestinationTest#testBrowseMode
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaExcludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaExcludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaExcludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaExcludes Wed Oct 13 15:05:29 2010
@@ -1,3 +1,7 @@
+//======================================================================
+//These tests do not work with the Java broker
+//======================================================================
+
// Those tests are not finished
org.apache.qpid.test.testcases.TTLTest#*
org.apache.qpid.test.testcases.FailoverTest#*
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaInVMExcludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaInVMExcludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaInVMExcludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaInVMExcludes Wed Oct 13 15:05:29 2010
@@ -2,6 +2,23 @@
//Exclude the following tests when running the InVM default test profile
//======================================================================
+// Those tests require failover support
+org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverAsQueueBrowserCreated
+org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverWithQueueBrowser
+org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverAsQueueBrowserCreated
+org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverWithQueueBrowser
+org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverAsQueueBrowserCreated
+org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverWithQueueBrowser
+org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverAsQueueBrowserCreated
+org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverWithQueueBrowser
+org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverAsQueueBrowserCreated
+org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverWithQueueBrowser
+org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverAsQueueBrowserCreated
+org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverWithQueueBrowser
+org.apache.qpid.test.testcases.FailoverTest#*
+org.apache.qpid.test.client.failover.FailoverTest#*
+org.apache.qpid.server.failover.MessageDisappearWithIOExceptionTest#*
+
// The FirewallPlugin only operates for TCP connections, the tests NO-OP when run InVM
org.apache.qpid.server.security.firewall.FirewallConfigTest#*
@@ -22,3 +39,6 @@ org.apache.qpid.test.unit.ack.RecoverTes
//The VM broker does not export the logging management JMX MBean
org.apache.qpid.server.security.acl.ExternalAdminACLTest#*
+
+//This test requires a standalone 0-10 broker
+org.apache.qpid.test.unit.message.UTF8Test#*
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaPersistentExcludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaPersistentExcludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaPersistentExcludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaPersistentExcludes Wed Oct 13 15:05:29 2010
@@ -1,2 +1,5 @@
+//======================================================================
//These tests require the MemoryMessageStore
+//======================================================================
+
org.apache.qpid.server.logging.MemoryMessageStoreLoggingTest#*
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaStandaloneExcludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaStandaloneExcludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaStandaloneExcludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaStandaloneExcludes Wed Oct 13 15:05:29 2010
@@ -1,23 +1,10 @@
+//======================================================================
+//These tests require an InVm broker
+//======================================================================
// This is a long running test so should exclude from normal runs
org.apache.qpid.test.client.failover.FailoverTest#test4MinuteFailover
-// Those tests require failover support
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.testcases.FailoverTest#*
-org.apache.qpid.test.client.failover.FailoverTest#*
-
// InVM Broker tests awaiting resolution of QPID-1103
org.apache.qpid.test.client.timeouts.SyncWaitDelayTest#*
org.apache.qpid.test.client.timeouts.SyncWaitTimeoutDelayTest#*
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaTransientExcludes
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaTransientExcludes?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaTransientExcludes (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/JavaTransientExcludes Wed Oct 13 15:05:29 2010
@@ -1,4 +1,7 @@
+//======================================================================
//These tests require a persistent store
+//======================================================================
+
org.apache.qpid.server.store.PersistentStoreTest#*
org.apache.qpid.test.unit.ct.DurableSubscriberTest#*
Added: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.10.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.10.testprofile?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.10.testprofile (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.10.testprofile Wed Oct 13 15:05:29 2010
@@ -0,0 +1,5 @@
+broker.language=java
+broker.version=0-10
+qpid.amqp.version=0-10
+amqj.protocolprovider.class=org.apache.qpid.server.protocol.MultiVersionProtocolEngineFactory
+profile.excludes=JavaTransientExcludes JavaInVMExcludes Java010Excludes
Added: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.8.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.8.testprofile?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.8.testprofile (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.0.8.testprofile Wed Oct 13 15:05:29 2010
@@ -0,0 +1,5 @@
+broker.language=java
+broker.version=0-8
+qpid.amqp.version=0-8
+amqj.protocolprovider.class=org.apache.qpid.server.protocol.MultiVersionProtocolEngineFactory
+profile.excludes=JavaTransientExcludes JavaInVMExcludes 08StandaloneExcludes
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.testprofile?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.testprofile (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/default.testprofile Wed Oct 13 15:05:29 2010
@@ -1,7 +1,8 @@
java.naming.factory.initial=org.apache.qpid.jndi.PropertiesFileInitialContextFactory
java.naming.provider.url=${test.profiles}/test-provider.properties
-broker.version=0-8
+broker.version=0-91
+qpid.amqp.version=0-91
broker=vm
broker.clean=${test.profiles}/clean-dir ${build.data} ${project.root}/build/work
broker.ready=Listening on TCP port
@@ -34,10 +35,10 @@ test.exclude=true
profile.excludes=JavaTransientExcludes JavaInVMExcludes 08StandaloneExcludes
test.excludes=Excludes XAExcludes JavaExcludes ${profile}.excludes ${profile.excludes}
test.fork=no
-test.mem=512M
+test.mem=1024M
test=*Test
haltonfailure=no
haltonerror=no
exclude.modules=none
-profile.clustered=false
+profile.clustered=false
\ No newline at end of file
Added: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.0.10.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.0.10.testprofile?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.0.10.testprofile (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.0.10.testprofile Wed Oct 13 15:05:29 2010
@@ -0,0 +1,13 @@
+broker.language=java
+broker.version=0-10
+broker=${project.root}/build/bin/qpid-server -t udp -p @PORT -m @MPORT -c @CONFIG_FILE -l ${test.profiles}/log4j-test.xml
+broker.clean=${test.profiles}/clean-dir ${build.data} ${project.root}/build/work
+broker.ready=BRK-1004
+broker.stopped=Exception
+qpid.amqp.version=0-10
+
+amqj.protocol.debug=false
+
+profile.udp=true
+
+profile.excludes=JavaTransientExcludes JavaStandaloneExcludes Java010Excludes
\ No newline at end of file
Added: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.testprofile?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.testprofile (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java-udp.testprofile Wed Oct 13 15:05:29 2010
@@ -0,0 +1,11 @@
+broker.language=java
+broker=${project.root}/build/bin/qpid-server -t udp -p @PORT -m @MPORT --exclude-0-10 @PORT -c @CONFIG_FILE -l ${test.profiles}/log4j-test.xml
+broker.clean=${test.profiles}/clean-dir ${build.data} ${project.root}/build/work
+broker.ready=BRK-1004
+broker.stopped=Exception
+
+amqj.protocol.debug=true
+
+profile.udp=true
+
+profile.excludes=JavaTransientExcludes JavaStandaloneExcludes 08StandaloneExcludes
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java.0.10.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java.0.10.testprofile?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java.0.10.testprofile (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/java.0.10.testprofile Wed Oct 13 15:05:29 2010
@@ -5,4 +5,5 @@ broker.clean=${test.profiles}/clean-dir
broker.ready=BRK-1004
broker.stopped=Exception
-profile.excludes=JavaTransientExcludes JavaStandaloneExcludes Java010Excludes
+qpid.amqp.version=0-10
+profile.excludes=JavaTransientExcludes JavaStandaloneExcludes Java010Excludes
\ No newline at end of file
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/test-provider.properties
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/test-provider.properties?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/test-provider.properties (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/test-profiles/test-provider.properties Wed Oct 13 15:05:29 2010
@@ -31,13 +31,16 @@ test.port.alt.ssl=25671
connectionfactory.default = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port}'
connectionfactory.default.ssl = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.ssl}?ssl='true''
connectionfactory.default.vm = amqp://username:password@clientid/test?brokerlist='vm://:1'
+connectionfactory.default.udp = amqp://username:password@clientid/test?brokerlist='udp://localhost:${test.port}'
connectionfactory.failover = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.alt};tcp://localhost:${test.port}'&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20''
connectionfactory.failover.ssl = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.alt.ssl}?ssl='true';tcp://localhost:${test.port.ssl}?ssl='true''&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20''
-connectionfactory.failover.vm = amqp://username:password@clientid/test?brokerlist='vm://:2;vm://:1'&failover='roundrobin?cyclecount='20''
+connectionfactory.failover.udp = amqp://username:password@clientid/test?brokerlist='udp://localhost:${test.port.alt};udp://localhost:${test.port}'&failover='roundrobin?cyclecount='20''
connectionfactory.connection1 = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port}'
connectionfactory.connection2 = amqp://username:password@clientid/test?brokerlist='tcp://localhost:${test.port.alt}'
+connectionfactory.connection1.udp = amqp://username:password@clientid/test?brokerlist='udp://localhost:${test.port}'
+connectionfactory.connection2.udp = amqp://username:password@clientid/test?brokerlist='udp://localhost:${test.port.alt}'
connectionfactory.connection1.vm = amqp://username:password@clientid/test?brokerlist='vm://:1'
connectionfactory.connection2.vm = amqp://username:password@clientid/test?brokerlist='vm://:2'
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Receiver.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Receiver.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Receiver.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Receiver.java Wed Oct 13 15:05:29 2010
@@ -165,11 +165,6 @@ public class Receiver extends Client imp
+ sequence + ",received=" + seq + ")" );
}
}
- else
- {
- msg_count ++;
- }
-
// Please note that this test case doesn't expect duplicates
// When testing for transactions.
if (isTransacted() && msg_count % getTxSize() == 0)
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/TestLauncher.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/TestLauncher.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/TestLauncher.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/TestLauncher.java Wed Oct 13 15:05:29 2010
@@ -29,9 +29,8 @@ import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import java.util.concurrent.Executors;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -46,10 +45,6 @@ import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.qpid.client.AMQAnyDestination;
import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.thread.Threading;
/**
* A basic test case class that could launch a Sender/Receiver
@@ -239,7 +234,7 @@ public class TestLauncher implements Err
Thread t = null;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
@@ -272,7 +267,7 @@ public class TestLauncher implements Err
Thread t = null;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/testkit/testkit.py
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/testkit/testkit.py?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/testkit/testkit.py (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/testkit/testkit.py Wed Oct 13 15:05:29 2010
@@ -100,7 +100,6 @@ class JavaClientTest(BrokerTest):
ssn = broker.connect().session()
err_watcher = ssn.receiver("control; {create:always}", capacity=1)
i = run_time/error_ck_freq
- is_error = False
for j in range(i):
not_empty = True
while not_empty:
@@ -108,15 +107,13 @@ class JavaClientTest(BrokerTest):
m = err_watcher.fetch(timeout=error_ck_freq)
ssn.acknowledge()
print "Java process notified of an error"
- self.print_error(m)
- is_error = True
+ self.check_for_error(m)
except messaging.Empty, e:
not_empty = False
ssn.close()
- return is_error
- def print_error(self,msg):
+ def check_for_error(self,msg):
print msg.properties.get("exception-trace")
def verify(self, receiver,sender):
@@ -128,6 +125,8 @@ class JavaClientTest(BrokerTest):
def start_sender_and_receiver(self,**options):
+ options["use_unique_dests"]=True
+ options["address"]="amq.topic"
receiver_opts = options
receiver_opts["receiver"]=True
receiver = self.popen(self.client(**receiver_opts),
@@ -140,28 +139,21 @@ class JavaClientTest(BrokerTest):
return receiver, sender
- def start_cluster(self,count=2,expect=EXPECT_RUNNING,**options):
- if options.get("durable",False)==True:
- cluster = Cluster(self, count=count, expect=expect, args=self.store_module_args())
- else:
- cluster = Cluster(self, count=count)
- return cluster
-
class ConcurrencyTest(JavaClientTest):
"""A concurrency test suite for the JMS client"""
- skip = True
+ skip = False
def base_case(self,**options):
if self.skip :
print "Skipping test"
return
- cluster = self.start_cluster(count=2,**options)
+ if options["durable"]==True:
+ cluster = Cluster(self, count=2,args=self.store_module_args())
+ else:
+ cluster = Cluster(self, count=2)
self.start_error_watcher(broker=cluster[0])
- options["port"] = port=cluster[0].port()
-
- options["use_unique_dests"]=True
- options["address"]="amq.topic"
+ options["port"] = port=cluster[0].port()
receiver, sender = self.start_sender_and_receiver(**options)
self.monitor_clients(broker=cluster[0],run_time=180)
self.verify(receiver,sender)
@@ -184,7 +176,7 @@ class ConcurrencyTest(JavaClientTest):
def test_multiplexing_con_with_durable_sub(self):
"""Tests multiple sessions with durable subs"""
- self.base_case(ssn_per_con=25,durable=True,jms_durable_sub=True,test_name=self.id())
+ self.base_case(ssn_per_con=25,jms_durable_sub=True,test_name=self.id())
def test_multiplexing_con_with_sync_ack(self):
"""Tests multiple sessions with sync ack"""
@@ -199,80 +191,4 @@ class ConcurrencyTest(JavaClientTest):
def test_multiple_cons_and_ssns(self):
"""Tests multiple connections and sessions"""
- self.base_case(con_count=10,ssn_per_con=25,test_name=self.id())
-
-
-class SoakTest(JavaClientTest):
- """A soak test suite for the JMS client"""
-
- def base_case(self,**options):
- cluster = self.start_cluster(count=4, expect=EXPECT_EXIT_FAIL,**options)
- options["port"] = port=cluster[0].port()
- self.start_error_watcher(broker=cluster[0])
- options["use_unique_dests"]=True
- options["address"]="amq.topic"
- receiver,sender = self.start_sender_and_receiver(**options)
- is_error = self.monitor_clients(broker=cluster[0],run_time=30,error_ck_freq=30)
-
- if (is_error):
- print "The sender or receiver didn't start properly. Exiting test."
- return
- else:
- "Print no error !"
-
- # grace period for java clients to get the failover properly setup.
- time.sleep(30)
- error_msg= None
- # Kill original brokers, start new ones.
- try:
- for i in range(8):
- cluster[i].kill()
- b=cluster.start()
- self.monitor_clients(broker=b,run_time=30,error_ck_freq=30)
- print "iteration : " + str(i)
- except ConnectError, e1:
- error_msg = "Unable to connect to new cluster node : " + traceback.format_exc(e1)
-
- except SessionError, e2:
- error_msg = "Session error while connected to new cluster node : " + traceback.format_exc(e2)
-
- self.verify(receiver,sender)
- if error_msg:
- raise Exception(error_msg)
-
-
- def test_failover(self) :
- """Test basic failover"""
-
- self.base_case(test_name=self.id())
-
-
- def test_failover_with_durablesub(self):
- """Test failover with durable subscriber"""
-
- self.base_case(durable=True,jms_durable_sub=True,test_name=self.id())
-
-
- def test_failover_with_sync_rcv(self):
- """Test failover with sync receive"""
-
- self.base_case(sync_rcv=True,test_name=self.id())
-
-
- def test_failover_with_sync_ack(self):
- """Test failover with sync ack"""
-
- self.base_case(sync_ack=True,test_name=self.id())
-
-
- def test_failover_with_noprefetch(self):
- """Test failover with no prefetch"""
-
- self.base_case(max_prefetch=1,test_name=self.id())
-
-
- def test_failover_with_multiple_cons_and_ssns(self):
- """Test failover with multiple connections and sessions"""
-
- self.base_case(use_unique_dests=True,address="amq.topic",
- con_count=10,ssn_per_con=25,test_name=self.id())
+ self.base_case(con_count=25,ssn_per_con=25,test_name=self.id())
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/tools/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/build.xml?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/build.xml (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/build.xml Wed Oct 13 15:05:29 2010
@@ -20,7 +20,7 @@
-->
<project name="Qpid Tools" default="build">
- <property name="module.depends" value="client common"/>
+ <property name="module.depends" value="client common broker"/>
<import file="../module.xml"/>
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java Wed Oct 13 15:05:29 2010
@@ -24,6 +24,7 @@ import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Executors;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -36,8 +37,6 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.TextMessage;
-import org.apache.qpid.thread.Threading;
-
/**
* Latency test sends an x number of messages in warmup mode and wait for a confirmation
* from the consumer that it has successfully consumed them and ready to start the
@@ -338,7 +337,7 @@ public class LatencyTest extends PerfBas
Thread t;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfConsumer.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfConsumer.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfConsumer.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfConsumer.java Wed Oct 13 15:05:29 2010
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.tools;
+import java.util.concurrent.Executors;
+
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageConsumer;
@@ -27,8 +29,6 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.TextMessage;
-import org.apache.qpid.thread.Threading;
-
/**
* PerfConsumer will receive x no of messages in warmup mode.
* Once it receives the Start message it will then signal the PerfProducer.
@@ -256,7 +256,7 @@ public class PerfConsumer extends PerfBa
Thread t;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfProducer.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfProducer.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfProducer.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfProducer.java Wed Oct 13 15:05:29 2010
@@ -23,6 +23,7 @@ package org.apache.qpid.tools;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import java.util.concurrent.Executors;
import javax.jms.BytesMessage;
import javax.jms.DeliveryMode;
@@ -30,8 +31,6 @@ import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
-import org.apache.qpid.thread.Threading;
-
/**
* PerfProducer sends an x no of messages in warmup mode and wait for a confirmation
* from the consumer that it has successfully consumed them and ready to start the
@@ -251,7 +250,7 @@ public class PerfProducer extends PerfBa
Thread t;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
Modified: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java?rev=1022127&r1=1022126&r2=1022127&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java (original)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java Wed Oct 13 15:05:29 2010
@@ -20,9 +20,7 @@
*/
package org.apache.qpid.tools;
-import static org.apache.qpid.tools.QpidBench.Mode.BOTH;
-import static org.apache.qpid.tools.QpidBench.Mode.CONSUME;
-import static org.apache.qpid.tools.QpidBench.Mode.PUBLISH;
+import static org.apache.qpid.tools.QpidBench.Mode.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -30,6 +28,7 @@ import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Executors;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
@@ -41,7 +40,6 @@ import javax.jms.MessageProducer;
import javax.jms.TextMessage;
import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.thread.Threading;
import org.apache.qpid.transport.DeliveryProperties;
import org.apache.qpid.transport.ExchangeBind;
import org.apache.qpid.transport.Header;
@@ -460,7 +458,7 @@ public class QpidBench
Thread t;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
@@ -499,7 +497,7 @@ public class QpidBench
Thread t;
try
{
- t = Threading.getThreadFactory().createThread(r);
+ t = Executors.defaultThreadFactory().newThread(r);
}
catch(Exception e)
{
Added: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/Configuration.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/Configuration.java?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/Configuration.java (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/Configuration.java Wed Oct 13 15:05:29 2010
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.tools.messagestore;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+import org.apache.qpid.server.StartupException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+
+public class Configuration
+{
+ public static final String QPID_HOME = "QPID_HOME";
+
+ final String QPIDHOME = System.getProperty(QPID_HOME);
+
+ private static Logger _devlog = LoggerFactory.getLogger(Configuration.class);
+
+ public static final String DEFAULT_LOG_CONFIG_FILENAME = "log4j.xml";
+ public static final String DEFAULT_CONFIG_FILE = "etc/config.xml";
+
+ protected final Options _options = new Options();
+ protected CommandLine _commandLine;
+ protected File _configFile;
+
+
+ public Configuration()
+ {
+
+ }
+
+ public void processCommandline(String[] args) throws StartupException
+ {
+ try
+ {
+ _commandLine = new PosixParser().parse(_options, args);
+ }
+ catch (ParseException e)
+ {
+ throw new StartupException("Unable to parse commmandline", e);
+ }
+
+ final File defaultConfigFile = new File(QPIDHOME, DEFAULT_CONFIG_FILE);
+ setConfig(new File(_commandLine.getOptionValue("c", defaultConfigFile.getPath())));
+ }
+
+ public void setConfig(File file)
+ {
+ _configFile = file;
+ }
+
+ /**
+ * @param option The option to set.
+ */
+ public void setOption(Option option)
+ {
+ _options.addOption(option);
+ }
+
+ /**
+ * getOptionValue from the configuration
+ *
+ * @param option variable argument, first string is option to get, second if present is the default value.
+ * @return the String for the given option or null if not present (if default value not specified)
+ */
+ public String getOptionValue(String... option)
+ {
+ if (option.length == 1)
+ {
+ return _commandLine.getOptionValue(option[0]);
+ }
+ else if (option.length == 2)
+ {
+ return _commandLine.getOptionValue(option[0], option[1]);
+ }
+ return null;
+ }
+
+ public void loadConfig(File file) throws StartupException
+ {
+ setConfig(file);
+ loadConfig();
+ }
+
+ private void loadConfig() throws StartupException
+ {
+ if (!_configFile.exists())
+ {
+ String error = "File " + _configFile + " could not be found. Check the file exists and is readable.";
+
+ if (QPIDHOME == null)
+ {
+ error = error + "\nNote: " + QPID_HOME + " is not set.";
+ }
+
+ throw new StartupException(error, null);
+ }
+ else
+ {
+ _devlog.debug("Using configuration file " + _configFile.getAbsolutePath());
+ }
+ }
+
+ public File getConfigFile()
+ {
+ return _configFile;
+ }
+}
\ No newline at end of file
Added: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/MessageStoreTool.java Wed Oct 13 15:05:29 2010
@@ -0,0 +1,653 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *
+ */
+package org.apache.qpid.tools.messagestore;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.StartupException;
+import org.apache.qpid.server.exchange.Exchange;
+import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
+import org.apache.qpid.server.store.MemoryMessageStore;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.tools.messagestore.commands.Clear;
+import org.apache.qpid.tools.messagestore.commands.Command;
+import org.apache.qpid.tools.messagestore.commands.Copy;
+import org.apache.qpid.tools.messagestore.commands.Dump;
+import org.apache.qpid.tools.messagestore.commands.Help;
+import org.apache.qpid.tools.messagestore.commands.List;
+import org.apache.qpid.tools.messagestore.commands.Load;
+import org.apache.qpid.tools.messagestore.commands.Move;
+import org.apache.qpid.tools.messagestore.commands.Purge;
+import org.apache.qpid.tools.messagestore.commands.Quit;
+import org.apache.qpid.tools.messagestore.commands.Select;
+import org.apache.qpid.tools.messagestore.commands.Show;
+import org.apache.qpid.tools.utils.CommandParser;
+import org.apache.qpid.tools.utils.Console;
+import org.apache.qpid.tools.utils.SimpleCommandParser;
+import org.apache.qpid.tools.utils.SimpleConsole;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * MessageStoreTool.
+ */
+public class MessageStoreTool
+{
+ /** Text outputted at the start of each console.*/
+ private static final String BOILER_PLATE = "MessageStoreTool - for examining Persistent Qpid Broker MessageStore instances";
+
+ /** I/O Wrapper. */
+ protected Console _console;
+
+ /** Batch mode flag. */
+ protected boolean _batchMode;
+
+ /** Internal State object. */
+ private State _state = new State();
+
+ private HashMap<String, Command> _commands = new HashMap<String, Command>();
+
+ /** SLF4J Logger. */
+ private static Logger _devlog = LoggerFactory.getLogger(MessageStoreTool.class);
+
+ /** Loaded configuration file. */
+ private Configuration _config;
+
+ /** Control used for main run loop. */
+ private boolean _running = true;
+ private boolean _initialised = false;
+
+ //---------------------------------------------------------------------------------------------------/
+
+ public static void main(String[] args) throws StartupException
+ {
+ MessageStoreTool tool = new MessageStoreTool(args);
+
+ tool.start();
+ }
+
+ public MessageStoreTool(String[] args) throws StartupException
+ {
+ this(args, System.in, System.out);
+ }
+
+ public MessageStoreTool(String[] args, InputStream in, OutputStream out) throws StartupException
+ {
+ BufferedReader consoleReader = new BufferedReader(new InputStreamReader(in));
+ BufferedWriter consoleWriter = new BufferedWriter(new OutputStreamWriter(out));
+
+ Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook(this)));
+
+ _batchMode = false;
+
+ _console = new SimpleConsole(consoleWriter, consoleReader);
+
+ _config = new Configuration();
+
+ setOptions();
+
+ _config.processCommandline(args);
+ }
+
+
+ @SuppressWarnings({ "static-access" })
+ private void setOptions()
+ {
+ Option help = new Option("h", "help", false, "print this message");
+ Option version = new Option("v", "version", false, "print the version information and exit");
+ Option configFile =
+ OptionBuilder.withArgName("file").hasArg()
+ .withDescription("use given configuration file By "
+ + "default looks for a file named "
+ + Configuration.DEFAULT_CONFIG_FILE + " in " + Configuration.QPID_HOME)
+ .withLongOpt("config")
+ .create("c");
+
+ _config.setOption(help);
+ _config.setOption(version);
+ _config.setOption(configFile);
+ }
+
+ public State getState()
+ {
+ return _state;
+ }
+
+ public Map<String, Command> getCommands()
+ {
+ return _commands;
+ }
+
+ public void setConfigurationFile(String configfile) throws StartupException
+ {
+ _config.loadConfig(new File(configfile));
+ setup();
+ }
+
+ public Console getConsole()
+ {
+ return _console;
+ }
+
+ public void setConsole(Console console)
+ {
+ _console = console;
+ }
+
+ /**
+ * Simple ShutdownHook to cleanly shutdown the databases
+ */
+ static class ShutdownHook implements Runnable
+ {
+ MessageStoreTool _tool;
+
+ ShutdownHook(MessageStoreTool messageStoreTool)
+ {
+ _tool = messageStoreTool;
+ }
+
+ public void run()
+ {
+ _tool.quit();
+ }
+ }
+
+ public void quit()
+ {
+ _running = false;
+
+ if (_initialised)
+ {
+ ApplicationRegistry.remove();
+ }
+
+ _console.println("...exiting");
+
+ _console.close();
+ }
+
+ public void setBatchMode(boolean batchmode)
+ {
+ _batchMode = batchmode;
+ }
+
+ /**
+ * Main loop
+ */
+ protected void start()
+ {
+ setup();
+
+ if (!_initialised)
+ {
+ System.exit(1);
+ }
+
+ _console.println("");
+
+ _console.println(BOILER_PLATE);
+
+ runCLI();
+ }
+
+ private void setup()
+ {
+ loadDefaultVirtualHosts();
+
+ loadCommands();
+
+ _state.clearAll();
+ }
+
+ private void loadCommands()
+ {
+ _commands.clear();
+ //todo Dynamically load the classes that exis in com.redhat.etp.qpid.commands
+ _commands.put("close", new Clear(this));
+ _commands.put("copy", new Copy(this));
+ _commands.put("dump", new Dump(this));
+ _commands.put("help", new Help(this));
+ _commands.put("list", new List(this));
+ _commands.put("load", new Load(this));
+ _commands.put("move", new Move(this));
+ _commands.put("purge", new Purge(this));
+ _commands.put("quit", new Quit(this));
+ _commands.put("select", new Select(this));
+ _commands.put("show", new Show(this));
+ }
+
+ private void loadDefaultVirtualHosts()
+ {
+ final File configFile = _config.getConfigFile();
+
+ loadVirtualHosts(configFile);
+ }
+
+ private void loadVirtualHosts(File configFile)
+ {
+
+ if (!configFile.exists())
+ {
+ _devlog.error("Config file not found:" + configFile.getAbsolutePath());
+ return;
+ }
+ else
+ {
+ _devlog.debug("using config file :" + configFile.getAbsolutePath());
+ }
+
+ try
+ {
+ ConfigurationFileApplicationRegistry registry = new ConfigurationFileApplicationRegistry(configFile);
+
+ ApplicationRegistry.remove();
+
+ ApplicationRegistry.initialise(registry);
+
+ checkMessageStores();
+ _initialised = true;
+ }
+ catch (ConfigurationException e)
+ {
+ _console.println("Unable to load configuration due to configuration error: " + e.getMessage());
+ e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ _console.println("Unable to load configuration due to: " + e.getMessage());
+ e.printStackTrace();
+ }
+
+
+ }
+
+ private void checkMessageStores()
+ {
+ Collection<VirtualHost> vhosts = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHosts();
+
+ boolean warning = false;
+ for (VirtualHost vhost : vhosts)
+ {
+ if (vhost.getMessageStore() instanceof MemoryMessageStore)
+ {
+ _console.println("WARNING: Virtualhost '" + vhost.getName() + "' is using a MemoryMessageStore. "
+ + "Changes will not persist.");
+ warning = true;
+ }
+ }
+
+ if (warning)
+ {
+ _console.println("");
+ _console.println("Please ensure you are using the correct config file currently using '"
+ + _config.getConfigFile().getAbsolutePath() + "'");
+ _console.println("New config file can be specifed by 'load <config file>' or -c on the commandline.");
+ _console.println("");
+ }
+ }
+
+ private void runCLI()
+ {
+ while (_running)
+ {
+ if (!_batchMode)
+ {
+ printPrompt();
+ }
+
+ String[] args = _console.readCommand();
+
+ while (args != null)
+ {
+ exec(args);
+
+ if (_running)
+ {
+ if (!_batchMode)
+ {
+ printPrompt();
+ }
+
+ args = _console.readCommand();
+ }
+ }
+ }
+ }
+
+ private void printPrompt()
+ {
+ _console.print(prompt());
+ }
+
+
+ /**
+ * Execute a script (batch mode).
+ *
+ * @param script The file script
+ */
+ protected void runScripts(String script)
+ {
+ //Store Current State
+ boolean oldBatch = _batchMode;
+ CommandParser oldParser = _console.getCommandParser();
+ setBatchMode(true);
+
+ try
+ {
+ _devlog.debug("Running script '" + script + "'");
+
+ _console.setCommandParser(new SimpleCommandParser(new BufferedReader(new FileReader(script))));
+
+ start();
+ }
+ catch (java.io.FileNotFoundException e)
+ {
+ _devlog.error("Script not found: '" + script + "' due to:" + e.getMessage());
+ }
+
+ //Restore previous state
+ _console.setCommandParser(oldParser);
+ setBatchMode(oldBatch);
+ }
+
+ public String prompt()
+ {
+ String state = _state.toString();
+ if (state != null && state.length() != 0)
+ {
+ return state + ":bdb$ ";
+ }
+ else
+ {
+ return "bdb$ ";
+ }
+ }
+
+ /**
+ * Execute the command.
+ *
+ * @param args [command, arg0, arg1...].
+ */
+ protected void exec(String[] args)
+ {
+ // Comment lines start with a #
+ if (args.length == 0 || args[0].startsWith("#"))
+ {
+ return;
+ }
+
+ final String command = args[0];
+
+ Command cmd = _commands.get(command);
+
+ if (cmd == null)
+ {
+ _console.println("Command not understood: " + command);
+ }
+ else
+ {
+ cmd.execute(args);
+ }
+ }
+
+
+ /**
+ * Displays usage info.
+ */
+ protected static void help()
+ {
+ System.out.println(BOILER_PLATE);
+ System.out.println("Usage: java " + MessageStoreTool.class + " [Options]");
+ System.out.println(" [-c <broker config file>] : Defaults to \"$QPID_HOME/etc/config.xml\"");
+ }
+
+
+ /**
+ * This class is used to store the current state of the tool.
+ *
+ * This is then interrogated by the various commands to augment their behaviour.
+ *
+ *
+ */
+ public static class State
+ {
+ private VirtualHost _vhost = null;
+ private AMQQueue _queue = null;
+ private Exchange _exchange = null;
+ private java.util.List<Long> _msgids = null;
+
+ public State()
+ {
+ }
+
+ public void setQueue(AMQQueue queue)
+ {
+ _queue = queue;
+ }
+
+ public AMQQueue getQueue()
+ {
+ return _queue;
+ }
+
+ public void setVhost(VirtualHost vhost)
+ {
+ _vhost = vhost;
+ }
+
+ public VirtualHost getVhost()
+ {
+ return _vhost;
+ }
+
+ public Exchange getExchange()
+ {
+ return _exchange;
+ }
+
+ public void setExchange(Exchange exchange)
+ {
+ _exchange = exchange;
+ }
+
+ public String toString()
+ {
+ StringBuilder status = new StringBuilder();
+
+ if (_vhost != null)
+ {
+ status.append(_vhost.getName());
+
+ if (_exchange != null)
+ {
+ status.append("[");
+ status.append(_exchange.getNameShortString());
+ status.append("]");
+
+ if (_queue != null)
+ {
+ status.append("->'");
+ status.append(_queue.getNameShortString());
+ status.append("'");
+
+ if (_msgids != null)
+ {
+ status.append(printMessages());
+ }
+ }
+ }
+ }
+
+ return status.toString();
+ }
+
+
+ public String printMessages()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ Long previous = null;
+
+ Long start = null;
+ for (Long id : _msgids)
+ {
+ if (previous != null)
+ {
+ if (id == previous + 1)
+ {
+ if (start == null)
+ {
+ start = previous;
+ }
+ }
+ else
+ {
+ if (start != null)
+ {
+ sb.append(",");
+ sb.append(start);
+ sb.append("-");
+ sb.append(id);
+ start = null;
+ }
+ else
+ {
+ sb.append(",");
+ sb.append(previous);
+ }
+ }
+ }
+
+ previous = id;
+ }
+
+ if (start != null)
+ {
+ sb.append(",");
+ sb.append(start);
+ sb.append("-");
+ sb.append(_msgids.get(_msgids.size() - 1));
+ }
+ else
+ {
+ sb.append(",");
+ sb.append(previous);
+ }
+
+ // surround list in ()
+ sb.replace(0, 1, "(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void clearAll()
+ {
+ _vhost = null;
+ clearExchange();
+ }
+
+ public void clearExchange()
+ {
+ _exchange = null;
+ clearQueue();
+ }
+
+ public void clearQueue()
+ {
+ _queue = null;
+ clearMessages();
+ }
+
+ public void clearMessages()
+ {
+ _msgids = null;
+ }
+
+ /**
+ * A common location to provide parsing of the message id string
+ * utilised by a number of the commands.
+ * The String is comma separated list of ids that can be individual ids
+ * or a range (4-10)
+ *
+ * @param msgString string of msg ids to parse 1,2,4-10
+ */
+ public void setMessages(String msgString)
+ {
+ StringTokenizer tok = new StringTokenizer(msgString, ",");
+
+ if (tok.hasMoreTokens())
+ {
+ _msgids = new LinkedList<Long>();
+ }
+
+ while (tok.hasMoreTokens())
+ {
+ String next = tok.nextToken();
+ if (next.contains("-"))
+ {
+ Long start = Long.parseLong(next.substring(0, next.indexOf("-")));
+ Long end = Long.parseLong(next.substring(next.indexOf("-") + 1));
+
+ if (end >= start)
+ {
+ for (long l = start; l <= end; l++)
+ {
+ _msgids.add(l);
+ }
+ }
+ }
+ else
+ {
+ _msgids.add(Long.parseLong(next));
+ }
+ }
+
+ }
+
+ public void setMessages(java.util.List<Long> msgids)
+ {
+ _msgids = msgids;
+ }
+
+ public java.util.List<Long> getMessages()
+ {
+ return _msgids;
+ }
+ }//Class State
+
+}//Class MessageStoreTool
Added: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/AbstractCommand.java Wed Oct 13 15:05:29 2010
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *
+ */
+package org.apache.qpid.tools.messagestore.commands;
+
+import org.apache.qpid.tools.messagestore.MessageStoreTool;
+import org.apache.qpid.tools.utils.Console;
+
+public abstract class AbstractCommand implements Command
+{
+ protected Console _console;
+ protected MessageStoreTool _tool;
+
+ public AbstractCommand(MessageStoreTool tool)
+ {
+ _console = tool.getConsole();
+ _tool = tool;
+ }
+
+ public void setOutput(Console out)
+ {
+ _console = out;
+ }
+
+ protected void commandError(String message, String[] args)
+ {
+ _console.print(getCommand() + " : " + message);
+
+ if (args != null)
+ {
+ for (int i = 1; i < args.length; i++)
+ {
+ _console.print(args[i]);
+ }
+ }
+ _console.println("");
+ _console.println(help());
+ }
+
+
+ public abstract String help();
+
+ public abstract String usage();
+
+ public abstract String getCommand();
+
+
+ public abstract void execute(String... args);
+}
Added: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Clear.java Wed Oct 13 15:05:29 2010
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *
+ */
+package org.apache.qpid.tools.messagestore.commands;
+
+import org.apache.qpid.tools.messagestore.MessageStoreTool;
+
+public class Clear extends AbstractCommand
+{
+ public Clear(MessageStoreTool tool)
+ {
+ super(tool);
+ }
+
+ public String help()
+ {
+ return "Clears any selection.";
+ }
+
+ public String usage()
+ {
+ return "clear [ all | virtualhost | exchange | queue | msgs ]";
+ }
+
+ public String getCommand()
+ {
+ return "clear";
+ }
+
+ public void execute(String... args)
+ {
+ assert args.length > 0;
+ assert args[0].equals(getCommand());
+
+ if (args.length < 1)
+ {
+ doClose("all");
+ }
+ else
+ {
+ doClose(args[1]);
+ }
+ }
+
+ private void doClose(String type)
+ {
+ if (type.equals("virtualhost")
+ || type.equals("all"))
+ {
+ _tool.getState().clearAll();
+ }
+
+ if (type.equals("exchange"))
+ {
+ _tool.getState().clearExchange();
+ }
+
+ if (type.equals("queue"))
+ {
+ _tool.getState().clearQueue();
+ }
+
+ if (type.equals("msgs"))
+ {
+ _tool.getState().clearMessages();
+ }
+ }
+}
Added: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Command.java Wed Oct 13 15:05:29 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *
+ */
+package org.apache.qpid.tools.messagestore.commands;
+
+import org.apache.qpid.tools.utils.Console;
+
+public interface Command
+{
+ public void setOutput(Console out);
+
+ public String help();
+
+ public abstract String usage();
+
+ String getCommand();
+
+ public void execute(String... args);
+}
Added: qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java?rev=1022127&view=auto
==============================================================================
--- qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java (added)
+++ qpid/branches/grkvlt-network-20101013/qpid/java/tools/src/main/java/org/apache/qpid/tools/messagestore/commands/Copy.java Wed Oct 13 15:05:29 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *
+ */
+package org.apache.qpid.tools.messagestore.commands;
+
+import org.apache.qpid.tools.messagestore.MessageStoreTool;
+import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.txn.ServerTransaction;
+import org.apache.qpid.server.txn.LocalTransaction;
+
+public class Copy extends Move
+{
+ public Copy(MessageStoreTool tool)
+ {
+ super(tool);
+ }
+
+ public String help()
+ {
+ return "Copy messages between queues.";/*\n" +
+ "The currently selected message set will be copied to the specifed queue.\n" +
+ "Alternatively the values can be provided on the command line."; */
+ }
+
+ public String usage()
+ {
+ return "copy to=<queue> [from=<queue>] [msgids=<msgids eg, 1,2,4-10>]";
+ }
+
+ public String getCommand()
+ {
+ return "copy";
+ }
+
+ protected void doCommand(AMQQueue fromQueue, long start, long end, AMQQueue toQueue)
+ {
+ ServerTransaction txn = new LocalTransaction(fromQueue.getVirtualHost().getTransactionLog());
+ fromQueue.copyMessagesToAnotherQueue(start, end, toQueue.getNameShortString().toString(), txn);
+ txn.commit();
+ }
+
+}
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org