summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-21 23:15:44 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-21 23:15:44 +0000
commit7d153d8f22fc767108103cd8fdfc056e2656b914 (patch)
treef56a9b3b97fb623d836d70363f84f913f1584011 /lib/custodian/protocoltest
parent1e03e807d496d2c3cf92ff3429fe8d95427eb64c (diff)
Added .to_json method to serialize our tests.
Diffstat (limited to 'lib/custodian/protocoltest')
-rw-r--r--lib/custodian/protocoltest/ftp.rb14
-rw-r--r--lib/custodian/protocoltest/jabber.rb15
-rw-r--r--lib/custodian/protocoltest/rsync.rb15
-rw-r--r--lib/custodian/protocoltest/smtp.rb15
-rw-r--r--lib/custodian/protocoltest/ssh.rb16
-rw-r--r--lib/custodian/protocoltest/tcp.rb16
6 files changed, 91 insertions, 0 deletions
diff --git a/lib/custodian/protocoltest/ftp.rb b/lib/custodian/protocoltest/ftp.rb
index 8894de0..1d60e43 100644
--- a/lib/custodian/protocoltest/ftp.rb
+++ b/lib/custodian/protocoltest/ftp.rb
@@ -59,6 +59,20 @@ class FTPTest < TCPTest
#
+ # Convert this class to JSON such that it may be serialized.
+ #
+ def to_json
+ hash = {
+ :test_type => 'ftp',
+ :test_target => @host,
+ :test_port => @port,
+ }
+ hash.to_json
+ end
+
+
+
+
# Run the TCP-protocol test.
#
def run_test
diff --git a/lib/custodian/protocoltest/jabber.rb b/lib/custodian/protocoltest/jabber.rb
index a9920f0..1aef8b5 100644
--- a/lib/custodian/protocoltest/jabber.rb
+++ b/lib/custodian/protocoltest/jabber.rb
@@ -58,6 +58,21 @@ class JABBERTest < TCPTest
#
+ # Convert this class to JSON such that it may be serialized.
+ #
+ def to_json
+ hash = {
+ :test_type => 'jabber',
+ :test_target => @host,
+ :test_port => @port,
+ }
+ hash.to_json
+ end
+
+
+
+
+ #
# Run the TCP-protocol test.
#
def run_test
diff --git a/lib/custodian/protocoltest/rsync.rb b/lib/custodian/protocoltest/rsync.rb
index 3b63465..c35758e 100644
--- a/lib/custodian/protocoltest/rsync.rb
+++ b/lib/custodian/protocoltest/rsync.rb
@@ -59,6 +59,21 @@ class RSYNCTest < TCPTest
#
+ # Convert this class to JSON such that it may be serialized.
+ #
+ def to_json
+ hash = {
+ :test_type => 'rsync',
+ :test_target => @host,
+ :test_port => @port,
+ }
+ hash.to_json
+ end
+
+
+
+
+ #
# Run the protocol test.
#
def run_test
diff --git a/lib/custodian/protocoltest/smtp.rb b/lib/custodian/protocoltest/smtp.rb
index 3a38f5a..dce5ddf 100644
--- a/lib/custodian/protocoltest/smtp.rb
+++ b/lib/custodian/protocoltest/smtp.rb
@@ -59,6 +59,21 @@ class SMTPTest < TCPTest
#
+ # Convert this class to JSON such that it may be serialized.
+ #
+ def to_json
+ hash = {
+ :test_type => 'smtp',
+ :test_target => @host,
+ :test_port => @port,
+ }
+ hash.to_json
+ end
+
+
+
+
+ #
# Run the TCP-protocol test.
#
def run_test
diff --git a/lib/custodian/protocoltest/ssh.rb b/lib/custodian/protocoltest/ssh.rb
index ec7752f..18f13bc 100644
--- a/lib/custodian/protocoltest/ssh.rb
+++ b/lib/custodian/protocoltest/ssh.rb
@@ -60,6 +60,22 @@ class SSHTest < TCPTest
#
+ # Convert this class to JSON such that it may be
+ # serialized.
+ #
+ def to_json
+ hash = {
+ :test_type => 'ssh',
+ :test_target => @host,
+ :test_port => @port
+ }
+ hash.to_json
+ end
+
+
+
+
+ #
# Run the TCP-protocol test.
#
def run_test
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb
index 9e141fe..5f29b7f 100644
--- a/lib/custodian/protocoltest/tcp.rb
+++ b/lib/custodian/protocoltest/tcp.rb
@@ -87,6 +87,22 @@ class TCPTest < ProtocolTest
#
+ # Convert this class to JSON such that it may be serialized.
+ #
+ def to_json
+ hash = {
+ :test_type => 'tcp',
+ :test_target => @host,
+ :test_port => @port,
+ :banner => @banner
+ }
+ hash.to_json
+ end
+
+
+
+
+ #
# Run the TCP-protocol test.
#
def run_test