svn commit: r812821 - /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/network/FirewallFactory.java

2009-09-09 Thread aidan
Author: aidan
Date: Wed Sep  9 08:36:52 2009
New Revision: 812821

URL: http://svn.apache.org/viewvc?rev=812821&view=rev
Log:
Remove unusued FirewallFactory class

Removed:

qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/network/FirewallFactory.java


-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r812825 - in /qpid/trunk/qpid/java/broker/src: main/java/org/apache/qpid/server/security/access/plugins/BasicACLPlugin.java test/java/org/apache/qpid/server/security/access/ExchangeDenier.

2009-09-09 Thread aidan
Author: aidan
Date: Wed Sep  9 08:45:51 2009
New Revision: 812825

URL: http://svn.apache.org/viewvc?rev=812825&view=rev
Log:
Remove some more unused code.

Modified:

qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicACLPlugin.java

qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/ExchangeDenier.java

Modified: 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicACLPlugin.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicACLPlugin.java?rev=812825&r1=812824&r2=812825&view=diff
==
--- 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicACLPlugin.java
 (original)
+++ 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicACLPlugin.java
 Wed Sep  9 08:45:51 2009
@@ -120,10 +120,4 @@
 // no-op
 }
 
-public boolean supportsTag(String name)
-{
-// This plugin doesn't support any tags
-return false;
-}
-
 }

Modified: 
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/ExchangeDenier.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/ExchangeDenier.java?rev=812825&r1=812824&r2=812825&view=diff
==
--- 
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/ExchangeDenier.java
 (original)
+++ 
qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/ExchangeDenier.java
 Wed Sep  9 08:45:51 2009
@@ -46,17 +46,4 @@
 {
 return AuthzResult.DENIED;
 }
-
-@Override
-public String getPluginName()
-{
-return getClass().getSimpleName();
-}
-
-@Override
-public boolean supportsTag(String name)
-{
-return name.equals("exchangeDenier");
-}
-
 }



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r812936 [6/6] - in /qpid/branches/java-network-refactor: ./ qpid/buildtools/buildCreator/ qpid/cpp/ qpid/cpp/bindings/qmf/ qpid/cpp/bindings/qmf/python/ qpid/cpp/bindings/qmf/python/qmf/ q

2009-09-09 Thread aidan
Modified: qpid/branches/java-network-refactor/qpid/python/tests_0-9/queue.py
URL: 
http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/python/tests_0-9/queue.py?rev=812936&r1=812935&r2=812936&view=diff
==
--- qpid/branches/java-network-refactor/qpid/python/tests_0-9/queue.py 
(original)
+++ qpid/branches/java-network-refactor/qpid/python/tests_0-9/queue.py Wed Sep  
9 13:05:43 2009
@@ -6,9 +6,9 @@
 # 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
@@ -19,11 +19,137 @@
 from qpid.client import Client, Closed
 from qpid.queue import Empty
 from qpid.content import Content
-from qpid.testlib import TestBase
+from qpid.testlib import testrunner, TestBase
 
 class QueueTests(TestBase):
 """Tests for 'methods' on the amqp queue 'class'"""
 
+def test_purge(self):
+"""
+Test that the purge method removes messages from the queue
+"""
+channel = self.channel
+#setup, declare a queue and add some messages to it:
+channel.exchange_declare(exchange="test-exchange", type="direct")
+channel.queue_declare(queue="test-queue", exclusive=True)
+channel.queue_bind(queue="test-queue", exchange="test-exchange", 
routing_key="key")
+channel.message_transfer(destination="test-exchange", 
routing_key="key", body="one")
+channel.message_transfer(destination="test-exchange", 
routing_key="key", body="two")
+channel.message_transfer(destination="test-exchange", 
routing_key="key", body="three")
+
+#check that the queue now reports 3 messages:
+reply = channel.queue_declare(queue="test-queue")
+self.assertEqual(3, reply.message_count)
+
+#now do the purge, then test that three messages are purged and the 
count drops to 0
+reply = channel.queue_purge(queue="test-queue");
+self.assertEqual(3, reply.message_count)
+reply = channel.queue_declare(queue="test-queue")
+self.assertEqual(0, reply.message_count)
+
+#send a further message and consume it, ensuring that the other 
messages are really gone
+channel.message_transfer(destination="test-exchange", 
routing_key="key", body="four")
+channel.message_consume(queue="test-queue", destination="tag", 
no_ack=True)
+queue = self.client.queue("tag")
+msg = queue.get(timeout=1)
+self.assertEqual("four", msg.body)
+
+#check error conditions (use new channels): 
+channel = self.client.channel(2)
+channel.channel_open()
+try:
+#queue specified but doesn't exist:
+channel.queue_purge(queue="invalid-queue")
+self.fail("Expected failure when purging non-existent queue")
+except Closed, e:
+self.assertChannelException(404, e.args[0])
+
+channel = self.client.channel(3)
+channel.channel_open()
+try:
+#queue not specified and none previously declared for channel:
+channel.queue_purge()
+self.fail("Expected failure when purging unspecified queue")
+except Closed, e:
+self.assertConnectionException(530, e.args[0])
+
+#cleanup
+other = self.connect()
+channel = other.channel(1)
+channel.channel_open()
+channel.exchange_delete(exchange="test-exchange")
+
+def test_declare_exclusive(self):
+"""
+Test that the exclusive field is honoured in queue.declare
+"""
+# TestBase.setUp has already opened channel(1)
+c1 = self.channel
+# Here we open a second separate connection:
+other = self.connect()
+c2 = other.channel(1)
+c2.channel_open()
+
+#declare an exclusive queue:
+c1.queue_declare(queue="exclusive-queue", exclusive="True")
+try:
+#other connection should not be allowed to declare this:
+c2.queue_declare(queue="exclusive-queue", exclusive="True")
+self.fail("Expected second exclusive queue_declare to raise a 
channel exception")
+except Closed, e:
+self.assertChannelException(405, e.args[0])
+
+
+def test_declare_passive(self):
+"""
+Test that the passive field is honoured in queue.declare
+"""
+channel = self.channel
+#declare an exclusive queue:
+channel.queue_declare(queue="passive-queue-1", exclusive="True")
+channel.queue_declare(queue="passive-queue-1", passive="True")
+try:
+#other connection

svn commit: r812995 - /qpid/trunk/qpid/cpp/src/tests/sender.cpp

2009-09-09 Thread mgoulish
Author: mgoulish
Date: Wed Sep  9 15:30:12 2009
New Revision: 812995

URL: http://svn.apache.org/viewvc?rev=812995&view=rev
Log:
( mgoulish checking in changes for gsim )
add ttl option for messages.

Modified:
qpid/trunk/qpid/cpp/src/tests/sender.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/sender.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sender.cpp?rev=812995&r1=812994&r2=812995&view=diff
==
--- qpid/trunk/qpid/cpp/src/tests/sender.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/sender.cpp Wed Sep  9 15:30:12 2009
@@ -43,16 +43,18 @@
 string key;
 uint sendEos;
 bool durable;
+uint ttl;
 string lvqMatchValue;
 string lvqMatchFile;
 
-Args() : key("test-queue"), sendEos(0), durable(false)
+Args() : key("test-queue"), sendEos(0), durable(false), ttl(0)
 {
 addOptions()
 ("exchange", qpid::optValue(destination, "EXCHANGE"), "Exchange to 
send messages to")
 ("routing-key", qpid::optValue(key, "KEY"), "Routing key to add to 
messages")
 ("send-eos", qpid::optValue(sendEos, "N"), "Send N EOS messages to 
mark end of input")
 ("durable", qpid::optValue(durable, "true|false"), "Mark messages 
as durable.")
+   ("ttl", qpid::optValue(ttl, "msecs"), "Time-to-live for messages, 
in milliseconds")
 ("lvq-match-value", qpid::optValue(lvqMatchValue, "KEY"), "The 
value to set for the LVQ match key property")
 ("lvq-match-file", qpid::optValue(lvqMatchFile, "FILE"), "A file 
containing values to set for the LVQ match key property");
 }
@@ -63,8 +65,7 @@
 class Sender : public FailoverManager::Command
 {
   public:
-Sender(const std::string& destination, const std::string& key, uint 
sendEos, bool durable, 
-   const std::string& lvqMatchValue, const std::string& lvqMatchFile);
+Sender(const std::string& destination, const std::string& key, uint 
sendEos, bool durable, uint ttl, const std::string& lvqMatchValue, const 
std::string& lvqMatchFile);
 void execute(AsyncSession& session, bool isRetry);
   private:
 const std::string destination;
@@ -75,14 +76,17 @@
 std::ifstream lvqMatchValues;
 };
 
-Sender::Sender(const std::string& dest, const std::string& key, uint eos, bool 
durable,
-   const std::string& lvqMatchValue, const std::string& 
lvqMatchFile) :
+Sender::Sender(const std::string& dest, const std::string& key, uint eos, bool 
durable, uint ttl, const std::string& lvqMatchValue, const std::string& 
lvqMatchFile) :
 destination(dest), sender(10), message("", key), sendEos(eos), sent(0) , 
lvqMatchValues(lvqMatchFile.c_str())
 {
 if (durable){
 message.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
 }
 
+if (ttl) {
+message.getDeliveryProperties().setTtl(ttl);
+}
+
 if (!lvqMatchValue.empty()) {
 message.getHeaders().setString(QueueOptions::strLVQMatchProperty, 
lvqMatchValue);
 }
@@ -114,7 +118,7 @@
 try {
 opts.parse(argc, argv);
 FailoverManager connection(opts.con);
-Sender sender(opts.destination, opts.key, opts.sendEos, opts.durable, 
opts.lvqMatchValue, opts.lvqMatchFile);
+Sender sender(opts.destination, opts.key, opts.sendEos, opts.durable, 
opts.ttl, opts.lvqMatchValue, opts.lvqMatchFile);
 connection.execute(sender);
 connection.close();
 return 0;  



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r813079 - /qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h

2009-09-09 Thread aconway
Author: aconway
Date: Wed Sep  9 19:01:09 2009
New Revision: 813079

URL: http://svn.apache.org/viewvc?rev=813079&view=rev
Log:
Replace write lock with read lock in QueueRegistry::eachQueue.

Modified:
qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h?rev=813079&r1=813078&r2=813079&view=diff
==
--- qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h Wed Sep  9 19:01:09 2009
@@ -111,7 +111,7 @@
 
 /** Call f for each queue in the registry. */
 template  void eachQueue(F f) const {
-qpid::sys::RWlock::ScopedWlock l(lock);
+qpid::sys::RWlock::ScopedRlock l(lock);
 for (QueueMap::const_iterator i = queues.begin(); i != queues.end(); 
++i)
 f(i->second);
 }



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r813092 - /qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp

2009-09-09 Thread shuston
Author: shuston
Date: Wed Sep  9 19:45:26 2009
New Revision: 813092

URL: http://svn.apache.org/viewvc?rev=813092&view=rev
Log:
Adjust to new location of state_saver in Boost 1.40; fixes QPID-2090

Modified:
qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp?rev=813092&r1=813091&r2=813092&view=diff
==
--- qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp Wed Sep  9 19:45:26 2009
@@ -29,7 +29,14 @@
 #include "qpid/client/Message.h"
 #include "qpid/client/MessageImpl.h"
 
-#include 
+#include 
+#if (BOOST_VERSION >= 104000)
+#  include 
+  using boost::serialization::state_saver;
+#else
+#  include 
+  using boost::state_saver;
+#endif /* BOOST_VERSION */
 
 using qpid::framing::FrameSet;
 using qpid::framing::MessageTransferBody;
@@ -65,7 +72,7 @@
 Mutex::ScopedLock l(lock);
 if (running) 
 throw Exception("Dispatcher is already running.");
-boost::state_saver  reset(running); // Reset to false on exit.
+state_saver  reset(running); // Reset to false on exit.
 running = true;
 try {
 while (!queue->isClosed()) {



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r813096 - /qpid/branches/0.5-release/qpid/cpp/src/qpid/client/Dispatcher.cpp

2009-09-09 Thread shuston
Author: shuston
Date: Wed Sep  9 19:50:35 2009
New Revision: 813096

URL: http://svn.apache.org/viewvc?rev=813096&view=rev
Log:
Back-port QPID-2090 fix for Boost 1.40

Modified:
qpid/branches/0.5-release/qpid/cpp/src/qpid/client/Dispatcher.cpp

Modified: qpid/branches/0.5-release/qpid/cpp/src/qpid/client/Dispatcher.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/cpp/src/qpid/client/Dispatcher.cpp?rev=813096&r1=813095&r2=813096&view=diff
==
--- qpid/branches/0.5-release/qpid/cpp/src/qpid/client/Dispatcher.cpp (original)
+++ qpid/branches/0.5-release/qpid/cpp/src/qpid/client/Dispatcher.cpp Wed Sep  
9 19:50:35 2009
@@ -27,7 +27,14 @@
 #include "qpid/sys/BlockingQueue.h"
 #include "Message.h"
 
-#include 
+#include 
+#if (BOOST_VERSION >= 104000)
+#  include 
+  using boost::serialization::state_saver;
+#else
+#  include 
+  using boost::state_saver;
+#endif /* BOOST_VERSION */
 
 using qpid::framing::FrameSet;
 using qpid::framing::MessageTransferBody;
@@ -64,7 +71,7 @@
 Mutex::ScopedLock l(lock);
 if (running) 
 throw Exception("Dispatcher is already running.");
-boost::state_saver  reset(running); // Reset to false on exit.
+state_saver  reset(running); // Reset to false on exit.
 running = true;
 try {
 while (!queue->isClosed()) {



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r813100 - /qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp

2009-09-09 Thread aconway
Author: aconway
Date: Wed Sep  9 20:17:20 2009
New Revision: 813100

URL: http://svn.apache.org/viewvc?rev=813100&view=rev
Log:
Fix QPID-2086, hang of federated_cluster_test_with_node_failure.

cluster::Connection did not give read credit if there was an exception 
processing a frame.

Modified:
qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp?rev=813100&r1=813099&r2=813100&view=diff
==
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Wed Sep  9 20:17:20 2009
@@ -156,8 +156,17 @@
 return !message.empty();
 }
 
+struct GiveReadCreditOnExit {
+Connection& connection;
+int credit;
+GiveReadCreditOnExit(Connection& connection_, int credit_) :
+connection(connection_), credit(credit_) {}
+~GiveReadCreditOnExit() { connection.giveReadCredit(credit); }
+};
+
 // Called in delivery thread, in cluster order.
 void Connection::deliveredFrame(const EventFrame& f) {
+GiveReadCreditOnExit gc(*this, f.readCredit);
 assert(!catchUp);
 currentChannel = f.frame.getChannel(); 
 if (f.frame.getBody()   // frame can be emtpy with just readCredit
@@ -171,7 +180,6 @@
 if (ss) ss->out(const_cast(f.frame));
 }
 }
-giveReadCredit(f.readCredit);
 }
 
 // A local connection is closed by the network layer.



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org



svn commit: r813123 - /qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp

2009-09-09 Thread astitcher
Author: astitcher
Date: Wed Sep  9 21:17:25 2009
New Revision: 813123

URL: http://svn.apache.org/viewvc?rev=813123&view=rev
Log:
Fixed wrong namespace placement in previous check in

Modified:
qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp?rev=813123&r1=813122&r2=813123&view=diff
==
--- qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp Wed Sep  9 21:17:25 
2009
@@ -39,6 +39,9 @@
 
 #include 
 
+namespace qpid {
+namespace tests {
+
 QPID_AUTO_TEST_SUITE(XmlClientSessionTest)
 
 using namespace qpid::client;
@@ -52,9 +55,6 @@
 using std::cout;
 using std::endl;
 
-namespace qpid {
-namespace tests {
-
 #if defined (QPID_MODULE_SUFFIX)
 Shlib shlib("../xml" QPID_MODULE_SUFFIX);
 #else



-
Apache Qpid - AMQP Messaging Implementation
Project:  http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org