bumbleworks 0.0.48 → 0.0.50

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 (39) hide show
  1. data/.gitignore +4 -1
  2. data/lib/bumbleworks.rb +9 -8
  3. data/lib/bumbleworks/configuration.rb +8 -5
  4. data/lib/bumbleworks/entity.rb +88 -0
  5. data/lib/bumbleworks/participant.rb +6 -7
  6. data/lib/bumbleworks/participant/base.rb +11 -0
  7. data/lib/bumbleworks/participant/entity_interactor.rb +29 -0
  8. data/lib/bumbleworks/participant/error_handler.rb +14 -0
  9. data/lib/bumbleworks/participant/local_participant.rb +11 -0
  10. data/lib/bumbleworks/participant/storage_participant.rb +11 -0
  11. data/lib/bumbleworks/process.rb +64 -0
  12. data/lib/bumbleworks/ruote.rb +12 -4
  13. data/lib/bumbleworks/support.rb +3 -5
  14. data/lib/bumbleworks/task.rb +6 -4
  15. data/lib/bumbleworks/{tasks → task}/base.rb +1 -1
  16. data/lib/bumbleworks/task/finder.rb +39 -3
  17. data/lib/bumbleworks/version.rb +1 -1
  18. data/spec/fixtures/entities/furby.rb +30 -0
  19. data/spec/integration/entity_spec.rb +49 -0
  20. data/spec/integration/history_storage_spec.rb +4 -4
  21. data/spec/integration/sample_application_spec.rb +8 -2
  22. data/spec/lib/bumbleworks/entity_spec.rb +208 -0
  23. data/spec/lib/bumbleworks/{participant_spec.rb → participant/base_spec.rb} +3 -3
  24. data/spec/lib/bumbleworks/participant/entity_interactor_spec.rb +91 -0
  25. data/spec/lib/bumbleworks/{error_handler_participant_spec.rb → participant/error_handler_spec.rb} +1 -1
  26. data/spec/lib/bumbleworks/{local_participant_spec.rb → participant/local_participant_spec.rb} +1 -1
  27. data/spec/lib/bumbleworks/process_spec.rb +147 -0
  28. data/spec/lib/bumbleworks/ruote/exp/broadcast_event_expression_spec.rb +1 -1
  29. data/spec/lib/bumbleworks/ruote/exp/wait_for_event_expression_spec.rb +3 -3
  30. data/spec/lib/bumbleworks/ruote_spec.rb +28 -21
  31. data/spec/lib/bumbleworks/task/finder_spec.rb +9 -0
  32. data/spec/lib/bumbleworks/task_spec.rb +98 -3
  33. data/spec/lib/bumbleworks_spec.rb +14 -7
  34. data/spec/spec_helper.rb +0 -1
  35. data/spec/support/process_testing_helpers.rb +9 -0
  36. metadata +34 -13
  37. data/lib/bumbleworks/error_handler_participant.rb +0 -12
  38. data/lib/bumbleworks/local_participant.rb +0 -9
  39. data/lib/bumbleworks/storage_participant.rb +0 -9
@@ -179,6 +179,13 @@ describe Bumbleworks do
179
179
  Bumbleworks.launch!(:amazing_process, :entity => entity)
180
180
  end
181
181
 
182
+ it 'returns a Bumbleworks::Process instance with the wfid of the launched process' do
183
+ Bumbleworks::Ruote.stub(:launch).with(:amazing_process).and_return('18181818')
184
+ bp = Bumbleworks.launch!(:amazing_process)
185
+ bp.should be_a(Bumbleworks::Process)
186
+ bp.id.should == '18181818'
187
+ end
188
+
182
189
  it 'throws exception if entity has nil id' do
183
190
  expect {
184
191
  Bumbleworks.launch!(:amazing_process, :entity => LovelyEntity.new(nil))
@@ -206,17 +213,17 @@ describe Bumbleworks do
206
213
  end
207
214
  end
208
215
 
209
- describe '#store_history?' do
216
+ describe '.store_history?' do
210
217
  it 'returns true if store_history is true' do
211
- subject.store_history = true
212
- subject.store_history?.should be_true
218
+ described_class.store_history = true
219
+ described_class.store_history?.should be_true
213
220
  end
214
221
 
215
222
  it 'returns false if store_history is anything but true' do
216
- subject.store_history = false
217
- subject.store_history?.should be_false
218
- subject.store_history = 'penguins'
219
- subject.store_history?.should be_false
223
+ described_class.store_history = false
224
+ described_class.store_history?.should be_false
225
+ described_class.store_history = 'penguins'
226
+ described_class.store_history?.should be_false
220
227
  end
221
228
  end
222
229
  end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,6 @@ SimpleCov.start
6
6
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
7
7
 
8
8
  require './lib/bumbleworks'
9
- Bumbleworks.env = 'test'
10
9
 
11
10
  RSpec.configure do |config|
12
11
  config.treat_symbols_as_metadata_keys_with_true_values = true
@@ -0,0 +1,9 @@
1
+ def wait_until(options = {}, &block)
2
+ options[:timeout] ||= 5
3
+
4
+ start_time = Time.now
5
+ until block.call
6
+ raise "The block never returned: \n#{block.to_source}" if (Time.now - start_time) > options[:timeout]
7
+ sleep 0.1
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbleworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.48
4
+ version: 0.0.50
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-12-05 00:00:00.000000000 Z
15
+ date: 2013-12-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: ruote
@@ -167,13 +167,18 @@ files:
167
167
  - doc/TERMS.md
168
168
  - lib/bumbleworks.rb
169
169
  - lib/bumbleworks/configuration.rb
170
+ - lib/bumbleworks/entity.rb
170
171
  - lib/bumbleworks/error_handler.rb
171
- - lib/bumbleworks/error_handler_participant.rb
172
172
  - lib/bumbleworks/error_logger.rb
173
173
  - lib/bumbleworks/hash_storage.rb
174
- - lib/bumbleworks/local_participant.rb
175
174
  - lib/bumbleworks/participant.rb
175
+ - lib/bumbleworks/participant/base.rb
176
+ - lib/bumbleworks/participant/entity_interactor.rb
177
+ - lib/bumbleworks/participant/error_handler.rb
178
+ - lib/bumbleworks/participant/local_participant.rb
179
+ - lib/bumbleworks/participant/storage_participant.rb
176
180
  - lib/bumbleworks/participant_registration.rb
181
+ - lib/bumbleworks/process.rb
177
182
  - lib/bumbleworks/process_definition.rb
178
183
  - lib/bumbleworks/rake_tasks.rb
179
184
  - lib/bumbleworks/ruote.rb
@@ -181,11 +186,10 @@ files:
181
186
  - lib/bumbleworks/ruote/exp/wait_for_event_expression.rb
182
187
  - lib/bumbleworks/simple_logger.rb
183
188
  - lib/bumbleworks/storage_adapter.rb
184
- - lib/bumbleworks/storage_participant.rb
185
189
  - lib/bumbleworks/support.rb
186
190
  - lib/bumbleworks/task.rb
191
+ - lib/bumbleworks/task/base.rb
187
192
  - lib/bumbleworks/task/finder.rb
188
- - lib/bumbleworks/tasks/base.rb
189
193
  - lib/bumbleworks/tree_builder.rb
190
194
  - lib/bumbleworks/version.rb
191
195
  - lib/bumbleworks/workitem_entity_storage.rb
@@ -205,18 +209,23 @@ files:
205
209
  - spec/fixtures/definitions/a_list_of_jams.rb
206
210
  - spec/fixtures/definitions/nested_folder/test_nested_process.rb
207
211
  - spec/fixtures/definitions/test_process.rb
212
+ - spec/fixtures/entities/furby.rb
213
+ - spec/integration/entity_spec.rb
208
214
  - spec/integration/example_configurations_spec.rb
209
215
  - spec/integration/history_storage_spec.rb
210
216
  - spec/integration/sample_application_spec.rb
211
217
  - spec/lib/bumbleworks/configuration_spec.rb
212
- - spec/lib/bumbleworks/error_handler_participant_spec.rb
218
+ - spec/lib/bumbleworks/entity_spec.rb
213
219
  - spec/lib/bumbleworks/error_handler_spec.rb
214
220
  - spec/lib/bumbleworks/error_logger_spec.rb
215
221
  - spec/lib/bumbleworks/hash_storage_spec.rb
216
- - spec/lib/bumbleworks/local_participant_spec.rb
222
+ - spec/lib/bumbleworks/participant/base_spec.rb
223
+ - spec/lib/bumbleworks/participant/entity_interactor_spec.rb
224
+ - spec/lib/bumbleworks/participant/error_handler_spec.rb
225
+ - spec/lib/bumbleworks/participant/local_participant_spec.rb
217
226
  - spec/lib/bumbleworks/participant_registration_spec.rb
218
- - spec/lib/bumbleworks/participant_spec.rb
219
227
  - spec/lib/bumbleworks/process_definition_spec.rb
228
+ - spec/lib/bumbleworks/process_spec.rb
220
229
  - spec/lib/bumbleworks/ruote/exp/broadcast_event_expression_spec.rb
221
230
  - spec/lib/bumbleworks/ruote/exp/wait_for_event_expression_spec.rb
222
231
  - spec/lib/bumbleworks/ruote_spec.rb
@@ -230,6 +239,7 @@ files:
230
239
  - spec/lib/bumbleworks_spec.rb
231
240
  - spec/spec_helper.rb
232
241
  - spec/support/path_helpers.rb
242
+ - spec/support/process_testing_helpers.rb
233
243
  - spec/support/tracer.rb
234
244
  homepage: ''
235
245
  licenses:
@@ -244,12 +254,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
254
  - - ! '>='
245
255
  - !ruby/object:Gem::Version
246
256
  version: '0'
257
+ segments:
258
+ - 0
259
+ hash: 3856006689923069850
247
260
  required_rubygems_version: !ruby/object:Gem::Requirement
248
261
  none: false
249
262
  requirements:
250
263
  - - ! '>='
251
264
  - !ruby/object:Gem::Version
252
265
  version: '0'
266
+ segments:
267
+ - 0
268
+ hash: 3856006689923069850
253
269
  requirements: []
254
270
  rubyforge_project:
255
271
  rubygems_version: 1.8.23
@@ -272,18 +288,23 @@ test_files:
272
288
  - spec/fixtures/definitions/a_list_of_jams.rb
273
289
  - spec/fixtures/definitions/nested_folder/test_nested_process.rb
274
290
  - spec/fixtures/definitions/test_process.rb
291
+ - spec/fixtures/entities/furby.rb
292
+ - spec/integration/entity_spec.rb
275
293
  - spec/integration/example_configurations_spec.rb
276
294
  - spec/integration/history_storage_spec.rb
277
295
  - spec/integration/sample_application_spec.rb
278
296
  - spec/lib/bumbleworks/configuration_spec.rb
279
- - spec/lib/bumbleworks/error_handler_participant_spec.rb
297
+ - spec/lib/bumbleworks/entity_spec.rb
280
298
  - spec/lib/bumbleworks/error_handler_spec.rb
281
299
  - spec/lib/bumbleworks/error_logger_spec.rb
282
300
  - spec/lib/bumbleworks/hash_storage_spec.rb
283
- - spec/lib/bumbleworks/local_participant_spec.rb
301
+ - spec/lib/bumbleworks/participant/base_spec.rb
302
+ - spec/lib/bumbleworks/participant/entity_interactor_spec.rb
303
+ - spec/lib/bumbleworks/participant/error_handler_spec.rb
304
+ - spec/lib/bumbleworks/participant/local_participant_spec.rb
284
305
  - spec/lib/bumbleworks/participant_registration_spec.rb
285
- - spec/lib/bumbleworks/participant_spec.rb
286
306
  - spec/lib/bumbleworks/process_definition_spec.rb
307
+ - spec/lib/bumbleworks/process_spec.rb
287
308
  - spec/lib/bumbleworks/ruote/exp/broadcast_event_expression_spec.rb
288
309
  - spec/lib/bumbleworks/ruote/exp/wait_for_event_expression_spec.rb
289
310
  - spec/lib/bumbleworks/ruote_spec.rb
@@ -297,5 +318,5 @@ test_files:
297
318
  - spec/lib/bumbleworks_spec.rb
298
319
  - spec/spec_helper.rb
299
320
  - spec/support/path_helpers.rb
321
+ - spec/support/process_testing_helpers.rb
300
322
  - spec/support/tracer.rb
301
- has_rdoc:
@@ -1,12 +0,0 @@
1
- module Bumbleworks
2
- class ErrorHandlerParticipant < ::Ruote::Participant
3
- def on_workitem
4
- return if (error_handlers = Bumbleworks.error_handlers).empty?
5
-
6
- error_handlers.each do |error_handler|
7
- error_handler.new(workitem).on_error
8
- end
9
- reply
10
- end
11
- end
12
- end
@@ -1,9 +0,0 @@
1
- require "ruote/part/local_participant"
2
- require "bumbleworks/workitem_entity_storage"
3
-
4
- module Bumbleworks
5
- module LocalParticipant
6
- include ::Ruote::LocalParticipant
7
- include WorkitemEntityStorage
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module Bumbleworks
2
- class StorageParticipant < ::Ruote::StorageParticipant
3
- def on_workitem
4
- return_value = super
5
- Bumbleworks::Task.new(self[workitem.sid]).on_dispatch
6
- return return_value
7
- end
8
- end
9
- end