summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-21 16:41:44 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-21 16:41:44 +0000
commitea4e48e4833fbb8eb2b52f3f9263a989b87a0a1f (patch)
tree448b2d9d3741bd521efefc4213b22b6a76079962 /lib/custodian/protocoltest
parentc58e75f7641865a60152d2c44588a3cffb678cb0 (diff)
Added stub for class-factory + test objects.
Diffstat (limited to 'lib/custodian/protocoltest')
-rw-r--r--lib/custodian/protocoltest/tcp.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb
new file mode 100644
index 0000000..fef6dea
--- /dev/null
+++ b/lib/custodian/protocoltest/tcp.rb
@@ -0,0 +1,54 @@
+#
+# The TCP-protocol test.
+#
+# This object is instantiated if the parser sees a line such as:
+#
+###
+### foo.vm.bytemark.co.uk must run tcp on 22 with banner 'ssh' otherwise 'ssh fail'.
+###
+#
+# The specification of the port is mandatory, the banner is optional.
+#
+class TCPTest < ProtocolTest
+
+
+ #
+ # Constructor
+ #
+ # Ensure we received a port to run the TCP-test against.
+ #
+ def initialize( line )
+ raise ArgumentError, "Missing port" unless ( line =~ /on\s+([0-9]+)/ );
+ @error = nil
+ end
+
+
+ #
+ # Helper for development.
+ #
+ def display
+ puts "I'm a TCP-test!"
+ end
+
+
+ #
+ # Run the TCP-protocol test.
+ #
+ def run_test
+
+ # reset the error, in case we were previously executed.
+ @error = nil
+
+ end
+
+
+ #
+ # If the test fails then report the error.
+ #
+ def error
+ @error
+ end
+
+ register_test_type "tcp"
+
+end