summaryrefslogtreecommitdiff
path: root/bin/custodian-parse-execute
blob: 2a756292540d225dc1bef549b2f0cf39f0b5862e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/ruby -Ilib/ -I../lib
#
#  This is simple test code which will parse a line from the configuration
# file and execute it via our class-factory
#
#
#  Simple test code.  Will be folded into the test-suite.
#
#

require 'custodian/protocoltest/tcp.rb'
require 'custodian/protocoltest/dns.rb'
require 'custodian/protocoltest/ftp.rb'
require 'custodian/protocoltest/http.rb'
require 'custodian/protocoltest/jabber.rb'
require 'custodian/protocoltest/ldap.rb'
require 'custodian/protocoltest/ping.rb'
require 'custodian/protocoltest/rsync.rb'
require 'custodian/protocoltest/ssh.rb'
require 'custodian/protocoltest/smtp.rb'




#
# The line is in the first agument
#
txt = ARGV.shift


if ( txt.nil? )
  puts "#{$0} 'foo must run service ..'"
  exit 1
end



#
# Create the object
#
begin
  c = Custodian::TestFactory.create( txt )

  puts "created object of class type #{c.class}"
  puts ".to_s    : #{c.to_s}"
  puts ".to_json : #{c.to_json}"

  if ( c.run_test )
    puts "Test succeeded"
  else
    puts "Test failed: #{c.error()}"
  end
rescue => ex
  puts "Exception: #{ex}"
end