summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-02-19 16:03:10 +0000
committerChristoph Helma <helma@in-silico.ch>2012-02-19 16:03:10 +0000
commit9fe1f6870cfd12c34eb4efef8f4e199e8324c1af (patch)
treed90a822695d9bde85ae5cc71fa8283c8b891865d /test
parent0600fdc62e7446caa75ffcff4d097338818e0df9 (diff)
task handling fixed for http codes > 202
Diffstat (limited to 'test')
-rw-r--r--test/task.rb38
1 files changed, 30 insertions, 8 deletions
diff --git a/test/task.rb b/test/task.rb
index 41316d1..b217ec2 100644
--- a/test/task.rb
+++ b/test/task.rb
@@ -3,32 +3,54 @@ $LOAD_PATH << File.join(File.dirname(__FILE__),'..','lib')
require File.join File.dirname(__FILE__),'..','lib','opentox-client.rb'
#require "./validate-owl.rb"
-TASK_SERVICE_URI = "http://ot-dev.in-silico.ch/task"
+#TASK_SERVICE_URI = "http://ot-dev.in-silico.ch/task"
+TASK_SERVICE_URI = "http://ot-test.in-silico.ch/task"
+#TASK_SERVICE_URI = "https://ambit.uni-plovdiv.bg:8443/ambit2/task" #not compatible
class TaskTest < Test::Unit::TestCase
- def setup
- end
- def teardown
+ def test_all
+ t = OpenTox::Task.all(TASK_SERVICE_URI)
+ assert_equal Array, t.class
+ assert_equal RDF::OT1.Task, t.last.metadata[RDF.type]
end
def test_create_and_complete
- task = OpenTox::Task.create TASK_SERVICE_URI do
+ task = OpenTox::Task.create TASK_SERVICE_URI, :description => "test" do
sleep 1
- "http://test.org"
+ TASK_SERVICE_URI
end
assert_equal "Running", task.hasStatus
task.wait_for_completion
assert_equal "Completed", task.hasStatus
- assert_equal "http://test.org", task.resultURI
+ assert_equal TASK_SERVICE_URI, task.resultURI
end
-
def test_rdf
task = OpenTox::Task.all(TASK_SERVICE_URI).last
assert_equal OpenTox::Task, task.class
#validate_owl(task.uri)
end
+ def test_create_and_fail
+ task = OpenTox::Task.create TASK_SERVICE_URI, :description => "test failure", :creator => "http://test.org/fake_creator" do
+ sleep 1
+ raise "an error occured"
+ end
+ assert_equal "Running", task.hasStatus
+ task.wait_for_completion
+ assert_equal "Error", task.hasStatus
+ end
+
+ def test_wrong_result_uri
+ task = OpenTox::Task.create TASK_SERVICE_URI, :description => "test wrong result uri", :creator => "http://test.org/fake_creator" do
+ sleep 1
+ "Asasadasd"
+ end
+ assert_equal "Running", task.hasStatus
+ task.wait_for_completion
+ assert_equal "Error", task.hasStatus
+ end
+
end