diff options
| author | Ted Ross <tross@apache.org> | 2009-10-02 17:45:58 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-10-02 17:45:58 +0000 |
| commit | ee477a65e6ac9532a27cdf589df6d9aba7d97796 (patch) | |
| tree | 7699a50a7a5bc3fdf2a3550cb288837a92dd0fba /cpp/bindings | |
| parent | cc6ec1079431b7eb45031d36f5a6ad5e9a6675ac (diff) | |
| download | qpid-python-ee477a65e6ac9532a27cdf589df6d9aba7d97796.tar.gz | |
QMF Fixes:
- In ruby: waitForStable => wait_for_stable
- Setting an unknown attribute on connection settings now throws an exception
- Added connected? accessor to Connection
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@821109 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings')
| -rw-r--r-- | cpp/bindings/qmf/ruby/qmf.rb | 17 | ||||
| -rwxr-xr-x | cpp/bindings/qmf/tests/ruby_console.rb | 2 | ||||
| -rwxr-xr-x | cpp/bindings/qmf/tests/ruby_console_test.rb | 10 | ||||
| -rw-r--r-- | cpp/bindings/qmf/tests/test_base.rb | 2 |
4 files changed, 23 insertions, 8 deletions
diff --git a/cpp/bindings/qmf/ruby/qmf.rb b/cpp/bindings/qmf/ruby/qmf.rb index 548b50874c..f79fb5ed88 100644 --- a/cpp/bindings/qmf/ruby/qmf.rb +++ b/cpp/bindings/qmf/ruby/qmf.rb @@ -60,7 +60,8 @@ module Qmf raise ArgumentError, "Value for attribute '#{key}' has unsupported type: #{val.class}" end - @impl.setAttr(key, v) + good = @impl.setAttr(key, v) + raise "Invalid attribute '#{key}'" unless good end def method_missing(name_in, *args) @@ -96,12 +97,17 @@ module Qmf @new_conn_handlers = [] @conn_handlers_to_delete = [] @conn_handlers = [] + @connected = nil @thread = Thread.new do run end end + def connected? + @connected + end + def kick @sockEngine.write(".") @sockEngine.flush @@ -123,7 +129,6 @@ module Qmf def run() eventImpl = Qmfengine::ResilientConnectionEvent.new - connected = nil new_handlers = nil del_handlers = nil bt_count = 0 @@ -140,7 +145,7 @@ module Qmf new_handlers.each do |nh| @conn_handlers << nh - nh.conn_event_connected() if connected + nh.conn_event_connected() if @connected end new_handlers = nil @@ -154,10 +159,10 @@ module Qmf begin case eventImpl.kind when Qmfengine::ResilientConnectionEvent::CONNECTED - connected = :true + @connected = :true @conn_handlers.each { |h| h.conn_event_connected() } when Qmfengine::ResilientConnectionEvent::DISCONNECTED - connected = nil + @connected = nil @conn_handlers.each { |h| h.conn_event_disconnected(eventImpl.errorText) } when Qmfengine::ResilientConnectionEvent::SESSION_CLOSED eventImpl.sessionContext.handler.sess_event_session_closed(eventImpl.sessionContext, eventImpl.errorText) @@ -1049,7 +1054,7 @@ module Qmf @operational = :false end - def waitForStable(timeout = nil) + def wait_for_stable(timeout = nil) synchronize do return if @stable if timeout diff --git a/cpp/bindings/qmf/tests/ruby_console.rb b/cpp/bindings/qmf/tests/ruby_console.rb index b53cf57b1f..f4420c9fc6 100755 --- a/cpp/bindings/qmf/tests/ruby_console.rb +++ b/cpp/bindings/qmf/tests/ruby_console.rb @@ -110,7 +110,7 @@ class App < Qmf::ConsoleHandler @qmfc = Qmf::Console.new(self) @broker = @qmfc.add_connection(@connection) - @broker.waitForStable + @broker.wait_for_stable ##dump_schema diff --git a/cpp/bindings/qmf/tests/ruby_console_test.rb b/cpp/bindings/qmf/tests/ruby_console_test.rb index 9a33b5cdc6..b72c8e3806 100755 --- a/cpp/bindings/qmf/tests/ruby_console_test.rb +++ b/cpp/bindings/qmf/tests/ruby_console_test.rb @@ -24,6 +24,8 @@ require 'test_base' class ConsoleTest < ConsoleTestBase def test_A_agent_presence + assert(@connection.connected?, "Connection not connected") + agents = [] count = 0 while agents.size == 0 @@ -37,6 +39,14 @@ class ConsoleTest < ConsoleTestBase assert_equal(agentList.size, 2, "Number of agents reported by Console") end + def test_A_connection_settings + begin + @settings.bogusAttribute = 25 + fail("Connection settings accepted bogus attribute") + rescue + end + end + def test_B_basic_method_invocation parent = @qmfc.object(:class => "parent") assert(parent, "Number of 'parent' objects") diff --git a/cpp/bindings/qmf/tests/test_base.rb b/cpp/bindings/qmf/tests/test_base.rb index 947753b02a..cb7fd9d4f9 100644 --- a/cpp/bindings/qmf/tests/test_base.rb +++ b/cpp/bindings/qmf/tests/test_base.rb @@ -31,7 +31,7 @@ class ConsoleTestBase < Qmf::ConsoleHandler @qmfc = Qmf::Console.new @broker = @qmfc.add_connection(@connection) - @broker.waitForStable + @broker.wait_for_stable tests = [] methods.each do |m| |
