summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-22 00:28:26 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-22 00:28:26 +0000
commit6c7c58be7928be9a451fe11fc3a81d367b80c7b7 (patch)
tree69cf06f6433b19ca395a16bcbd43295dc9de0d42
parenta3ca08443ccfe8c325c45b849f85b96f3b931299 (diff)
Added stub code.
-rwxr-xr-xbin/custodian-parse-execute1
-rw-r--r--lib/custodian/protocoltest/http.rb99
2 files changed, 99 insertions, 1 deletions
diff --git a/bin/custodian-parse-execute b/bin/custodian-parse-execute
index c0057de..a58b15c 100755
--- a/bin/custodian-parse-execute
+++ b/bin/custodian-parse-execute
@@ -10,6 +10,7 @@
require 'custodian/protocoltest/tcp.rb'
require 'custodian/protocoltest/ftp.rb'
+require 'custodian/protocoltest/http.rb'
require 'custodian/protocoltest/jabber.rb'
require 'custodian/protocoltest/ldap.rb'
require 'custodian/protocoltest/rsync.rb'
diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb
index 258cd57..75802d6 100644
--- a/lib/custodian/protocoltest/http.rb
+++ b/lib/custodian/protocoltest/http.rb
@@ -1 +1,98 @@
-todo
+
+#
+# The HTTP-protocol test.
+#
+# This object is instantiated if the parser sees a line such as:
+#
+###
+### http://foo.vm.bytemark.co.uk/ must run http with content 'foo' otherwise 'ftp fail'.
+###
+#
+#
+class HTTPTest < TCPTest
+
+
+ #
+ # The line from which we were constructed.
+ #
+ attr_reader :line
+
+
+ #
+ # The URL to poll
+ #
+ attr_reader :url
+
+ #
+ # Constructor
+ #
+ def initialize( line )
+
+ #
+ # Save the line
+ #
+ @line = line
+
+ #
+ # Save the URL
+ #
+ @url = line.split( /\s+/)[0]
+
+
+ if ( @url !~ /^https?:/ )
+ raise ArgumentError, "The target wasn't an URL"
+ end
+
+ end
+
+
+
+
+ #
+ # Helper for development.
+ #
+ def to_s
+ "http-test of #{@url}."
+ end
+
+
+
+
+ #
+ # Convert this class to JSON such that it may be serialized.
+ #
+ def to_json
+ hash = { :line => @line }
+ hash.to_json
+ end
+
+
+
+ #
+ # Run the test.
+ #
+ def run_test
+ @error = "Not implemented"
+ false
+ end
+
+
+
+
+ #
+ # If the test fails then report the error.
+ #
+ def error
+ @error
+ end
+
+
+
+
+ register_test_type "http"
+ register_test_type "https"
+
+
+
+
+end