roby 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. data/History.txt +7 -5
  2. data/Manifest.txt +91 -16
  3. data/README.txt +24 -24
  4. data/Rakefile +92 -64
  5. data/app/config/app.yml +42 -43
  6. data/app/config/init.rb +26 -0
  7. data/benchmark/alloc_misc.rb +123 -0
  8. data/benchmark/discovery_latency.rb +67 -0
  9. data/benchmark/garbage_collection.rb +48 -0
  10. data/benchmark/genom.rb +31 -0
  11. data/benchmark/transactions.rb +62 -0
  12. data/bin/roby +1 -1
  13. data/bin/roby-log +16 -6
  14. data/doc/guide/.gitignore +2 -0
  15. data/doc/guide/config.yaml +34 -0
  16. data/doc/guide/ext/init.rb +14 -0
  17. data/doc/guide/ext/previous_next.rb +40 -0
  18. data/doc/guide/ext/rdoc_links.rb +33 -0
  19. data/doc/guide/index.rdoc +16 -0
  20. data/doc/guide/overview.rdoc +62 -0
  21. data/doc/guide/plan_modifications.rdoc +67 -0
  22. data/doc/guide/src/abstraction/achieve_with.page +8 -0
  23. data/doc/guide/src/abstraction/forwarding.page +8 -0
  24. data/doc/guide/src/abstraction/hierarchy.page +19 -0
  25. data/doc/guide/src/abstraction/index.page +28 -0
  26. data/doc/guide/src/abstraction/task_models.page +13 -0
  27. data/doc/guide/src/basics.template +6 -0
  28. data/doc/guide/src/basics/app.page +139 -0
  29. data/doc/guide/src/basics/code_examples.page +33 -0
  30. data/doc/guide/src/basics/dry.page +69 -0
  31. data/doc/guide/src/basics/errors.page +443 -0
  32. data/doc/guide/src/basics/events.page +179 -0
  33. data/doc/guide/src/basics/hierarchy.page +275 -0
  34. data/doc/guide/src/basics/index.page +11 -0
  35. data/doc/guide/src/basics/log_replay/goForward_1.png +0 -0
  36. data/doc/guide/src/basics/log_replay/goForward_2.png +0 -0
  37. data/doc/guide/src/basics/log_replay/goForward_3.png +0 -0
  38. data/doc/guide/src/basics/log_replay/goForward_4.png +0 -0
  39. data/doc/guide/src/basics/log_replay/goForward_5.png +0 -0
  40. data/doc/guide/src/basics/log_replay/hierarchy_error_1.png +0 -0
  41. data/doc/guide/src/basics/log_replay/hierarchy_error_2.png +0 -0
  42. data/doc/guide/src/basics/log_replay/hierarchy_error_3.png +0 -0
  43. data/doc/guide/src/basics/log_replay/plan_repair_1.png +0 -0
  44. data/doc/guide/src/basics/log_replay/plan_repair_2.png +0 -0
  45. data/doc/guide/src/basics/log_replay/plan_repair_3.png +0 -0
  46. data/doc/guide/src/basics/log_replay/plan_repair_4.png +0 -0
  47. data/doc/guide/src/basics/log_replay/roby_log_main_window.png +0 -0
  48. data/doc/guide/src/basics/log_replay/roby_log_relation_window.png +0 -0
  49. data/doc/guide/src/basics/log_replay/roby_replay_event_representation.png +0 -0
  50. data/doc/guide/src/basics/plan_objects.page +71 -0
  51. data/doc/guide/src/basics/relations_display.page +203 -0
  52. data/doc/guide/src/basics/roby_cycle_overview.png +0 -0
  53. data/doc/guide/src/basics/shell.page +102 -0
  54. data/doc/guide/src/basics/summary.page +32 -0
  55. data/doc/guide/src/basics/tasks.page +357 -0
  56. data/doc/guide/src/basics_shell_header.txt +16 -0
  57. data/doc/guide/src/cycle/cycle-overview.png +0 -0
  58. data/doc/guide/src/cycle/cycle-overview.svg +208 -0
  59. data/doc/guide/src/cycle/error_handling.page +168 -0
  60. data/doc/guide/src/cycle/error_instantaneous_repair.png +0 -0
  61. data/doc/guide/src/cycle/error_instantaneous_repair.svg +1224 -0
  62. data/doc/guide/src/cycle/garbage_collection.page +10 -0
  63. data/doc/guide/src/cycle/index.page +23 -0
  64. data/doc/guide/src/cycle/propagation.page +154 -0
  65. data/doc/guide/src/cycle/propagation_diamond.png +0 -0
  66. data/doc/guide/src/cycle/propagation_diamond.svg +1279 -0
  67. data/doc/guide/src/default.css +319 -0
  68. data/doc/guide/src/default.template +74 -0
  69. data/doc/guide/src/htmldoc.metainfo +20 -0
  70. data/doc/guide/src/htmldoc.virtual +18 -0
  71. data/doc/guide/src/images/bodybg.png +0 -0
  72. data/doc/guide/src/images/contbg.png +0 -0
  73. data/doc/guide/src/images/footerbg.png +0 -0
  74. data/doc/guide/src/images/gradient1.png +0 -0
  75. data/doc/guide/src/images/gradient2.png +0 -0
  76. data/doc/guide/src/index.page +7 -0
  77. data/doc/guide/src/introduction/index.page +29 -0
  78. data/doc/guide/src/introduction/install.page +133 -0
  79. data/doc/{papers.rdoc → guide/src/introduction/publications.page} +5 -2
  80. data/doc/{videos.rdoc → guide/src/introduction/videos.page} +4 -2
  81. data/doc/guide/src/plugins/fault_tolerance.page +44 -0
  82. data/doc/guide/src/plugins/index.page +11 -0
  83. data/doc/guide/src/plugins/subsystems.page +45 -0
  84. data/doc/guide/src/relations/dependency.page +89 -0
  85. data/doc/guide/src/relations/index.page +12 -0
  86. data/doc/misc/update_github +24 -0
  87. data/doc/tutorials/02-GoForward.rdoc +3 -3
  88. data/ext/graph/graph.cc +46 -0
  89. data/lib/roby.rb +57 -22
  90. data/lib/roby/app.rb +132 -112
  91. data/lib/roby/app/plugins/rake.rb +21 -0
  92. data/lib/roby/app/rake.rb +0 -7
  93. data/lib/roby/app/run.rb +1 -1
  94. data/lib/roby/app/scripts/distributed.rb +1 -2
  95. data/lib/roby/app/scripts/generate/bookmarks.rb +1 -1
  96. data/lib/roby/app/scripts/results.rb +2 -1
  97. data/lib/roby/app/scripts/run.rb +6 -2
  98. data/lib/roby/app/scripts/shell.rb +11 -11
  99. data/lib/roby/config.rb +1 -1
  100. data/lib/roby/decision_control.rb +62 -3
  101. data/lib/roby/distributed.rb +4 -0
  102. data/lib/roby/distributed/base.rb +8 -0
  103. data/lib/roby/distributed/communication.rb +12 -8
  104. data/lib/roby/distributed/connection_space.rb +61 -44
  105. data/lib/roby/distributed/distributed_object.rb +1 -1
  106. data/lib/roby/distributed/notifications.rb +22 -30
  107. data/lib/roby/distributed/peer.rb +13 -8
  108. data/lib/roby/distributed/proxy.rb +5 -5
  109. data/lib/roby/distributed/subscription.rb +4 -4
  110. data/lib/roby/distributed/transaction.rb +3 -3
  111. data/lib/roby/event.rb +176 -110
  112. data/lib/roby/exceptions.rb +12 -4
  113. data/lib/roby/execution_engine.rb +1604 -0
  114. data/lib/roby/external_process_task.rb +225 -0
  115. data/lib/roby/graph.rb +0 -6
  116. data/lib/roby/interface.rb +221 -137
  117. data/lib/roby/log/console.rb +5 -3
  118. data/lib/roby/log/data_stream.rb +94 -16
  119. data/lib/roby/log/dot.rb +8 -8
  120. data/lib/roby/log/event_stream.rb +13 -3
  121. data/lib/roby/log/file.rb +43 -18
  122. data/lib/roby/log/gui/basic_display_ui.rb +89 -0
  123. data/lib/roby/log/gui/chronicle_view_ui.rb +90 -0
  124. data/lib/roby/log/gui/data_displays.rb +4 -5
  125. data/lib/roby/log/gui/data_displays_ui.rb +146 -0
  126. data/lib/roby/log/gui/relations.rb +18 -18
  127. data/lib/roby/log/gui/relations_ui.rb +120 -0
  128. data/lib/roby/log/gui/relations_view_ui.rb +144 -0
  129. data/lib/roby/log/gui/replay.rb +41 -13
  130. data/lib/roby/log/gui/replay_controls.rb +3 -0
  131. data/lib/roby/log/gui/replay_controls.ui +133 -110
  132. data/lib/roby/log/gui/replay_controls_ui.rb +249 -0
  133. data/lib/roby/log/hooks.rb +19 -18
  134. data/lib/roby/log/logger.rb +7 -6
  135. data/lib/roby/log/notifications.rb +4 -4
  136. data/lib/roby/log/plan_rebuilder.rb +20 -22
  137. data/lib/roby/log/relations.rb +44 -16
  138. data/lib/roby/log/server.rb +1 -4
  139. data/lib/roby/log/timings.rb +88 -19
  140. data/lib/roby/plan-object.rb +135 -11
  141. data/lib/roby/plan.rb +408 -224
  142. data/lib/roby/planning/loops.rb +32 -25
  143. data/lib/roby/planning/model.rb +157 -51
  144. data/lib/roby/planning/task.rb +47 -20
  145. data/lib/roby/query.rb +128 -92
  146. data/lib/roby/relations.rb +254 -136
  147. data/lib/roby/relations/conflicts.rb +6 -9
  148. data/lib/roby/relations/dependency.rb +358 -0
  149. data/lib/roby/relations/ensured.rb +0 -1
  150. data/lib/roby/relations/error_handling.rb +0 -1
  151. data/lib/roby/relations/events.rb +0 -2
  152. data/lib/roby/relations/executed_by.rb +26 -11
  153. data/lib/roby/relations/planned_by.rb +14 -14
  154. data/lib/roby/robot.rb +46 -0
  155. data/lib/roby/schedulers/basic.rb +34 -0
  156. data/lib/roby/standalone.rb +4 -0
  157. data/lib/roby/standard_errors.rb +21 -15
  158. data/lib/roby/state/events.rb +5 -4
  159. data/lib/roby/support.rb +107 -6
  160. data/lib/roby/task-operations.rb +23 -19
  161. data/lib/roby/task.rb +522 -148
  162. data/lib/roby/task_index.rb +80 -0
  163. data/lib/roby/test/common.rb +283 -44
  164. data/lib/roby/test/distributed.rb +53 -37
  165. data/lib/roby/test/testcase.rb +9 -204
  166. data/lib/roby/test/tools.rb +3 -3
  167. data/lib/roby/transactions.rb +154 -111
  168. data/lib/roby/transactions/proxy.rb +40 -7
  169. data/manifest.xml +20 -0
  170. data/plugins/fault_injection/README.txt +0 -3
  171. data/plugins/fault_injection/Rakefile +2 -8
  172. data/plugins/fault_injection/app.rb +1 -1
  173. data/plugins/fault_injection/fault_injection.rb +3 -3
  174. data/plugins/fault_injection/test/test_fault_injection.rb +19 -25
  175. data/plugins/subsystems/README.txt +0 -3
  176. data/plugins/subsystems/Rakefile +2 -7
  177. data/plugins/subsystems/app.rb +27 -16
  178. data/plugins/subsystems/test/app/config/init.rb +3 -0
  179. data/plugins/subsystems/test/app/planners/main.rb +1 -1
  180. data/plugins/subsystems/test/app/tasks/services.rb +1 -1
  181. data/plugins/subsystems/test/test_subsystems.rb +23 -16
  182. data/test/distributed/test_communication.rb +32 -15
  183. data/test/distributed/test_connection.rb +28 -26
  184. data/test/distributed/test_execution.rb +59 -54
  185. data/test/distributed/test_mixed_plan.rb +34 -34
  186. data/test/distributed/test_plan_notifications.rb +26 -26
  187. data/test/distributed/test_protocol.rb +57 -48
  188. data/test/distributed/test_query.rb +11 -7
  189. data/test/distributed/test_remote_plan.rb +71 -71
  190. data/test/distributed/test_transaction.rb +50 -47
  191. data/test/mockups/external_process +28 -0
  192. data/test/planning/test_loops.rb +163 -119
  193. data/test/planning/test_model.rb +3 -3
  194. data/test/planning/test_task.rb +27 -7
  195. data/test/relations/test_conflicts.rb +3 -3
  196. data/test/relations/test_dependency.rb +324 -0
  197. data/test/relations/test_ensured.rb +2 -2
  198. data/test/relations/test_executed_by.rb +94 -19
  199. data/test/relations/test_planned_by.rb +11 -9
  200. data/test/suite_core.rb +6 -3
  201. data/test/suite_distributed.rb +1 -0
  202. data/test/suite_planning.rb +1 -0
  203. data/test/suite_relations.rb +2 -2
  204. data/test/tasks/test_external_process.rb +126 -0
  205. data/test/{test_thread_task.rb → tasks/test_thread_task.rb} +17 -20
  206. data/test/test_bgl.rb +21 -1
  207. data/test/test_event.rb +229 -155
  208. data/test/test_exceptions.rb +79 -80
  209. data/test/test_execution_engine.rb +987 -0
  210. data/test/test_gui.rb +1 -1
  211. data/test/test_interface.rb +11 -5
  212. data/test/test_log.rb +18 -7
  213. data/test/test_log_server.rb +1 -0
  214. data/test/test_plan.rb +229 -395
  215. data/test/test_query.rb +193 -35
  216. data/test/test_relations.rb +88 -8
  217. data/test/test_state.rb +55 -37
  218. data/test/test_support.rb +1 -1
  219. data/test/test_task.rb +371 -218
  220. data/test/test_testcase.rb +32 -16
  221. data/test/test_transactions.rb +211 -170
  222. data/test/test_transactions_proxy.rb +37 -19
  223. metadata +169 -71
  224. data/.gitignore +0 -29
  225. data/doc/styles/allison.css +0 -314
  226. data/doc/styles/allison.js +0 -316
  227. data/doc/styles/allison.rb +0 -276
  228. data/doc/styles/jamis.rb +0 -593
  229. data/lib/roby/control.rb +0 -746
  230. data/lib/roby/executives/simple.rb +0 -30
  231. data/lib/roby/propagation.rb +0 -562
  232. data/lib/roby/relations/hierarchy.rb +0 -239
  233. data/lib/roby/transactions/updates.rb +0 -139
  234. data/test/relations/test_hierarchy.rb +0 -158
  235. data/test/test_control.rb +0 -399
  236. data/test/test_propagation.rb +0 -210
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../..', File.dirname(__FILE__))
1
+ $LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
2
2
  require 'roby/test/distributed'
3
3
  require 'roby/test/tasks/simple_task'
4
4
  require 'flexmock'
@@ -16,7 +16,7 @@ class TC_DistributedQuery < Test::Unit::TestCase
16
16
  t1 = Class.new(Task).new
17
17
  t2 = Class.new(Task).new
18
18
  t2.owners << fake_peer
19
- plan.discover [t1, t2]
19
+ plan.add [t1, t2]
20
20
 
21
21
  assert_equal([t1].to_set, TaskMatcher.owned_by(Distributed).enum_for(:each, plan).to_set)
22
22
  assert_equal([t1].to_set, TaskMatcher.self_owned.enum_for(:each, plan).to_set)
@@ -26,7 +26,7 @@ class TC_DistributedQuery < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_marshal_query
29
- peer2peer(true) do |remote|
29
+ peer2peer do |remote|
30
30
  PeerServer.class_eval do
31
31
  def query
32
32
  plan.find_tasks
@@ -40,14 +40,18 @@ class TC_DistributedQuery < Test::Unit::TestCase
40
40
  assert_kind_of(Query, query)
41
41
  end
42
42
 
43
+ class QueryTaskModel < Roby::Task
44
+ argument :id
45
+ end
46
+
43
47
  # Check that we can query the remote plan database
44
48
  def test_query
45
- peer2peer(true) do |remote|
49
+ peer2peer do |remote|
46
50
  local_model = Class.new(SimpleTask)
47
51
 
48
- mission, subtask = Task.new(:id => 1), local_model.new(:id => 2)
49
- mission.realized_by subtask
50
- remote.plan.insert(mission)
52
+ mission, subtask = QueryTaskModel.new(:id => 1), local_model.new(:id => 2)
53
+ mission.depends_on subtask
54
+ remote.plan.add_mission(mission)
51
55
  end
52
56
 
53
57
  # Get the remote missions
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../..', File.dirname(__FILE__))
1
+ $LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
2
2
  require 'roby/test/distributed'
3
3
  require 'roby/test/tasks/simple_task'
4
4
 
@@ -66,10 +66,10 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
66
66
  end
67
67
 
68
68
  def test_remote_proxy_update
69
- peer2peer(true) do |remote|
70
- remote.plan.insert(SimpleTask.new(:id => 'simple_task'))
71
- remote.plan.permanent(SimpleTask.new(:id => 'task'))
72
- remote.plan.permanent(SimpleTask.new(:id => 'other_task'))
69
+ peer2peer do |remote|
70
+ remote.plan.add_mission(SimpleTask.new(:id => 'simple_task'))
71
+ remote.plan.add_permanent(SimpleTask.new(:id => 'task'))
72
+ remote.plan.add_permanent(SimpleTask.new(:id => 'other_task'))
73
73
  end
74
74
 
75
75
  r_simple_task = remote_task(:id => 'simple_task', :permanent => true)
@@ -81,28 +81,28 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
81
81
  Distributed.update(r_simple_task) do
82
82
  assert(r_simple_task.read_write?)
83
83
  assert_nothing_raised do
84
- r_simple_task.realized_by task
84
+ r_simple_task.depends_on task
85
85
  r_simple_task.remove_child task
86
- task.realized_by r_simple_task
86
+ task.depends_on r_simple_task
87
87
  task.remove_child r_simple_task
88
88
  end
89
89
  end
90
90
  assert(!r_simple_task.read_write?)
91
91
 
92
- assert_raises(OwnershipError) { r_simple_task.realized_by task }
93
- assert_raises(OwnershipError) { task.realized_by r_simple_task }
94
- Distributed.update(r_simple_task) { r_simple_task.realized_by task }
92
+ assert_raises(OwnershipError) { r_simple_task.depends_on task }
93
+ assert_raises(OwnershipError) { task.depends_on r_simple_task }
94
+ Distributed.update(r_simple_task) { r_simple_task.depends_on task }
95
95
  assert_nothing_raised { r_simple_task.remove_child task }
96
- Distributed.update(r_simple_task) { task.realized_by r_simple_task }
96
+ Distributed.update(r_simple_task) { task.depends_on r_simple_task }
97
97
  assert_nothing_raised { task.remove_child r_simple_task }
98
98
 
99
- assert_raises(OwnershipError) { r_simple_task.realized_by r_other_task }
100
- assert_raises(OwnershipError) { r_other_task.realized_by r_simple_task }
101
- Distributed.update_all([r_simple_task, r_other_task]) { r_simple_task.realized_by r_other_task }
99
+ assert_raises(OwnershipError) { r_simple_task.depends_on r_other_task }
100
+ assert_raises(OwnershipError) { r_other_task.depends_on r_simple_task }
101
+ Distributed.update_all([r_simple_task, r_other_task]) { r_simple_task.depends_on r_other_task }
102
102
  assert_raises(OwnershipError) { r_simple_task.remove_child r_other_task }
103
103
  Distributed.update_all([r_simple_task, r_other_task]) do
104
104
  r_simple_task.remove_child r_other_task
105
- r_other_task.realized_by r_simple_task
105
+ r_other_task.depends_on r_simple_task
106
106
  end
107
107
  assert_raises(OwnershipError) { r_other_task.remove_child r_simple_task }
108
108
 
@@ -117,16 +117,16 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
117
117
  # Test that the remote plan structure is properly mapped to the local
118
118
  # plan database
119
119
  def test_discover_neighborhood
120
- peer2peer(true) do |remote|
120
+ peer2peer do |remote|
121
121
  mission, subtask, next_mission =
122
122
  SimpleTask.new(:id => 'mission'),
123
123
  SimpleTask.new(:id => 'subtask'),
124
124
  SimpleTask.new(:id => 'next_mission')
125
- mission.realized_by subtask
126
- mission.on(:stop, next_mission, :start)
125
+ mission.depends_on subtask
126
+ mission.signals(:stop, next_mission, :start)
127
127
 
128
- remote.plan.insert(mission)
129
- remote.plan.insert(next_mission)
128
+ remote.plan.add_mission(mission)
129
+ remote.plan.add_mission(next_mission)
130
130
  end
131
131
 
132
132
  r_mission = remote_task(:id => 'mission', :permanent => true)
@@ -137,7 +137,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
137
137
  assert_equal([], r_mission.children.to_a)
138
138
  assert_equal([], r_mission.event(:stop).child_objects(EventStructure::Signal).to_a)
139
139
 
140
- # Discover remote relations
140
+ # add remote relations
141
141
  remote_peer.discover_neighborhood(r_mission, 1) do |r_mission|
142
142
  proxies = r_mission.children.to_a
143
143
  assert_equal(1, proxies.to_a.size)
@@ -146,16 +146,16 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
146
146
  assert_equal(r_next_mission.event(:start), proxies.first)
147
147
  end
148
148
 
149
- plan.auto(r_mission)
150
- plan.auto(r_subtask)
151
- plan.auto(r_next_mission)
152
- Roby.control.wait_one_cycle
153
- assert_equal([remote_peer.task], plan.keepalive.to_a)
149
+ plan.unmark_permanent(r_mission)
150
+ plan.unmark_permanent(r_subtask)
151
+ plan.unmark_permanent(r_next_mission)
152
+ engine.wait_one_cycle
153
+ assert_equal([remote_peer.task], plan.permanent_tasks.to_a)
154
154
  end
155
155
 
156
156
  def test_subscribing_old_objects
157
- peer2peer(true) do |remote|
158
- plan.insert(@task = SimpleTask.new(:id => 1))
157
+ peer2peer do |remote|
158
+ plan.add_mission(@task = SimpleTask.new(:id => 1))
159
159
  end
160
160
 
161
161
  r_task, r_task_id = nil
@@ -170,20 +170,20 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
170
170
  end
171
171
 
172
172
  def test_subscription
173
- peer2peer(true) do |remote|
173
+ peer2peer do |remote|
174
174
  root, mission, subtask, next_mission =
175
175
  SimpleTask.new(:id => 'root'),
176
176
  SimpleTask.new(:id => 'mission'),
177
177
  SimpleTask.new(:id => 'subtask'),
178
178
  SimpleTask.new(:id => 'next_mission')
179
- root.realized_by mission
180
- mission.realized_by subtask
181
- mission.on(:stop, next_mission, :start)
179
+ root.depends_on mission
180
+ mission.depends_on subtask
181
+ mission.signals(:stop, next_mission, :start)
182
182
 
183
- remote.plan.permanent(subtask)
184
- remote.plan.insert(root)
185
- remote.plan.insert(mission)
186
- remote.plan.insert(next_mission)
183
+ remote.plan.add_permanent(subtask)
184
+ remote.plan.add_mission(root)
185
+ remote.plan.add_mission(mission)
186
+ remote.plan.add_mission(next_mission)
187
187
 
188
188
  remote.singleton_class.class_eval do
189
189
  include Test::Unit::Assertions
@@ -204,7 +204,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
204
204
  mission.remove_child subtask
205
205
  end
206
206
  define_method(:add_mission_subtask) do
207
- mission.realized_by subtask
207
+ mission.depends_on subtask
208
208
  end
209
209
  end
210
210
  end
@@ -233,11 +233,11 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
233
233
  assert(plan.useful_task?(r_mission))
234
234
  r_next_mission = remote_task(:id => 'next_mission')
235
235
  r_subtask = remote_task(:id => 'subtask')
236
- Roby::Control.synchronize do
236
+ Roby.synchronize do
237
237
  assert(!r_next_mission.plan || !plan.useful_task?(r_next_mission))
238
238
  assert(!r_subtask.plan || !plan.useful_task?(r_subtask))
239
239
  end
240
- Roby.control.wait_one_cycle
240
+ engine.wait_one_cycle
241
241
 
242
242
  # Check that the task index has been updated
243
243
  assert(!plan.task_index.by_owner[remote_peer].include?(r_subtask))
@@ -248,7 +248,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
248
248
  r_subtask = remote_task(:id => 'subtask')
249
249
  assert(!plan.unneeded_tasks.include?(r_subtask))
250
250
  r_next_mission = remote_task(:id => 'next_mission')
251
- Roby::Control.synchronize do
251
+ Roby.synchronize do
252
252
  assert(!r_next_mission.plan || plan.unneeded_tasks.include?(r_next_mission))
253
253
  end
254
254
 
@@ -256,13 +256,13 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
256
256
 
257
257
  ## Check plan GC after we have unsubscribed from mission
258
258
  remote_peer.unsubscribe(r_mission)
259
- Roby::Control.synchronize do
259
+ Roby.synchronize do
260
260
  assert(r_mission.plan)
261
261
  assert(!plan.unneeded_tasks.include?(r_mission))
262
262
  assert(!remote_peer.subscribed?(r_mission))
263
263
  assert(plan.unneeded_tasks.include?(r_subtask))
264
264
  end
265
- Roby.control.wait_one_cycle
265
+ engine.wait_one_cycle
266
266
 
267
267
  # Check that subtask and next_mission are removed from the plan
268
268
  assert(!r_subtask.plan)
@@ -301,23 +301,23 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
301
301
  r_mission = remote_peer.subscribe(r_mission)
302
302
  r_subtask = remote_task(:id => 'subtask')
303
303
  r_next_mission = remote_task(:id => 'next_mission')
304
- Roby.control.wait_one_cycle
304
+ engine.wait_one_cycle
305
305
 
306
306
  proxies = r_mission.children.to_a
307
307
  assert(! proxies.empty?)
308
308
  end
309
309
 
310
310
  def test_remove_not_needed
311
- peer2peer(true) do |remote|
311
+ peer2peer do |remote|
312
312
  left, right, middle =
313
313
  SimpleTask.new(:id => 'left'),
314
314
  SimpleTask.new(:id => 'right'),
315
315
  SimpleTask.new(:id => 'middle')
316
- remote.plan.insert(left)
317
- remote.plan.insert(right)
316
+ remote.plan.add_mission(left)
317
+ remote.plan.add_mission(right)
318
318
 
319
- left.realized_by middle
320
- right.realized_by middle
319
+ left.depends_on middle
320
+ right.depends_on middle
321
321
 
322
322
  remote.singleton_class.class_eval do
323
323
  include Test::Unit::Assertions
@@ -338,7 +338,7 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
338
338
  assert(!plan.unneeded_tasks.include?(right))
339
339
  assert(!plan.unneeded_tasks.include?(middle))
340
340
 
341
- Roby::Control.synchronize do
341
+ Roby.synchronize do
342
342
  remote_peer.unsubscribe(right)
343
343
  assert(!right.remotely_useful?)
344
344
  assert(!right.subscribed?)
@@ -357,10 +357,10 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
357
357
  end
358
358
 
359
359
  def test_data_update
360
- peer2peer(true) do |remote|
360
+ peer2peer do |remote|
361
361
  task = SimpleTask.new(:id => 'task')
362
362
  task.data = [4, 2]
363
- remote.plan.insert(task)
363
+ remote.plan.add_mission(task)
364
364
 
365
365
  remote.singleton_class.class_eval do
366
366
  define_method(:change_data) { task.data = 42 }
@@ -375,20 +375,20 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
375
375
  end
376
376
 
377
377
  def test_mission_notifications
378
- peer2peer(true) do |remote|
379
- plan.insert(mission = SimpleTask.new(:id => 'mission'))
378
+ peer2peer do |remote|
379
+ plan.add_mission(mission = SimpleTask.new(:id => 'mission'))
380
380
 
381
381
  remote.class.class_eval do
382
382
  define_method(:discard_mission) do
383
- Roby::Control.synchronize do
384
- remote.plan.discard(mission)
385
- remote.plan.permanent(mission)
383
+ Roby.synchronize do
384
+ remote.plan.unmark_mission(mission)
385
+ remote.plan.add_permanent(mission)
386
386
  end
387
387
  end
388
388
  define_method(:insert_mission) do
389
- Roby::Control.synchronize do
390
- remote.plan.auto(mission)
391
- remote.plan.insert(mission)
389
+ Roby.synchronize do
390
+ remote.plan.unmark_permanent(mission)
391
+ remote.plan.add_mission(mission)
392
392
  end
393
393
  end
394
394
  end
@@ -409,25 +409,25 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
409
409
  end
410
410
 
411
411
  def test_relation_updates
412
- peer2peer(true) do |remote|
412
+ peer2peer do |remote|
413
413
  mission, subtask, next_mission =
414
414
  SimpleTask.new(:id => 'mission'),
415
415
  SimpleTask.new(:id => 'subtask'),
416
416
  SimpleTask.new(:id => 'next_mission')
417
417
 
418
- remote.plan.insert(mission)
419
- remote.plan.insert(next_mission)
420
- remote.plan.permanent(subtask)
418
+ remote.plan.add_mission(mission)
419
+ remote.plan.add_mission(next_mission)
420
+ remote.plan.add_permanent(subtask)
421
421
 
422
422
  remote.singleton_class.class_eval do
423
423
  define_method(:add_mission_subtask) do
424
- mission.realized_by subtask
424
+ mission.depends_on subtask
425
425
  end
426
426
  define_method(:remove_mission_subtask) do
427
427
  mission.remove_child subtask
428
428
  end
429
429
  define_method(:add_mission_stop_next_start) do
430
- mission.on(:stop, next_mission, :start)
430
+ mission.signals(:stop, next_mission, :start)
431
431
  end
432
432
  define_method(:remove_mission_stop_next_start) do
433
433
  mission.event(:stop).remove_signal(next_mission.event(:start))
@@ -458,16 +458,16 @@ class TC_DistributedRemotePlan < Test::Unit::TestCase
458
458
 
459
459
  # Check that remote events that are unknown locally are properly ignored
460
460
  def test_ignored_events
461
- peer2peer(true) do |remote|
461
+ peer2peer do |remote|
462
462
  model = Class.new(SimpleTask) do
463
463
  event :unknown, :command => true
464
464
  end
465
- remote.plan.insert(t1 = SimpleTask.new(:id => 1))
466
- remote.plan.insert(t2 = SimpleTask.new(:id => 2))
467
- remote.plan.insert(u = model.new(:id => 0))
465
+ remote.plan.add_mission(t1 = SimpleTask.new(:id => 1))
466
+ remote.plan.add_mission(t2 = SimpleTask.new(:id => 2))
467
+ remote.plan.add_mission(u = model.new(:id => 0))
468
468
 
469
- t1.event(:start).on u.event(:unknown)
470
- t2.event(:start).emit_on u.event(:unknown)
469
+ t1.signals(:start, u, :unknown)
470
+ u.forward_to(:unknown, t2, :start)
471
471
 
472
472
  remote.singleton_class.class_eval do
473
473
  define_method(:remove_relations) do
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../..', File.dirname(__FILE__))
1
+ $LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), File.dirname(__FILE__))
2
2
  require 'roby/test/distributed'
3
3
  require 'roby/test/tasks/simple_task'
4
4
 
@@ -6,7 +6,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
6
6
  include Roby::Distributed::Test
7
7
 
8
8
  def test_marshal_transactions
9
- peer2peer(true) do |remote|
9
+ peer2peer do |remote|
10
10
  PeerServer.class_eval do
11
11
  attr_reader :plan
12
12
  def transaction
@@ -30,7 +30,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
30
30
  end
31
31
 
32
32
  def test_transaction_create
33
- peer2peer(true) do |remote|
33
+ peer2peer do |remote|
34
34
  PeerServer.class_eval do
35
35
  include Test::Unit::Assertions
36
36
  def check_transaction(marshalled_trsc, trsc_drbobject)
@@ -39,7 +39,6 @@ class TC_DistributedTransaction < Test::Unit::TestCase
39
39
  assert_equal([peer, Roby::Distributed], trsc.owners)
40
40
  assert(!trsc.first_editor?)
41
41
  assert(!trsc.editor?)
42
- assert(trsc.conflict_solver.kind_of?(Roby::SolverIgnoreUpdate))
43
42
 
44
43
  assert(trsc.subscribed?)
45
44
  assert(trsc.update_on?(peer))
@@ -48,7 +47,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
48
47
  end
49
48
  end
50
49
  end
51
- trsc = Distributed::Transaction.new(plan, :conflict_solver => SolverIgnoreUpdate.new)
50
+ trsc = Distributed::Transaction.new(plan)
52
51
  assert(trsc.self_owned?)
53
52
  assert(trsc.first_editor?)
54
53
  assert(trsc.editor?)
@@ -65,7 +64,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
65
64
  end
66
65
 
67
66
  def test_transaction_proxies
68
- peer2peer(true) do |remote|
67
+ peer2peer do |remote|
69
68
  PeerServer.class_eval do
70
69
  include Test::Unit::Assertions
71
70
  def marshalled_transaction_proxy(trsc, task)
@@ -84,7 +83,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
84
83
 
85
84
  # Check that marshalling the remote view of a local transaction proxy
86
85
  # returns the local proxy itself
87
- plan.insert(task = Task.new)
86
+ plan.add_mission(task = Task.new)
88
87
  assert(!plan.update_on?(remote_peer))
89
88
  assert(trsc.update_on?(remote_peer))
90
89
  assert(!task.update_on?(remote_peer))
@@ -99,20 +98,20 @@ class TC_DistributedTransaction < Test::Unit::TestCase
99
98
  assert_equal(proxy, remote_peer.local_object(marshalled_remote))
100
99
  end
101
100
 
102
- # Checks that if we discover a set of tasks, then their relations are updated as well
101
+ # Checks that if we add a set of tasks, then their relations are updated as well
103
102
  def test_discover
104
- peer2peer(true) do |remote|
103
+ peer2peer do |remote|
105
104
  def remote.add_tasks(trsc)
106
105
  trsc = local_peer.local_object(trsc)
107
106
 
108
107
  trsc.edit do
109
108
  t1 = SimpleTask.new :id => 'root'
110
- t1.realized_by(t2 = SimpleTask.new(:id => 'child'))
111
- t1.on(:start, t2, :start)
112
- t2.realized_by(t3 = SimpleTask.new(:id => 'grandchild'))
113
- t3.on(:failed, t2, :failed)
109
+ t1.depends_on(t2 = SimpleTask.new(:id => 'child'))
110
+ t1.signals(:start, t2, :start)
111
+ t2.depends_on(t3 = SimpleTask.new(:id => 'grandchild'))
112
+ t3.signals(:failed, t2, :failed)
114
113
 
115
- trsc.insert(t1)
114
+ trsc.add_mission(t1)
116
115
  end
117
116
  end
118
117
  end
@@ -133,7 +132,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
133
132
  end
134
133
 
135
134
  def test_edition
136
- peer2peer(true) do |remote|
135
+ peer2peer do |remote|
137
136
  class << remote
138
137
  include Test::Unit::Assertions
139
138
  def edit_transaction(trsc)
@@ -175,8 +174,8 @@ class TC_DistributedTransaction < Test::Unit::TestCase
175
174
  end
176
175
 
177
176
  def test_ownership
178
- peer2peer(true) do |remote|
179
- remote.plan.insert(Task.new(:id => 1))
177
+ peer2peer do |remote|
178
+ remote.plan.add_mission(Task.new(:id => 1))
180
179
  def remote.add_owner_local(trsc)
181
180
  trsc = local_peer.local_object(trsc)
182
181
  trsc.add_owner local_peer
@@ -207,34 +206,34 @@ class TC_DistributedTransaction < Test::Unit::TestCase
207
206
  trsc.self_owned = false
208
207
 
209
208
  task = Task.new
210
- assert_raises(OwnershipError) { t_task.realized_by task }
211
- assert_raises(OwnershipError) { task.realized_by t_task }
212
- assert_raises(OwnershipError) { task.event(:start).on t_task.event(:start) }
209
+ assert_raises(OwnershipError) { t_task.depends_on task }
210
+ assert_raises(OwnershipError) { task.depends_on t_task }
211
+ assert_raises(OwnershipError) { task.event(:start).signals t_task.event(:start) }
213
212
  assert_raises(OwnershipError) { trsc.discard_transaction }
214
213
  assert_raises(OwnershipError) { trsc.commit_transaction }
215
214
  assert(! task.plan)
216
- assert_nothing_raised { t_task.event(:start).on task.event(:start) }
215
+ t_task.signals(:start, task, :start)
217
216
 
218
217
  remote.add_owner_local(Distributed.format(trsc))
219
218
 
220
- assert_nothing_raised { t_task.realized_by task }
221
- assert_nothing_raised { t_task.remove_child task }
222
- assert_nothing_raised { t_task.event(:start).remove_signal task.event(:start) }
223
- assert_nothing_raised { task.realized_by t_task }
224
- assert_nothing_raised { task.event(:start).on t_task.event(:start) }
219
+ t_task.depends_on task
220
+ t_task.remove_child task
221
+ t_task.event(:start).remove_signal task.event(:start)
222
+ task.depends_on t_task
223
+ task.signals(:start, t_task, :start)
225
224
  assert_raises(OwnershipError) { trsc.remove_owner remote_peer }
226
225
  assert_raises(OwnershipError) { trsc.self_owned = false }
227
- assert_nothing_raised { trsc.discard_transaction }
226
+ trsc.discard_transaction
228
227
  end
229
228
 
230
229
  def test_executed_by
231
- peer2peer(true) do |remote|
230
+ peer2peer do |remote|
232
231
  task = Task.new(:id => 1)
233
232
  exec = Class.new(Task) do
234
233
  event :ready, :command => true
235
234
  end.new(:id => 'exec')
236
235
  task.executed_by exec
237
- remote.plan.insert(task)
236
+ remote.plan.add_mission(task)
238
237
 
239
238
  remote.singleton_class.class_eval do
240
239
  include Test::Unit::Assertions
@@ -269,8 +268,8 @@ class TC_DistributedTransaction < Test::Unit::TestCase
269
268
  end
270
269
 
271
270
  def test_argument_updates
272
- peer2peer(true) do |remote|
273
- remote.plan.insert(ArgumentUpdateTest.new(:id => 2))
271
+ peer2peer do |remote|
272
+ remote.plan.add_mission(ArgumentUpdateTest.new(:id => 2))
274
273
  def remote.set_argument(task)
275
274
  task = local_peer.local_object(task)
276
275
  task.plan.edit
@@ -303,7 +302,7 @@ class TC_DistributedTransaction < Test::Unit::TestCase
303
302
 
304
303
  # Now, add a task of our own and link the remote and the local
305
304
  task = SimpleTask.new :id => 'local'
306
- trsc.discover(task)
305
+ trsc.add(task)
307
306
 
308
307
  parent = subscribe_task(:id => 'remote-1')
309
308
  child = subscribe_task(:id => 'remote-2')
@@ -318,10 +317,10 @@ class TC_DistributedTransaction < Test::Unit::TestCase
318
317
  assert(task.event(:stop).read_write?)
319
318
 
320
319
  # Add relations
321
- trsc[parent].realized_by task
322
- task.realized_by trsc[child]
323
- trsc[parent].event(:start).on task.event(:start)
324
- task.event(:stop).on trsc[child].event(:stop)
320
+ trsc[parent].depends_on task
321
+ task.depends_on trsc[child]
322
+ trsc[parent].event(:start).signals task.event(:start)
323
+ task.event(:stop).signals trsc[child].event(:stop)
325
324
 
326
325
  [task, parent]
327
326
  end
@@ -350,10 +349,10 @@ class TC_DistributedTransaction < Test::Unit::TestCase
350
349
  end
351
350
 
352
351
  def test_propose_commit
353
- peer2peer(true) do |remote|
352
+ peer2peer do |remote|
354
353
  testcase = self
355
- remote.plan.insert(root = SimpleTask.new(:id => 'remote-1'))
356
- root.realized_by(child = SimpleTask.new(:id => 'remote-2'))
354
+ remote.plan.add_mission(root = SimpleTask.new(:id => 'remote-1'))
355
+ root.depends_on(child = SimpleTask.new(:id => 'remote-2'))
357
356
 
358
357
  PeerServer.class_eval do
359
358
  include Test::Unit::Assertions
@@ -382,10 +381,10 @@ class TC_DistributedTransaction < Test::Unit::TestCase
382
381
  end
383
382
 
384
383
  def test_synchronization
385
- peer2peer(true) do |remote|
384
+ peer2peer do |remote|
386
385
  testcase = self
387
- remote.plan.insert(root = SimpleTask.new(:id => 'remote-1'))
388
- root.realized_by SimpleTask.new(:id => 'remote-2')
386
+ remote.plan.add_mission(root = SimpleTask.new(:id => 'remote-1'))
387
+ root.depends_on SimpleTask.new(:id => 'remote-2')
389
388
 
390
389
  PeerServer.class_eval do
391
390
  define_method(:check_transaction) do |trsc|
@@ -411,8 +410,12 @@ class TC_DistributedTransaction < Test::Unit::TestCase
411
410
  check_transaction_commit(trsc)
412
411
  end
413
412
 
413
+ class RemoteTaskModel < SimpleTask
414
+ argument :arg
415
+ end
416
+
414
417
  def test_create_remote_tasks
415
- peer2peer(true) do |remote|
418
+ peer2peer do |remote|
416
419
  def remote.arguments_of(t)
417
420
  t = local_peer.local_object(t)
418
421
  t.arguments
@@ -434,12 +437,12 @@ class TC_DistributedTransaction < Test::Unit::TestCase
434
437
  trsc.propose(remote_peer)
435
438
 
436
439
  local_task = SimpleTask.new(:id => 'local')
437
- trsc.insert(local_task)
440
+ trsc.add_mission(local_task)
438
441
 
439
- t = SimpleTask.new(:arg => 10, :id => 0)
442
+ t = RemoteTaskModel.new(:arg => 10, :id => 0)
440
443
  t.extend DistributedObject
441
- local_task.realized_by t
442
- trsc.insert(t)
444
+ local_task.depends_on t
445
+ trsc.add_mission(t)
443
446
  t.owner = remote_peer
444
447
 
445
448
  assert(trsc.task_index.by_owner[remote_peer].include?(t))