pione 0.5.0.alpha.1 → 0.5.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGQyYWIyZGZlMjFhNmYyMzQ4OGY2MGE5OGYzNWViYzFiMDE5Nzg4MQ==
4
+ ZTUzMjJhZmQwY2EyNmQzODZlZThhYTQ3YzA2NmQzYTgxMjM5ZTg4ZQ==
5
5
  data.tar.gz: !binary |-
6
- NDQyNDQ4ZjFkYjgxMWUxYjhmNjczZDdiNDRkZDEyNmQ2YzBkNjUwYQ==
6
+ ZWE3MzQ1NTFlOGZkNmNjYzA1ZTliMzFmMmYyZTE5MThjMjYyMWRkNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmY3Y2VmMjM2ZDA0Mzg4NDQwYjEyZDZmYzRiNzJjNzBmYmMyZmJkYzc2ZWYx
10
- N2UwNmNkZjU4MjI4ZWFiNjJiYWI0NzI5ZmJhM2I1ODNjNTkwMjM3OTY5N2I0
11
- ZGY3MDFjYWZjOTZkYjVjMjE3NmZlODEwMTMwYzMwODdmYmM3ZDQ=
9
+ MzNiNzQxMmYwMjllMjE4MzQ1Nzk3YzFiNWM3NzVhMWMzM2Q5YmFkMDA3Njgx
10
+ MDQyZmRmNzk0M2E5YTdmMjJkOWUyOGI4ZGE1YmI1OTkwMDkxMjFjYTY0YjI1
11
+ MTY2ZTAzY2Q4MzQyZjU4NTA2NTI2YWRmNDBkZWVkMjAxYzFiMjY=
12
12
  data.tar.gz: !binary |-
13
- YWFmOWMyMWVkZTFhYWU0YzUyZWU3NzNhNzE5YzY2NjgyOThlMDRlMTA1YjQ4
14
- ODg3YjQ3YTQ0ZGYwZTJiYjI5N2ZjNWJjNzAxZTYzYWVkYTA1NWRhZjZmNzhk
15
- NTc4NGRjYzRlNWMzYzkwOGUxNDc4YTFlYmU0YTZkNmU0NGQyZDY=
13
+ ODFlMGIxZTM4Zjc4M2Q0YjU5ZmNmNDNhOTNkOGRlNTYyMDM0ZWNmZTk2ZGZj
14
+ YjFhNWEzZWE0MGMwZmNhZjVlNTI4NmNhNTM3N2IxZWE2ZThjZGVhMTg2M2Iz
15
+ OGVlYzJjMGNiYmQwMjk2NmQyNmMwZjBhZTFkYWFkNTdhNDk4MWY=
data/.gitignore CHANGED
@@ -7,17 +7,16 @@
7
7
  .yardoc
8
8
  Gemfile.lock
9
9
  gems
10
- log.txt
11
- nohup.out
12
- test-report.txt
13
- *.log
14
10
 
15
- /input
16
- /output
17
11
  /process
18
- /result
19
12
  /html
20
13
  /vendor
21
14
  /coverage
22
15
  /pkg
23
16
  /*.ppg
17
+
18
+ log.txt
19
+ nohup.out
20
+ test-report.txt
21
+ *.log
22
+ scenario-test-result.txt
@@ -1,7 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "1.9.3"
4
- # - "2.0.0" # pione doesn't work with 2.0
4
+ - "2.0.0"
5
+ - "2.1"
6
+ - "2.2"
5
7
  # - jruby-19mode
6
8
  # - rbx-19mode # pione doesn't work with 2.0
7
9
  script: rake -I lib test
@@ -1 +1,2 @@
1
1
  .@ PackageName :: "FeatureExample"
2
+ .@ Entrance :: FeatureExample
@@ -68,7 +68,7 @@ module Pione
68
68
 
69
69
  def transit_to_run
70
70
  finder = RuleEngine::DataFinder.new(@tuple_space, 'root')
71
- list = Enumerator.new(finder, :find, :input, @rule_condition.inputs, @env).to_a
71
+ list = finder.to_enum(:find, :input, @rule_condition.inputs, @env).to_a
72
72
  if list.empty?
73
73
  user_message "error: no inputs"
74
74
  terminate
@@ -198,6 +198,9 @@ module Pione
198
198
  def line(content)
199
199
  space? >> content >> line_end.as(:tail)
200
200
  end
201
+ def _line(content)
202
+ space? >> content >> line_end
203
+ end
201
204
  end
202
205
  end
203
206
  end
@@ -31,10 +31,10 @@ module Pione
31
31
  }
32
32
 
33
33
  # +else_context+ matches +else+ block.
34
- rule(:else_context) { line(keyword_else) >> conditional_branch_context.as(:else_context) }
34
+ rule(:else_context) { _line(keyword_else) >> conditional_branch_context.as(:else_context) }
35
35
 
36
36
  # +branch_end+ matches conditional branch block end.
37
- rule(:branch_end) { line(keyword_end) }
37
+ rule(:branch_end) { _line(keyword_end) }
38
38
  rule(:branch_end!) { branch_end.or_error("conditional branch end not found") }
39
39
 
40
40
  # +case_branch+ matches +case+ conditional branches.
@@ -159,14 +159,14 @@ module Pione
159
159
  # +flow_rule_block+ matches flow rule declarations.
160
160
  rule(:flow_rule_block) {
161
161
  ( rule_header >> flow_rule_condition_context.as(:context1) >>
162
- line(keyword_Flow) >> flow_context.as(:context2) >> rule_footer!
162
+ _line(keyword_Flow) >> flow_context.as(:context2) >> rule_footer!
163
163
  ).as(:flow_rule_block)
164
164
  }
165
165
 
166
166
  # +action_rule_block+ matches action rule declarations.
167
167
  rule(:action_rule_block) {
168
168
  ( rule_header >> action_rule_condition_context.as(:context1) >>
169
- line(keyword_Action) >> action_context.as(:context2) >> rule_footer!
169
+ _line(keyword_Action) >> action_context.as(:context2) >> rule_footer!
170
170
  ).as(:action_rule_block)
171
171
  }
172
172
 
@@ -177,11 +177,11 @@ module Pione
177
177
 
178
178
  # +rule_header+ matches rule headers.
179
179
  rule(:rule_header) {
180
- line(keyword_Rule.as(:declarator) >> space >> expr!("should be rule name").as(:expr))
180
+ _line(keyword_Rule.as(:declarator) >> space >> expr!("should be rule name").as(:expr))
181
181
  }
182
182
 
183
183
  # +rule_footer+ matches rule end keywords.
184
- rule(:rule_footer) { line(keyword_End) }
184
+ rule(:rule_footer) { _line(keyword_End) }
185
185
  rule(:rule_footer!) { rule_footer.or_error("rule footer not found") }
186
186
  end
187
187
  end
@@ -104,7 +104,7 @@ module Pione
104
104
  if block_given?
105
105
  pieces.each {|e| yield set(pieces: [e])}
106
106
  else
107
- Enumerator.new(self, :each)
107
+ to_enum(:each)
108
108
  end
109
109
  end
110
110
 
@@ -3,17 +3,57 @@ module Pione
3
3
  SystemLog = Rootage::Log
4
4
  SystemLog.set_logger_block {Global.system_logger}
5
5
 
6
+ # BasicLogger provides common functions for PIONE's loggers.
7
+ class BasicLogger < Rootage::Logger
8
+ include DRbUndumped
9
+
10
+ # log level
11
+ attr_accessor :level
12
+
13
+ def initialize
14
+ @level = :info
15
+ end
16
+
17
+ private
18
+
19
+ # Return true if the level message can be loggable.
20
+ #
21
+ # @param level [Symbol]
22
+ # the level
23
+ # @return [Boolean]
24
+ # true if the level message can be loggable
25
+ def loggable?(level)
26
+ level_to_i(@level) >= level_to_i(level)
27
+ end
28
+
29
+ # Return the number of the level.
30
+ #
31
+ # @param level [Symbol]
32
+ # the level
33
+ # @return [Integer]
34
+ # the number of the level
35
+ def level_to_i(level)
36
+ case level
37
+ when :fatal; 0
38
+ when :error; 1
39
+ when :warn ; 2
40
+ when :info ; 3
41
+ when :debug; 4
42
+ end
43
+ end
44
+ end
45
+
6
46
  # `Log::PioneSystemLogger` is a PIONE original logger. This generates very
7
47
  # colorful message for identifiability and detailed informations.
8
- class PioneSystemLogger < Rootage::Logger
9
- include DRbUndumped
48
+ class PioneSystemLogger < BasicLogger
10
49
 
11
50
  attr_accessor :level
12
51
 
13
52
  def initialize(out = nil)
53
+ super()
54
+
14
55
  @queue = Queue.new
15
56
  @thread = make_writer_thread
16
- @level = :info
17
57
  @lock = Mutex.new
18
58
  @out = out
19
59
  end
@@ -49,16 +89,6 @@ module Pione
49
89
 
50
90
  private
51
91
 
52
- def level_to_i(level)
53
- case level
54
- when :fatal; 0
55
- when :error; 1
56
- when :warn ; 2
57
- when :info ; 3
58
- when :debug; 4
59
- end
60
- end
61
-
62
92
  def make_writer_thread
63
93
  Thread.new do
64
94
  while true do
@@ -69,7 +99,7 @@ module Pione
69
99
  end
70
100
 
71
101
  def push(level, msg, pos, pid)
72
- if level_to_i(@level) >= level_to_i(level)
102
+ if loggable?(level)
73
103
  @queue.push([level, msg, pos, pid, Time.now])
74
104
  end
75
105
  end
@@ -88,31 +118,32 @@ module Pione
88
118
  end
89
119
  end
90
120
 
91
- class DelegatableLogger < Rootage::Logger
92
- include DRbUndumped
93
-
121
+ # DelegatableLogger delegates logging functions to another logger.
122
+ class DelegatableLogger < BasicLogger
94
123
  def initialize(logger)
124
+ super()
125
+
95
126
  @logger = logger
96
127
  end
97
128
 
98
129
  def fatal(msg, pos=caller(1).first, pid=Process.pid)
99
- send_message(msg, pos, pid) {@logger.fatal(msg, pos, pid)}
130
+ send_message(:fatal, msg, pos, pid) {@logger.fatal(msg, pos, pid)}
100
131
  end
101
132
 
102
133
  def error(msg, pos=caller(1).first, pid=Process.pid)
103
- send_message(msg, pos, pid) {@logger.error(msg, pos, pid)}
134
+ send_message(:error, msg, pos, pid) {@logger.error(msg, pos, pid)}
104
135
  end
105
136
 
106
137
  def warn(msg, pos=caller(1).first, pid=Process.pid)
107
- send_message(msg, pos, pid) {@logger.warn(msg, pos, pid)}
138
+ send_message(:warn, msg, pos, pid) {@logger.warn(msg, pos, pid)}
108
139
  end
109
140
 
110
141
  def info(msg, pos=caller(1).first, pid=Process.pid)
111
- send_message(msg, pos, pid) {@logger.info(msg, pos, pid)}
142
+ send_message(:info, msg, pos, pid) {@logger.info(msg, pos, pid)}
112
143
  end
113
144
 
114
145
  def debug(msg, pos=caller(1).first, pid=Process.pid)
115
- send_message(msg, pos, pid) {@logger.debug(msg, pos, pid)}
146
+ send_message(:debug, msg, pos, pid) {@logger.debug(msg, pos, pid)}
116
147
  end
117
148
 
118
149
  def terminate
@@ -121,11 +152,15 @@ module Pione
121
152
 
122
153
  private
123
154
 
124
- def send_message(msg, pos, pid, &block)
125
- block.call
126
- rescue Exception
127
- # print stdout directly if the logger fails
128
- $stdout.puts("%s (%s) #%s" % [msg, pos, pid])
155
+ def send_message(level, msg, pos, pid, &block)
156
+ if loggable?(level)
157
+ begin
158
+ block.call
159
+ rescue Exception
160
+ # print stdout directly if the logger fails
161
+ $stdout.puts("%s (%s) #%s" % [msg, pos, pid])
162
+ end
163
+ end
129
164
  end
130
165
  end
131
166
 
@@ -7,9 +7,14 @@ module Pione
7
7
 
8
8
  forward! Proc.new{thread}, :alive?, :stop?
9
9
 
10
- # Kill the process.
10
+ # Kill the process. This method waits the process to be dead.
11
+ #
12
+ # @param signal [Symbol]
13
+ # the signal to send
14
+ # @return [void]
11
15
  def kill(signal = :TERM)
12
16
  Process.kill(signal, pid)
17
+ wait
13
18
  end
14
19
 
15
20
  # Wait until the process is dead.
@@ -1,4 +1,4 @@
1
1
  module Pione
2
2
  # version of pione
3
- VERSION = "0.5.0.alpha.1"
3
+ VERSION = "0.5.0.alpha.2"
4
4
  end
@@ -13,7 +13,7 @@ TestHelper.scope do |this|
13
13
 
14
14
  it "should execute a PIONE document" do
15
15
  path = Temppath.create
16
- cmd = @cmd.new(["example/HelloWorld/HelloWorld.pione", "--base", path.to_s])
16
+ cmd = @cmd.new(["example/HelloWorld/", "--base", path.to_s])
17
17
  res = Rootage::ScenarioTest.succeed(cmd)
18
18
  Location[path + "output" + "message.txt"].should.exist
19
19
  Location[path + "output" + "message.txt"].read.should.start_with "Hello, world!"
@@ -21,7 +21,7 @@ TestHelper.scope do |this|
21
21
 
22
22
  it "should execute a PIONE document with stand alone mode" do
23
23
  path = Temppath.create
24
- cmd = @cmd.new(["example/HelloWorld/HelloWorld.pione", "--base", path.to_s, "--stand-alone"])
24
+ cmd = @cmd.new(["example/HelloWorld/", "--base", path.to_s, "--stand-alone"])
25
25
  Rootage::ScenarioTest.succeed(cmd)
26
26
  Location[path + "output" + "message.txt"].should.exist
27
27
  Location[path + "output" + "message.txt"].read.should.start_with "Hello, world!"
@@ -49,201 +49,5 @@ TestHelper.scope do |this|
49
49
  cmd = @cmd.new([doc, "--base", path.to_s, "--stand-alone"])
50
50
  Rootage::ScenarioTest.fail(cmd)
51
51
  end
52
-
53
- describe "example/Fib" do
54
- TestHelper::PioneClientRunner.test(self) do |runner|
55
- runner.title = "should get a result with no parameters (default fib(3))"
56
- runner.args = ["example/Fib/Fib.pione", *runner.default_arguments]
57
- runner.run do |base|
58
- (base + "output" + "result.txt").should.exist
59
- (base + "output" + "result.txt").read.should.start_with "2"
60
- end
61
- end
62
-
63
- # FIXME: this test is unstable... maybe there are bugs
64
-
65
- # it "should get a result of fib(10)" do
66
- # path = Temppath.create
67
- # args = ["example/Fib/Fib.pione", "-o", path.to_s, "--params", "{NUM: 10}"]
68
- # res = TestHelper::Command.succeed do
69
- # Pione::Command::PioneClient.run(args)
70
- # end
71
- # Location[path + "result.txt"].should.exist
72
- # Location[path + "result.txt"].read.should.start_with "55"
73
- # end
74
- end
75
-
76
- describe "example/PegasusWMS/Merge" do
77
- TestHelper::PioneClientRunner.test(self) do |runner|
78
- runner.title = "should get a result of example/PegasusWMS/Merge"
79
- runner.args = ["example/PegasusWMS/Merge/", *runner.default_arguments]
80
- runner.run do |base|
81
- (base + "output" + "binaries.txt").should.exist
82
- (base + "output" + "binaries.txt").size.should > 0
83
- end
84
- end
85
- end
86
-
87
- describe "example/PegasusWMS/Pipeline" do
88
- if TestHelper::InternetConnectivity.ok?
89
- TestHelper::PioneClientRunner.test(self) do |runner|
90
- runner.title = "should get a result of example/PegasusWMS/Pipeline"
91
- runner.args = ["example/PegasusWMS/Pipeline/", *runner.default_arguments]
92
- runner.run do |base|
93
- (base + "output" + "count.txt").should.exist
94
- (base + "output" + "count.txt").size.should > 0
95
- end
96
- end
97
- else
98
- puts " * ignored because of no internet connection"
99
- end
100
- end
101
-
102
- describe "example/PegasusWMS/Split" do
103
- if TestHelper::InternetConnectivity.ok?
104
- TestHelper::PioneClientRunner.test(self) do |runner|
105
- runner.title = "should get a result of example/PegasusWMS/Split"
106
- runner.args = ["example/PegasusWMS/Split/", *runner.default_arguments]
107
- runner.run do |base|
108
- (base + "output" + "count.txt.a").should.exist
109
- (base + "output" + "count.txt.a").size.should > 0
110
- (base + "output" + "count.txt.b").should.exist
111
- (base + "output" + "count.txt.b").size.should > 0
112
- (base + "output" + "count.txt.c").should.exist
113
- (base + "output" + "count.txt.c").size.should > 0
114
- (base + "output" + "count.txt.d").should.exist
115
- (base + "output" + "count.txt.d").size.should > 0
116
- end
117
- end
118
- else
119
- puts " * ignored because of no internet connection"
120
- end
121
- end
122
-
123
- describe "example/OddSelector" do
124
- TestHelper::PioneClientRunner.test(self) do |runner|
125
- runner.title = "should get a result of example/OddSelector"
126
- runner.args = ["example/OddSelector", "--rehearse", *runner.default_arguments]
127
- runner.run do |base|
128
- (base + "output" + "1.res").should.exist
129
- (base + "output" + "2.res").should.not.exist
130
- (base + "output" + "3.res").should.exist
131
- (base + "output" + "4.res").should.not.exist
132
- (base + "output" + "5.res").should.exist
133
- (base + "output" + "6.res").should.not.exist
134
- (base + "output" + "7.res").should.exist
135
- (base + "output" + "8.res").should.not.exist
136
- (base + "output" + "9.res").should.exist
137
- (base + "output" + "10.res").should.not.exist
138
- end
139
- end
140
- end
141
-
142
- describe "example/SerialProcessing" do
143
- TestHelper::PioneClientRunner.test(self) do |runner|
144
- runner.title = "should get a result of example/SerialProcessing"
145
- runner.args = ["example/SerialProcessing", "--rehearse", *runner.default_arguments]
146
- runner.run do |base|
147
- (base + "output" + "1.a").should.exist
148
- (base + "output" + "2.a").should.exist
149
- (base + "output" + "3.a").should.exist
150
- (base + "output" + "4.a").should.exist
151
- (base + "output" + "1.b").should.exist
152
- (base + "output" + "2.b").should.exist
153
- (base + "output" + "3.b").should.exist
154
- (base + "output" + "4.b").should.exist
155
- (base + "output" + "1.a").mtime.should <= (base + "output" + "2.a").mtime
156
- (base + "output" + "2.a").mtime.should <= (base + "output" + "3.a").mtime
157
- (base + "output" + "3.a").mtime.should <= (base + "output" + "4.a").mtime
158
- (base + "output" + "4.a").mtime.should <= (base + "output" + "1.b").mtime
159
- (base + "output" + "1.b").mtime.should <= (base + "output" + "2.b").mtime
160
- (base + "output" + "2.b").mtime.should <= (base + "output" + "3.b").mtime
161
- (base + "output" + "3.b").mtime.should <= (base + "output" + "4.b").mtime
162
- end
163
- end
164
- end
165
-
166
- describe "example/MakePair" do
167
- TestHelper::PioneClientRunner.test(self) do |runner|
168
- runner.title = "should get a result of example/MakePair"
169
- runner.args = ["example/MakePair", "--rehearse", "case1", *runner.default_arguments]
170
- runner.run do |base|
171
- 1.upto(5) do |i|
172
- 1.upto(5) do |ii|
173
- comb = (base + "output" + "comb-%s-%s.pair" % [i, ii])
174
- i < ii ? comb.should.exist : comb.should.not.exist
175
- perm = (base + "output" + "perm-%s-%s.pair" % [i, ii])
176
- i != ii ? perm.should.exist : perm.should.not.exist
177
- succ = (base + "output" + "succ-%s-%s.pair" % [i, ii])
178
- ii - i == 1 ? succ.should.exist : succ.should.not.exist
179
- end
180
- end
181
- end
182
- end
183
- end
184
-
185
- describe "example/SelectRuleByParam" do
186
- TestHelper::PioneClientRunner.test(self) do |runner|
187
- runner.title = "should get a result of scenario a of example/SelectRuleByParam"
188
- runner.args = ["example/SelectRuleByParam", "--rehearse", "Select A", *runner.default_arguments]
189
- runner.run do |base|
190
- (base + "output" + "message.txt").should.exist
191
- (base + "output" + "message.txt").read.chomp.should == "This is rule A."
192
- end
193
- end
194
-
195
- TestHelper::PioneClientRunner.test(self) do |runner|
196
- runner.title = "should get a result of scenario b of example/SelectRuleByParam"
197
- runner.args = ["example/SelectRuleByParam", "--rehearse", "Select B", *runner.default_arguments]
198
- runner.run do |base|
199
- (base + "output" + "message.txt").should.exist
200
- (base + "output" + "message.txt").read.chomp.should == "This is rule B."
201
- end
202
- end
203
-
204
- TestHelper::PioneClientRunner.test(self) do |runner|
205
- runner.title = "should get a result of scenario c of example/SelectRuleByParam"
206
- runner.args = ["example/SelectRuleByParam", "--rehearse", "Select C", *runner.default_arguments]
207
- runner.run do |base|
208
- (base + "output" + "message.txt").should.exist
209
- (base + "output" + "message.txt").read.chomp.should == "This is rule C."
210
- end
211
- end
212
- end
213
-
214
- describe "example/FeatureExample" do
215
- TestHelper::PioneClientRunner.test(self) do |runner|
216
- runner.title = "should get a result of example/FeatureExample"
217
- runner.args = ["example/FeatureExample", "--feature", "^X", *runner.default_arguments]
218
- runner.run do |base|
219
- (base + "output" + "message.txt").should.exist
220
- (base + "output" + "message.txt").read.chomp.should == "I can take the task."
221
- end
222
- end
223
-
224
- TestHelper::PioneClientRunner.test(self) do |runner|
225
- runner.title = "should timeout with feature `*` in processing example/FeatureExample"
226
- runner.args = ["example/FeatureExample", "--feature", "*", *runner.default_arguments]
227
- runner.timeout(5)
228
- end
229
- end
230
-
231
- describe "example/Sum" do
232
- TestHelper::PioneClientRunner.test(self) do |runner|
233
- runner.title = "should get a result of example/Sum"
234
- runner.args = ["example/Sum", "--rehearse", *runner.default_arguments]
235
- runner.run do |base|
236
- (base + "output" + "sum.txt").should.exist
237
- end
238
- end
239
- end
240
-
241
- describe "example/ActionError" do
242
- TestHelper::PioneClientRunner.test(self) do |runner|
243
- runner.title = "should fail in execution of example/ActionError"
244
- runner.args = ["example/ActionError", *runner.default_arguments]
245
- runner.fail
246
- end
247
- end
248
52
  end
249
53
  end
@@ -0,0 +1,9 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/ActionError" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should fail in execution of example/ActionError"
6
+ runner.args = ["example/ActionError", *runner.default_arguments]
7
+ runner.fail
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/FeatureExample" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of example/FeatureExample"
6
+ runner.args = ["example/FeatureExample", "--feature", "^X", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "message.txt").should.exist
9
+ (base + "output" + "message.txt").read.chomp.should == "I can take the task."
10
+ end
11
+ end
12
+
13
+ TestHelper::PioneClientRunner.test(self) do |runner|
14
+ runner.title = "should timeout with feature `*` in processing example/FeatureExample"
15
+ runner.args = ["example/FeatureExample", "--feature", "*", *runner.default_arguments]
16
+ runner.timeout(5)
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/Fib" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result with no parameters (default fib(3))"
6
+ runner.args = ["example/Fib/Fib.pione", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "result.txt").should.exist
9
+ (base + "output" + "result.txt").read.should.start_with "2"
10
+ end
11
+ end
12
+
13
+ # FIXME: this test is unstable... maybe there are bugs
14
+
15
+ # it "should get a result of fib(10)" do
16
+ # path = Temppath.create
17
+ # args = ["example/Fib/Fib.pione", "-o", path.to_s, "--params", "{NUM: 10}"]
18
+ # res = TestHelper::Command.succeed do
19
+ # Pione::Command::PioneClient.run(args)
20
+ # end
21
+ # Location[path + "result.txt"].should.exist
22
+ # Location[path + "result.txt"].read.should.start_with "55"
23
+ # end
24
+ end
@@ -0,0 +1,15 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/HelloWorld" do
4
+ before do
5
+ @cmd = Command::PioneClient
6
+ end
7
+
8
+ it "should process" do
9
+ path = Temppath.create
10
+ cmd = @cmd.new(["example/HelloWorld/", "--base", path.to_s])
11
+ res = Rootage::ScenarioTest.succeed(cmd)
12
+ Location[path + "output" + "message.txt"].should.exist
13
+ Location[path + "output" + "message.txt"].read.should.start_with "Hello, world!"
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/MakePair" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of example/MakePair"
6
+ runner.args = ["example/MakePair", "--rehearse", "case1", *runner.default_arguments]
7
+ runner.run do |base|
8
+ 1.upto(5) do |i|
9
+ 1.upto(5) do |ii|
10
+ comb = (base + "output" + "comb-%s-%s.pair" % [i, ii])
11
+ i < ii ? comb.should.exist : comb.should.not.exist
12
+ perm = (base + "output" + "perm-%s-%s.pair" % [i, ii])
13
+ i != ii ? perm.should.exist : perm.should.not.exist
14
+ succ = (base + "output" + "succ-%s-%s.pair" % [i, ii])
15
+ ii - i == 1 ? succ.should.exist : succ.should.not.exist
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/OddSelector" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of example/OddSelector"
6
+ runner.args = ["example/OddSelector", "--rehearse", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "1.res").should.exist
9
+ (base + "output" + "2.res").should.not.exist
10
+ (base + "output" + "3.res").should.exist
11
+ (base + "output" + "4.res").should.not.exist
12
+ (base + "output" + "5.res").should.exist
13
+ (base + "output" + "6.res").should.not.exist
14
+ (base + "output" + "7.res").should.exist
15
+ (base + "output" + "8.res").should.not.exist
16
+ (base + "output" + "9.res").should.exist
17
+ (base + "output" + "10.res").should.not.exist
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/PegasusWMS/Merge" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of example/PegasusWMS/Merge"
6
+ runner.args = ["example/PegasusWMS/Merge/", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "binaries.txt").should.exist
9
+ (base + "output" + "binaries.txt").size.should > 0
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/PegasusWMS/Pipeline" do
4
+ if TestHelper::InternetConnectivity.ok?
5
+ TestHelper::PioneClientRunner.test(self) do |runner|
6
+ runner.title = "should get a result of example/PegasusWMS/Pipeline"
7
+ runner.args = ["example/PegasusWMS/Pipeline/", *runner.default_arguments]
8
+ runner.run do |base|
9
+ (base + "output" + "count.txt").should.exist
10
+ (base + "output" + "count.txt").size.should > 0
11
+ end
12
+ end
13
+ else
14
+ puts " * ignored because of no internet connection"
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/PegasusWMS/Split" do
4
+ if TestHelper::InternetConnectivity.ok?
5
+ TestHelper::PioneClientRunner.test(self) do |runner|
6
+ runner.title = "should get a result of example/PegasusWMS/Split"
7
+ runner.args = ["example/PegasusWMS/Split/", *runner.default_arguments]
8
+ runner.run do |base|
9
+ (base + "output" + "count.txt.a").should.exist
10
+ (base + "output" + "count.txt.a").size.should > 0
11
+ (base + "output" + "count.txt.b").should.exist
12
+ (base + "output" + "count.txt.b").size.should > 0
13
+ (base + "output" + "count.txt.c").should.exist
14
+ (base + "output" + "count.txt.c").size.should > 0
15
+ (base + "output" + "count.txt.d").should.exist
16
+ (base + "output" + "count.txt.d").size.should > 0
17
+ end
18
+ end
19
+ else
20
+ puts " * ignored because of no internet connection"
21
+ end
22
+ end
@@ -0,0 +1,30 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/SelectRuleByParam" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of scenario a of example/SelectRuleByParam"
6
+ runner.args = ["example/SelectRuleByParam", "--rehearse", "Select A", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "message.txt").should.exist
9
+ (base + "output" + "message.txt").read.chomp.should == "This is rule A."
10
+ end
11
+ end
12
+
13
+ TestHelper::PioneClientRunner.test(self) do |runner|
14
+ runner.title = "should get a result of scenario b of example/SelectRuleByParam"
15
+ runner.args = ["example/SelectRuleByParam", "--rehearse", "Select B", *runner.default_arguments]
16
+ runner.run do |base|
17
+ (base + "output" + "message.txt").should.exist
18
+ (base + "output" + "message.txt").read.chomp.should == "This is rule B."
19
+ end
20
+ end
21
+
22
+ TestHelper::PioneClientRunner.test(self) do |runner|
23
+ runner.title = "should get a result of scenario c of example/SelectRuleByParam"
24
+ runner.args = ["example/SelectRuleByParam", "--rehearse", "Select C", *runner.default_arguments]
25
+ runner.run do |base|
26
+ (base + "output" + "message.txt").should.exist
27
+ (base + "output" + "message.txt").read.chomp.should == "This is rule C."
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/SerialProcessing" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of example/SerialProcessing"
6
+ runner.args = ["example/SerialProcessing", "--rehearse", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "1.a").should.exist
9
+ (base + "output" + "2.a").should.exist
10
+ (base + "output" + "3.a").should.exist
11
+ (base + "output" + "4.a").should.exist
12
+ (base + "output" + "1.b").should.exist
13
+ (base + "output" + "2.b").should.exist
14
+ (base + "output" + "3.b").should.exist
15
+ (base + "output" + "4.b").should.exist
16
+ (base + "output" + "1.a").mtime.should <= (base + "output" + "2.a").mtime
17
+ (base + "output" + "2.a").mtime.should <= (base + "output" + "3.a").mtime
18
+ (base + "output" + "3.a").mtime.should <= (base + "output" + "4.a").mtime
19
+ (base + "output" + "4.a").mtime.should <= (base + "output" + "1.b").mtime
20
+ (base + "output" + "1.b").mtime.should <= (base + "output" + "2.b").mtime
21
+ (base + "output" + "2.b").mtime.should <= (base + "output" + "3.b").mtime
22
+ (base + "output" + "3.b").mtime.should <= (base + "output" + "4.b").mtime
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ require 'pione/test-helper'
2
+
3
+ describe "example/Sum" do
4
+ TestHelper::PioneClientRunner.test(self) do |runner|
5
+ runner.title = "should get a result of example/Sum"
6
+ runner.args = ["example/Sum", "--rehearse", *runner.default_arguments]
7
+ runner.run do |base|
8
+ (base + "output" + "sum.txt").should.exist
9
+ end
10
+ end
11
+ end
@@ -87,7 +87,7 @@ describe 'Pione::RuleEngine::DataFinder' do
87
87
  }
88
88
 
89
89
  # test
90
- enum = Enumerator.new(finder, :find, :input, query, @env)
90
+ enum = finder.to_enum(:find, :input, query, @env)
91
91
  enum.to_a.map{|env, combination| combination }.should == results
92
92
  end
93
93
  end
@@ -19,7 +19,11 @@ describe "Pione::Util::ProcessInfo" do
19
19
  end
20
20
 
21
21
  after do
22
- @info.kill if @info.alive?
22
+ begin
23
+ @info.kill if @info.alive?
24
+ rescue
25
+ # ignore
26
+ end
23
27
  end
24
28
 
25
29
  it "should get pid" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pione
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.alpha.1
4
+ version: 0.5.0.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Yamaguchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-04 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -1311,6 +1311,18 @@ files:
1311
1311
  - test/command/spec_pione-package-update.rb
1312
1312
  - test/command/spec_pione-package.rb
1313
1313
  - test/command/spec_pione-val.rb
1314
+ - test/example/spec_ActionError.rb
1315
+ - test/example/spec_FeatureExample.rb
1316
+ - test/example/spec_Fib.rb
1317
+ - test/example/spec_HelloWorld.rb
1318
+ - test/example/spec_MakePair.rb
1319
+ - test/example/spec_OddSelector.rb
1320
+ - test/example/spec_PegasusWMSMerge.rb
1321
+ - test/example/spec_PegasusWMSPipeline.rb
1322
+ - test/example/spec_PegasusWMSSplit.rb
1323
+ - test/example/spec_SelectRuleByParam.rb
1324
+ - test/example/spec_SerialProcessing.rb
1325
+ - test/example/spec_Sum.rb
1314
1326
  - test/global/spec_config.rb
1315
1327
  - test/global/spec_item.rb
1316
1328
  - test/lang/data/boolean.yml
@@ -1595,7 +1607,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1595
1607
  version: 1.3.1
1596
1608
  requirements: []
1597
1609
  rubyforge_project:
1598
- rubygems_version: 2.1.11
1610
+ rubygems_version: 2.4.5
1599
1611
  signing_key:
1600
1612
  specification_version: 4
1601
1613
  summary: rule-based workflow engine
@@ -1663,6 +1675,18 @@ test_files:
1663
1675
  - test/command/spec_pione-package-update.rb
1664
1676
  - test/command/spec_pione-package.rb
1665
1677
  - test/command/spec_pione-val.rb
1678
+ - test/example/spec_ActionError.rb
1679
+ - test/example/spec_FeatureExample.rb
1680
+ - test/example/spec_Fib.rb
1681
+ - test/example/spec_HelloWorld.rb
1682
+ - test/example/spec_MakePair.rb
1683
+ - test/example/spec_OddSelector.rb
1684
+ - test/example/spec_PegasusWMSMerge.rb
1685
+ - test/example/spec_PegasusWMSPipeline.rb
1686
+ - test/example/spec_PegasusWMSSplit.rb
1687
+ - test/example/spec_SelectRuleByParam.rb
1688
+ - test/example/spec_SerialProcessing.rb
1689
+ - test/example/spec_Sum.rb
1666
1690
  - test/global/spec_config.rb
1667
1691
  - test/global/spec_item.rb
1668
1692
  - test/lang/data/boolean.yml