diff options
author | mguetlein <martin.guetlein@gmail.com> | 2010-09-07 10:23:16 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2010-09-07 10:23:16 +0200 |
commit | fd1258afd54660cffe4c45472f9c856c68d30e61 (patch) | |
tree | 0e091a62d5a86096bed0c16c4b3160fd455d9260 | |
parent | 9fac92f0165d7e0a13b5680c92c5c26521beec65 (diff) |
fix examples
-rw-r--r-- | application.rb | 7 | ||||
-rw-r--r-- | example.rb | 15 | ||||
-rw-r--r-- | validation/validation_test.rb | 11 |
3 files changed, 23 insertions, 10 deletions
diff --git a/application.rb b/application.rb index b70d023..5e875c1 100644 --- a/application.rb +++ b/application.rb @@ -23,10 +23,11 @@ get '/prepare_examples/?' do Example.prepare_example_resources end -get '/test_examples/?' do - LOGGER.info "test examples" +post '/test_examples/?' do + examples = params[:examples] + LOGGER.info "test examples "+examples.to_s content_type "text/plain" - Example.test_examples + Example.test_examples(examples) end require "test/test_application.rb" @@ -100,8 +100,15 @@ class Example end # performs all curl calls listed in examples after ">>>", next line is added if line ends with "\" - def self.test_examples - lines = transform_example.split("\n") + def self.test_examples(example_uri=nil) + + if (example_uri) + examples = OpenTox::RestClientWrapper.get(example_uri) + else + examples = transform_example # use local examples + end + + lines = examples.split("\n") curl_call = false curl_calls = [] @@ -136,7 +143,7 @@ class Example result = "" IO.popen(cmd.to_s+" 2> /dev/null") do |f| while line = f.gets - result += line + result += line if result.size<50 end end result.gsub!(/\n/, " \\n ") @@ -151,7 +158,7 @@ class Example log "failed ( " +result.to_s[0,50]+" )" end end - log num.to_s+"/"+num.to_s+" curls succeeded" + log suc.to_s+"/"+num.to_s+" curls succeeded" @@summary end "testing in background, check log for results" diff --git a/validation/validation_test.rb b/validation/validation_test.rb index 9b5a11f..1265bdc 100644 --- a/validation/validation_test.rb +++ b/validation/validation_test.rb @@ -86,8 +86,9 @@ class ValidationTest < Test::Unit::TestCase #puts Nightly.build_nightly("1") - #prepare_examples - do_test_examples # USES CURL, DO NOT FORGET TO RESTART VALIDATION SERVICE + #prepare_examples + #do_test_examples # USES CURL, DO NOT FORGET TO RESTART VALIDATION SERVICE + do_test_examples_ortona end def app @@ -122,7 +123,11 @@ class ValidationTest < Test::Unit::TestCase end def do_test_examples # USES CURL, DO NOT FORGET TO RESTART - get '/test_examples' + post '/test_examples' + end + + def do_test_examples_ortona + post '/test_examples',:examples=>"http://ortona.informatik.uni-freiburg.de/validation/examples" end end |