summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-02-23 16:20:39 +0000
committerChristoph Helma <helma@in-silico.ch>2012-02-23 16:20:39 +0000
commitb651c4d199a7b4d6a06cdefb281601bddd2fc885 (patch)
tree52e4ec4bfb303472ef74713f828a3146869bd2e5 /test
parentb6134b992fde8784c3556fbca32925e721700d32 (diff)
integrated features and tests from feature/typhoeus, tests pass reliably (as opposed to feature/typhoeus)
Diffstat (limited to 'test')
-rw-r--r--test/task.rb27
1 files changed, 20 insertions, 7 deletions
diff --git a/test/task.rb b/test/task.rb
index b217ec2..56b21cf 100644
--- a/test/task.rb
+++ b/test/task.rb
@@ -11,9 +11,11 @@ class TaskTest < Test::Unit::TestCase
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]
+ all = OpenTox::Task.all(TASK_SERVICE_URI)
+ assert_equal Array, all.class
+ t = all.last
+ assert_equal OpenTox::Task, t.class
+ assert_equal RDF::OT1.Task, t.metadata[RDF.type]
end
def test_create_and_complete
@@ -21,16 +23,23 @@ class TaskTest < Test::Unit::TestCase
sleep 1
TASK_SERVICE_URI
end
+ assert task.running?
assert_equal "Running", task.hasStatus
task.wait_for_completion
+ assert task.completed?
assert_equal "Completed", task.hasStatus
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)
+
+ def test_create_and_cancel
+ task = OpenTox::Task.create TASK_SERVICE_URI do
+ sleep 2
+ TASK_SERVICE_URI
+ end
+ assert task.running?
+ task.cancel
+ assert task.cancelled?
end
def test_create_and_fail
@@ -38,8 +47,10 @@ class TaskTest < Test::Unit::TestCase
sleep 1
raise "an error occured"
end
+ assert task.running?
assert_equal "Running", task.hasStatus
task.wait_for_completion
+ assert task.error?
assert_equal "Error", task.hasStatus
end
@@ -48,8 +59,10 @@ class TaskTest < Test::Unit::TestCase
sleep 1
"Asasadasd"
end
+ assert task.running?
assert_equal "Running", task.hasStatus
task.wait_for_completion
+ assert task.error?
assert_equal "Error", task.hasStatus
end