ruote 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG.txt +14 -0
  2. data/CREDITS.txt +4 -3
  3. data/Rakefile +4 -3
  4. data/TODO.txt +9 -6
  5. data/lib/ruote/context.rb +29 -13
  6. data/lib/ruote/engine.rb +14 -0
  7. data/lib/ruote/exp/flowexpression.rb +7 -0
  8. data/lib/ruote/fei.rb +15 -7
  9. data/lib/ruote/id/wfid_generator.rb +3 -0
  10. data/lib/ruote/log/fs_history.rb +3 -3
  11. data/lib/ruote/log/storage_history.rb +13 -7
  12. data/lib/ruote/log/test_logger.rb +6 -0
  13. data/lib/ruote/parser.rb +12 -3
  14. data/lib/ruote/parser/ruby_dsl.rb +53 -0
  15. data/lib/ruote/part/participant_list.rb +10 -0
  16. data/lib/ruote/part/storage_participant.rb +74 -3
  17. data/lib/ruote/storage/base.rb +9 -6
  18. data/lib/ruote/storage/hash_storage.rb +7 -2
  19. data/lib/ruote/util/misc.rb +4 -0
  20. data/lib/ruote/version.rb +1 -1
  21. data/lib/ruote/workitem.rb +35 -48
  22. data/ruote.gemspec +12 -9
  23. data/test/README.rdoc +3 -3
  24. data/test/functional/eft_18_concurrent_iterator.rb +8 -11
  25. data/test/functional/eft_24_add_branches.rb +18 -6
  26. data/test/functional/eft_27_inc.rb +2 -1
  27. data/test/functional/eft_6_concurrence.rb +9 -4
  28. data/test/functional/ft_20_storage_participant.rb +63 -29
  29. data/test/functional/ft_24_block_participants.rb +6 -0
  30. data/test/functional/ft_30_smtp_participant.rb +2 -2
  31. data/test/functional/ft_32_fs_history.rb +15 -10
  32. data/test/functional/ft_36_storage_history.rb +3 -3
  33. data/test/functional/ft_3_participant_registration.rb +8 -0
  34. data/test/functional/storage_helper.rb +2 -0
  35. data/test/functional/test.rb +9 -2
  36. data/test/unit/storage.rb +2 -1
  37. data/test/unit/test.rb +18 -2
  38. data/test/unit/ut_0_ruby_parser.rb +7 -0
  39. data/test/unit/ut_16_parser.rb +1 -1
  40. data/test/unit/ut_1_fei.rb +60 -2
  41. data/test/unit/ut_3_wait_logger.rb +2 -0
  42. data/test/unit/ut_7_workitem.rb +29 -2
  43. metadata +15 -4
@@ -22,8 +22,15 @@ def l (t)
22
22
  end
23
23
 
24
24
 
25
- Dir.glob(File.join(File.dirname(__FILE__), 'ct_*.rb')).sort.each { |t| l(t) }
26
- # concurrence/collision tests, tests about 2+ instances of ruote colliding
25
+ unless RUBY_PLATFORM.match(/mswin|mingw/)
26
+ #
27
+ # sorry but no more than 1 worker on windows !
28
+ #
29
+ # so no need to run those 2 workers tests
30
+ #
31
+ Dir.glob(File.join(File.dirname(__FILE__), 'ct_*.rb')).sort.each { |t| l(t) }
32
+ # concurrence/collision tests, tests about 2+ instances of ruote colliding
33
+ end
27
34
 
28
35
  Dir.glob(File.join(File.dirname(__FILE__), 'ft_*.rb')).sort.each { |t| l(t) }
29
36
  # functional tests targetting features rather than expressions
@@ -5,6 +5,8 @@
5
5
  # Mon Dec 14 15:03:13 JST 2009
6
6
  #
7
7
 
8
+ require File.join(File.dirname(__FILE__), %w[ .. test_helper.rb ])
9
+
8
10
  begin
9
11
  require 'yajl'
10
12
  rescue LoadError
@@ -16,7 +18,6 @@ rescue LoadError
16
18
  # stick with net/http
17
19
  end
18
20
 
19
- require File.join(File.dirname(__FILE__), %w[ .. test_helper.rb ])
20
21
  require File.join(File.dirname(__FILE__), %w[ .. functional storage_helper.rb ])
21
22
 
22
23
 
@@ -5,8 +5,24 @@
5
5
  # since Mon Oct 9 22:19:44 JST 2006
6
6
  #
7
7
 
8
+ def l (t)
9
+
10
+ if ARGV.include?('--split')
11
+
12
+ _v = ARGV.include?('-v') ? ' -v' : ' '
13
+
14
+ puts
15
+ puts "=== #{t} :"
16
+ puts `ruby#{_v} #{t} #{ARGV.join(' ')}`
17
+
18
+ exit $?.exitstatus if $?.exitstatus != 0
19
+ else
20
+ load(t)
21
+ end
22
+ end
23
+
8
24
  load File.join(File.dirname(__FILE__), 'storage.rb')
9
25
 
10
- Dir.glob(File.join(File.dirname(__FILE__), 'ut_*.rb')).sort.each { |t| load(t) }
11
- Dir.glob(File.join(File.dirname(__FILE__), 'hut_*.rb')).sort.each { |t| load(t) }
26
+ Dir.glob(File.join(File.dirname(__FILE__), 'ut_*.rb')).sort.each { |t| l(t) }
27
+ Dir.glob(File.join(File.dirname(__FILE__), 'hut_*.rb')).sort.each { |t| l(t) }
12
28
 
@@ -116,5 +116,12 @@ class UtRubyParserTest < Test::Unit::TestCase
116
116
  ["define", {}, [["redo", {"nada"=>nil}, []]]],
117
117
  tree)
118
118
  end
119
+
120
+ def test_to_tree
121
+
122
+ assert_equal(
123
+ [ 'sequence', {}, [ [ 'alpha', {}, [] ], [ 'bravo', {}, [] ] ] ],
124
+ Ruote.to_tree { sequence { alpha; bravo } })
125
+ end
119
126
  end
120
127
 
@@ -56,7 +56,7 @@ class PdefParserTest < Test::Unit::TestCase
56
56
  ]],
57
57
  tree)
58
58
 
59
- File.delete(fn) # sooner or later, it will get erased
59
+ FileUtils.rm_f(fn) # sooner or later, it will get erased
60
60
  end
61
61
 
62
62
  def test_to_xml
@@ -12,9 +12,67 @@ require 'ruote/fei'
12
12
 
13
13
  class UtFeiTest < Test::Unit::TestCase
14
14
 
15
- def test_initial
15
+ def test_misc
16
16
 
17
- assert true
17
+ fei = Ruote::FlowExpressionId.new(
18
+ 'expid' => '0_0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine')
19
+
20
+ assert_equal(
21
+ '0_0!!20101224-bababa',
22
+ fei.to_storage_id)
23
+
24
+ assert_equal(
25
+ 0,
26
+ fei.child_id)
27
+
28
+ assert_equal(
29
+ {"wfid"=>"20101224-bababa", "engine_id"=>"engine", "expid"=>"0_0"},
30
+ fei.to_h)
31
+ end
32
+
33
+ def test_direct_child
34
+
35
+ f0 = {
36
+ 'expid' => '0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine' }
37
+ f1 = {
38
+ 'expid' => '0_0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine' }
39
+ f2 = {
40
+ 'expid' => '0_0_0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine' }
41
+ f3 = {
42
+ 'expid' => '0_0', 'wfid' => '20101224-bakayaro', 'engine_id' => 'engine' }
43
+
44
+ assert_equal false, Ruote::FlowExpressionId.direct_child?(f0, f0)
45
+ assert_equal true, Ruote::FlowExpressionId.direct_child?(f0, f1)
46
+ assert_equal false, Ruote::FlowExpressionId.direct_child?(f0, f2)
47
+ assert_equal false, Ruote::FlowExpressionId.direct_child?(f0, f3)
48
+ end
49
+
50
+ def test_is_a_fei
51
+
52
+ assert_equal(
53
+ true,
54
+ Ruote::FlowExpressionId.is_a_fei?(
55
+ 'expid' => '0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine'))
56
+ assert_equal(
57
+ false,
58
+ Ruote::FlowExpressionId.is_a_fei?(
59
+ 'nada' => '0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine'))
60
+ end
61
+
62
+ def test_equality
63
+
64
+ f0 = Ruote::FlowExpressionId.new(
65
+ 'expid' => '0_0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine')
66
+ f1 = Ruote::FlowExpressionId.new(
67
+ 'expid' => '0_0', 'wfid' => '20101224-bababa', 'engine_id' => 'engine')
68
+ f2 = Ruote::FlowExpressionId.new(
69
+ 'expid' => '0_1', 'wfid' => '20101224-bababa', 'engine_id' => 'engine')
70
+
71
+ assert f0 == f1
72
+ assert f0 != f2
73
+
74
+ assert_equal f0.hash, f1.hash
75
+ assert_not_equal f0.hash, f2.hash
18
76
  end
19
77
  end
20
78
 
@@ -27,6 +27,8 @@ class UtWaitLoggerTest < Test::Unit::TestCase
27
27
 
28
28
  engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))
29
29
 
30
+ #engine.context.logger.noisy = true
31
+
30
32
  alpha = engine.register_participant :alpha, Ruote::HashParticipant.new
31
33
 
32
34
  engine.launch(pdef)
@@ -13,9 +13,36 @@ require 'ruote/workitem'
13
13
 
14
14
  class UtWorkitemTest < Test::Unit::TestCase
15
15
 
16
- def test_zero
16
+ def test_equality
17
17
 
18
- assert true
18
+ f0 = { 'expid' => '0', 'wfid' => '20101224-baba', 'engine_id' => 'engine' }
19
+ f1 = { 'expid' => '0', 'wfid' => '20101224-baba', 'engine_id' => 'engine' }
20
+ f2 = { 'expid' => '1', 'wfid' => '20101224-baba', 'engine_id' => 'engine' }
21
+
22
+ w0 = Ruote::Workitem.new('fei' => f0, 'fields' => { 'a' => 'A' })
23
+ w1 = Ruote::Workitem.new('fei' => f1, 'fields' => { 'b' => 'B' })
24
+ w2 = Ruote::Workitem.new('fei' => f2, 'fields' => { 'c' => 'C' })
25
+
26
+ assert w0 == w1
27
+ assert w0 != w2
28
+
29
+ assert_equal w0.hash, w1.hash
30
+ assert_not_equal w0.hash, w2.hash
31
+ end
32
+
33
+ def test_lookup
34
+
35
+ w0 = Ruote::Workitem.new(
36
+ 'fields' => {
37
+ 'customer' => {
38
+ 'name' => 'Jeff',
39
+ 'address' => [ 'Cornwall Square 10', 'Singapore-La' ] } })
40
+
41
+ assert_equal 'Jeff', w0.lookup('customer.name')
42
+ assert_equal 'Singapore-La', w0.lf('customer.address.1')
43
+
44
+ w0.set_field('customer.address', [ 'Cornwall Square 10b', 'Singapore-La' ])
45
+ assert_equal 'Cornwall Square 10b', w0.lookup('customer.address.0')
19
46
  end
20
47
  end
21
48
 
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruote
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  - Kenneth Kalmer
9
+ - Torsten Schoenebaum
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2010-02-08 00:00:00 +09:00
14
+ date: 2010-02-15 00:00:00 +09:00
14
15
  default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
@@ -21,7 +22,7 @@ dependencies:
21
22
  requirements:
22
23
  - - ">="
23
24
  - !ruby/object:Gem::Version
24
- version: "0"
25
+ version: 0.2.0
25
26
  version:
26
27
  - !ruby/object:Gem::Dependency
27
28
  name: rufus-cloche
@@ -31,7 +32,7 @@ dependencies:
31
32
  requirements:
32
33
  - - ">="
33
34
  - !ruby/object:Gem::Version
34
- version: 0.1.13
35
+ version: 0.1.14
35
36
  version:
36
37
  - !ruby/object:Gem::Dependency
37
38
  name: rufus-dollar
@@ -123,6 +124,16 @@ dependencies:
123
124
  - !ruby/object:Gem::Version
124
125
  version: "0"
125
126
  version:
127
+ - !ruby/object:Gem::Dependency
128
+ name: jeweler
129
+ type: :development
130
+ version_requirement:
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: "0"
136
+ version:
126
137
  description: "\n\
127
138
  ruote is an open source ruby workflow engine.\n "
128
139
  email: jmettraux@gmail.com