From 9fe1f6870cfd12c34eb4efef8f4e199e8324c1af Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Sun, 19 Feb 2012 16:03:10 +0000 Subject: task handling fixed for http codes > 202 --- test/task.rb | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'test') 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 -- cgit v1.2.3