qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r825672 - in /qpid/trunk/qpid/cpp: bindings/qmf/tests/python_console.py bindings/qmf/tests/ruby_console_test.rb src/qmf.mk src/qmf/engine/BrokerProxyImpl.cpp src/qmf/engine/BrokerProxyImpl.h src/qmf/engine/QueryImpl.h
Date Thu, 15 Oct 2009 21:38:07 GMT
Author: tross
Date: Thu Oct 15 21:38:07 2009
New Revision: 825672

URL: http://svn.apache.org/viewvc?rev=825672&view=rev
Log:
Bug fix: Console sent get-requests (by objectId) to all agents, not just the agent
         identified in the objectId.

Modified:
    qpid/trunk/qpid/cpp/bindings/qmf/tests/python_console.py
    qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb
    qpid/trunk/qpid/cpp/src/qmf.mk
    qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.cpp
    qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.h
    qpid/trunk/qpid/cpp/src/qmf/engine/QueryImpl.h

Modified: qpid/trunk/qpid/cpp/bindings/qmf/tests/python_console.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf/tests/python_console.py?rev=825672&r1=825671&r2=825672&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf/tests/python_console.py (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf/tests/python_console.py Thu Oct 15 21:38:07 2009
@@ -140,6 +140,17 @@
         self.assertEqual(result.status, 0)
         self.assertEqual(result.userid, "guest")
 
+    def test_D_get_by_object_id(self):
+        self.startQmf()
+        qmf = self.qmf
+
+        parents = qmf.getObjects(_class="parent")
+        self.assertEqual(len(parents), 1)
+        parent = parents[0]
+
+        newList = qmf.getObjects(_objectId=parent.getObjectId())
+        self.assertEqual(len(newList), 1)
+
     def getProperty(self, msg, name):
         for h in msg.headers:
             if hasattr(h, name): return getattr(h, name)

Modified: qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb?rev=825672&r1=825671&r2=825672&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb Thu Oct 15 21:38:07 2009
@@ -186,6 +186,21 @@
     assert_equal(result.args.userid, "anonymous")
   end
 
+  def test_D_get_by_object_id
+    parent = @qmfc.object(:class => "parent")
+    assert(parent, "Number of parent objects")
+
+    list = @qmfc.objects(:object_id => parent.object_id)
+    assert_equal(list.size, 1)
+
+    bad_oid = Qmf::ObjectId.new
+    list = @qmfc.objects(:object_id => bad_oid)
+    assert_equal(list.size, 0)
+
+    # TODO: test a bad_oid that has an agent-bank that is not associated with an attached
agent.
+    
+  end
+
 end
 
 app = ConsoleTest.new

Modified: qpid/trunk/qpid/cpp/src/qmf.mk
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf.mk?rev=825672&r1=825671&r2=825672&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf.mk (original)
+++ qpid/trunk/qpid/cpp/src/qmf.mk Thu Oct 15 21:38:07 2009
@@ -106,7 +106,7 @@
 QMF_AGE      = 0
 
 QMF_ENGINE_CURRENT  = 1
-QMF_ENGINE_REVISION = 0
+QMF_ENGINE_REVISION = 1
 QMF_ENGINE_AGE      = 0
 
 libqmf_la_LDFLAGS = -version-info $(QMF_CURRENT):$(QMF_REVISION):$(QMF_AGE)

Modified: qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.cpp?rev=825672&r1=825671&r2=825672&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.cpp Thu Oct 15 21:38:07 2009
@@ -206,19 +206,31 @@
 {
     SequenceContext::Ptr queryContext(new QueryContext(*this, context));
     Mutex::ScopedLock _lock(lock);
+    bool sent = false;
     if (agent != 0) {
-        sendGetRequestLH(queryContext, query, agent);
+        if (sendGetRequestLH(queryContext, query, agent))
+            sent = true;
     } else {
         // TODO (optimization) only send queries to agents that have the requested class+package
         for (map<uint32_t, AgentProxyPtr>::const_iterator iter = agentList.begin();
              iter != agentList.end(); iter++) {
-            sendGetRequestLH(queryContext, query, iter->second.get());
+            if (sendGetRequestLH(queryContext, query, iter->second.get()))
+                sent = true;
         }
     }
+
+    if (!sent) {
+        queryContext->reserve();
+        queryContext->release();
+    }
 }
 
-void BrokerProxyImpl::sendGetRequestLH(SequenceContext::Ptr queryContext, const Query&
query, const AgentProxy* agent)
+bool BrokerProxyImpl::sendGetRequestLH(SequenceContext::Ptr queryContext, const Query&
query, const AgentProxy* agent)
 {
+    if (query.impl->singleAgent()) {
+        if (query.impl->agentBank() != agent->getAgentBank())
+            return false;
+    }
     stringstream key;
     Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
     uint32_t sequence(seqMgr.reserve(queryContext));
@@ -229,6 +241,7 @@
     key << "agent.1." << agent->impl->agentBank;
     sendBufferLH(outBuffer, QMF_EXCHANGE, key.str());
     QPID_LOG(trace, "SENT GetQuery seq=" << sequence << " key=" << key.str());
+    return true;
 }
 
 string BrokerProxyImpl::encodeMethodArguments(const SchemaMethod* schema, const Value* argmap,
Buffer& buffer)

Modified: qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.h?rev=825672&r1=825671&r2=825672&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/engine/BrokerProxyImpl.h Thu Oct 15 21:38:07 2009
@@ -139,7 +139,7 @@
         uint32_t agentCount() const;
         const AgentProxy* getAgent(uint32_t idx) const;
         void sendQuery(const Query& query, void* context, const AgentProxy* agent);
-        void sendGetRequestLH(SequenceContext::Ptr queryContext, const Query& query,
const AgentProxy* agent);
+        bool sendGetRequestLH(SequenceContext::Ptr queryContext, const Query& query,
const AgentProxy* agent);
         std::string encodeMethodArguments(const SchemaMethod* schema, const Value* args,
qpid::framing::Buffer& buffer);
         void sendMethodRequest(ObjectId* oid, const SchemaObjectClass* cls, const std::string&
method, const Value* args, void* context);
 

Modified: qpid/trunk/qpid/cpp/src/qmf/engine/QueryImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/engine/QueryImpl.h?rev=825672&r1=825671&r2=825672&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/engine/QueryImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/engine/QueryImpl.h Thu Oct 15 21:38:07 2009
@@ -85,6 +85,8 @@
         bool getDecreasing() const { return orderDecreasing; }
 
         void encode(qpid::framing::Buffer& buffer) const;
+        bool singleAgent() const { return oid.get() != 0; }
+        uint32_t agentBank() const { return singleAgent() ? oid->getAgentBank() : 0; }
 
         std::string packageName;
         std::string className;



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


Mime
View raw message