diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-11-19 17:31:27 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-11-19 17:31:27 +0100 |
commit | 2824a2fdb2aa308ad77ead17ee6c7cba9c69ab46 (patch) | |
tree | 807aa180a7edd24c044bb8f651adeb72e8e37d13 /validate-owl.rb | |
parent | 533e1b918a80d23af78a886442d4c82d853f829f (diff) |
Initial sketch of unit tests, cucumber tests are obsolete
Diffstat (limited to 'validate-owl.rb')
-rw-r--r-- | validate-owl.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/validate-owl.rb b/validate-owl.rb new file mode 100644 index 0000000..569813f --- /dev/null +++ b/validate-owl.rb @@ -0,0 +1,23 @@ +#require 'nokogiri' + +def validate_owl(uri) + if validator_available? + owl = OpenTox::RestClientWrapper.get(uri,:accept => "application/rdf+xml") + html = OpenTox::RestClientWrapper.post("http://www.mygrid.org.uk/OWL/Validator",{:rdf => owl, :level => "DL"}) + assert_match(/YES/,html) + else + puts "http://www.mygrid.org.uk/OWL/Validator offline" + end +end + +def validator_available? + uri = URI.parse "http://www.mygrid.org.uk/OWL/Validator" + Net::HTTP.start(uri.host, uri.port) do |http| + begin + http.read_timeout = 5 + http.head(uri.path).code == '200' + rescue Timeout::Error + false + end + end +end |