From c8a83f56380d8077ddcdc366ff86d5739130f9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Font=C3=A1n=20Mui=C3=B1os?= Date: Mon, 9 Feb 2009 22:52:20 +0000 Subject: [PATCH] Added a test mad for the new libraries git-svn-id: http://svn.opennebula.org/one/trunk@346 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/mad/ruby/test_mad.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/mad/ruby/test_mad.rb diff --git a/src/mad/ruby/test_mad.rb b/src/mad/ruby/test_mad.rb new file mode 100644 index 0000000000..29eda4283d --- /dev/null +++ b/src/mad/ruby/test_mad.rb @@ -0,0 +1,39 @@ + +require 'OpenNebulaDriver' +require 'CommandManager' + +class TestDriver < OpenNebulaDriver + def initialize(num) + super(num, true) + + register_action(:SLEEP_LOCAL,method("my_sleep_ssh")) + register_action(:SLEEP_SSH,method("my_sleep_ssh")) + + end + + def my_sleep_local(timeout, num) + log(num,"Sleeping #{timeout} seconds") + + command=LocalCommand.new("sleep #{timeout}", log_method(num)) + command.run + + log(num,"Done with #{num}") + + send_message("SLEEP",RESULT[:success],num.to_s) + end + + def my_sleep_ssh(host, timeout, num) + log(num,"Sleeping #{timeout} seconds (remote)") + + command=SSHCommand.new("sleep #{timeout}", host, log_method(num)) + command.run + + log(num,"Done with #{num}") + + send_message("SLEEP",RESULT[:success],num.to_s) + end +end + + +sd = TestDriver.new(15) +sd.start_driver