pione 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/.travis.yml +3 -0
- data/History.txt +15 -0
- data/Rakefile +4 -0
- data/doc/man/pione-action-list.md +23 -0
- data/doc/man/pione-action.md +37 -0
- data/doc/man/pione-clean.md +56 -0
- data/doc/man/pione-compiler.md +39 -0
- data/doc/man/pione-update-package-info.md +38 -0
- data/example/DeferredChoice/DeferredChoice.pione +6 -4
- data/example/DeferredChoice/pione-package.json +15 -0
- data/example/FeatureExample/FeatureExample.pione +2 -0
- data/example/FeatureExample/pione-package.json +15 -0
- data/example/LoopByTouch/LoopByTouch.pione +2 -0
- data/example/LoopByTouch/pione-package.json +18 -0
- data/example/LucasNumber/LucasNumber.pione +6 -4
- data/example/LucasNumber/pione-package.json +15 -0
- data/example/MakePair/MakePair.pione +2 -0
- data/example/MakePair/pione-package.json +17 -0
- data/example/MakePair/scenario/case1/Scenario.pione +1 -0
- data/example/MakePair/scenario/case1/pione-scenario.json +47 -0
- data/example/MakePair/scenario/case2/Scenario.pione +1 -0
- data/example/MakePair/scenario/case2/pione-scenario.json +22 -0
- data/example/MakePair/scenario/case3/Scenario.pione +1 -0
- data/example/MakePair/scenario/case3/pione-scenario.json +43 -0
- data/example/OddSelector/OddSelector.pione +2 -0
- data/example/OddSelector/pione-package.json +15 -0
- data/example/OddSelector/scenario/Scenario.pione +1 -0
- data/example/OddSelector/{data → scenario/input}/1.i +0 -0
- data/example/OddSelector/{data → scenario/input}/10.i +0 -0
- data/example/OddSelector/{data → scenario/input}/2.i +0 -0
- data/example/OddSelector/{data → scenario/input}/3.i +0 -0
- data/example/OddSelector/{data → scenario/input}/4.i +0 -0
- data/example/OddSelector/{data → scenario/input}/5.i +0 -0
- data/example/OddSelector/{data → scenario/input}/6.i +0 -0
- data/example/OddSelector/{data → scenario/input}/7.i +0 -0
- data/example/OddSelector/{data → scenario/input}/8.i +0 -0
- data/example/OddSelector/{data → scenario/input}/9.i +0 -0
- data/example/OddSelector/scenario/output/1.res +0 -0
- data/example/OddSelector/scenario/output/3.res +0 -0
- data/example/OddSelector/scenario/output/5.res +0 -0
- data/example/OddSelector/scenario/output/7.res +0 -0
- data/example/OddSelector/scenario/output/9.res +0 -0
- data/example/OddSelector/scenario/pione-scenario.json +23 -0
- data/example/PegasusWMS/Merge/Merge.pione +3 -1
- data/example/PegasusWMS/Merge/pione-package.json +15 -0
- data/example/PegasusWMS/Pipeline/Pipeline.pione +2 -0
- data/example/PegasusWMS/Pipeline/pione-package.json +15 -0
- data/example/PegasusWMS/Split/Split.pione +2 -0
- data/example/PegasusWMS/Split/pione-package.json +15 -0
- data/example/{AbstractRule/AbstractRule.pione → SelectRuleByParam/SelectRuleByParam.pione} +4 -2
- data/example/SelectRuleByParam/pione-package.json +17 -0
- data/example/SelectRuleByParam/scenario/a/Scenario.pione +2 -0
- data/example/{AbstractRule → SelectRuleByParam}/scenario/a/output/message.txt +0 -0
- data/example/SelectRuleByParam/scenario/a/pione-scenario.json +10 -0
- data/example/SelectRuleByParam/scenario/b/Scenario.pione +2 -0
- data/example/{AbstractRule → SelectRuleByParam}/scenario/b/output/message.txt +0 -0
- data/example/SelectRuleByParam/scenario/b/pione-scenario.json +10 -0
- data/example/SelectRuleByParam/scenario/c/Scenario.pione +2 -0
- data/example/{AbstractRule → SelectRuleByParam}/scenario/c/output/message.txt +0 -0
- data/example/SelectRuleByParam/scenario/c/pione-scenario.json +10 -0
- data/example/Sum/Sum.pione +23 -21
- data/example/Sum/pione-package.json +15 -0
- data/example/Sum/scenario/Scenario.pione +1 -0
- data/example/Sum/{input → scenario/input}/list.txt +0 -0
- data/example/Sum/scenario/output/sum.txt +6 -0
- data/example/Sum/scenario/pione-scenario.json +10 -0
- data/lib/pione/agent/agent-exception.rb +11 -0
- data/lib/pione/agent/process-manager.rb +19 -7
- data/lib/pione/agent/task-worker.rb +2 -2
- data/lib/pione/command/option.rb +0 -1
- data/lib/pione/command/pione-action-list.rb +49 -0
- data/lib/pione/command/pione-action.rb +83 -0
- data/lib/pione/command/pione-client.rb +34 -10
- data/lib/pione/command/pione-compiler.rb +19 -1
- data/lib/pione/command/pione-package.rb +2 -0
- data/lib/pione/command/pione-task-worker.rb +3 -1
- data/lib/pione/command/pione-update-package-info.rb +53 -0
- data/lib/pione/command.rb +6 -4
- data/lib/pione/global/tuple-space-notifier-variable.rb +1 -1
- data/lib/pione/lang/environment.rb +47 -16
- data/lib/pione/lang/parameters.rb +6 -0
- data/lib/pione/literate-action/document.rb +25 -0
- data/lib/pione/literate-action/handler.rb +24 -0
- data/lib/pione/literate-action/parser.rb +54 -0
- data/lib/pione/literate-action.rb +10 -0
- data/lib/pione/location/data-location.rb +11 -3
- data/lib/pione/location/dropbox-location.rb +2 -0
- data/lib/pione/location/local-location.rb +4 -0
- data/lib/pione/package/package-exception.rb +17 -1
- data/lib/pione/package/package-handler.rb +13 -4
- data/lib/pione/package/scenario-handler.rb +9 -3
- data/lib/pione/package/scenario-info.rb +4 -3
- data/lib/pione/package/scenario-scanner.rb +11 -7
- data/lib/pione/rule-engine/basic-handler.rb +1 -1
- data/lib/pione/rule-engine/flow-handler.rb +6 -5
- data/lib/pione/test-helper/command-helper.rb +44 -1
- data/lib/pione/test-helper/internet-connectivity.rb +10 -0
- data/lib/pione/test-helper.rb +11 -10
- data/lib/pione/util/digest.rb +1 -1
- data/lib/pione/util/id.rb +1 -1
- data/lib/pione/util/indentation.rb +1 -1
- data/lib/pione/util/last-time.rb +20 -0
- data/lib/pione/util/misc.rb +7 -1
- data/lib/pione/util/pnml-compiler.rb +84 -13
- data/lib/pione/util.rb +1 -0
- data/lib/pione/version.rb +1 -1
- data/lib/pione.rb +17 -15
- data/man/pione-action-list.1 +23 -0
- data/man/pione-action.1 +45 -0
- data/man/pione-compiler.1 +48 -0
- data/man/pione-update-package-info.1 +43 -0
- data/pione.gemspec +1 -0
- data/test/command/spec_pione-action-list.rb +15 -0
- data/test/command/spec_pione-action.rb +24 -0
- data/test/command/spec_pione-client.rb +189 -0
- data/test/command/spec_pione-compiler.rb +28 -1
- data/test/command/spec_pione-update-package-info.rb +66 -0
- data/test/lang/data/literal-parser.yml +1 -0
- data/test/lang/spec_environment.rb +19 -0
- data/test/literate-action/data/D1.md +25 -0
- data/test/literate-action/data/HelloWorld.md +11 -0
- data/test/literate-action/spec_document.rb +20 -0
- data/test/literate-action/spec_handler.rb +28 -0
- data/test/literate-action/spec_parser.rb +51 -0
- data/test/package/spec_scenario-info.rb +2 -2
- data/test/package/spec_scenario-scanner.rb +3 -3
- data/test/util/data/pnml/Sequence.pnml +135 -135
- data/test/util/spec_pnml-compiler.rb +20 -9
- metadata +102 -39
- data/example/AbstractRule/package.yml +0 -7
- data/example/AbstractRule/scenario/a/scenario.yml +0 -4
- data/example/AbstractRule/scenario/b/scenario.yml +0 -4
- data/example/AbstractRule/scenario/c/scenario.yml +0 -4
- data/example/HelloWorld/package.yml +0 -6
- data/example/HelloWorld/scenario/scenario.yml +0 -3
- data/example/MakePair/package.yml +0 -8
- data/example/MakePair/scenario/case1/scenario.yml +0 -42
- data/example/MakePair/scenario/case2/scenario.yml +0 -17
- data/example/MakePair/scenario/case3/scenario.yml +0 -39
- data/example/PegasusWMS/Merge/package.yml +0 -2
- data/example/PegasusWMS/Pipeline/package.yml +0 -2
- data/example/PegasusWMS/Split/package.yml +0 -2
- data/example/SyntaxError/call_rule_error.pione +0 -6
- data/example/SyntaxError/feature_line_error.pione +0 -7
- data/example/SyntaxError/flow_block_error.pione +0 -5
- data/example/SyntaxError/input_line_error.pione +0 -6
- data/example/SyntaxError/invalid_rule_name.pione +0 -6
- data/example/SyntaxError/output_line_error.pione +0 -6
- data/example/SyntaxError/param_line_error.pione +0 -7
- data/example/SyntaxError/variable-binding-error.pione +0 -11
@@ -5,9 +5,36 @@ TestHelper.scope do |this|
|
|
5
5
|
|
6
6
|
describe Pione::Command::PioneCompiler do
|
7
7
|
it "should compile from PNML to PIONE document" do
|
8
|
-
|
8
|
+
TestHelper::Command.succeed do
|
9
9
|
Command::PioneCompiler.run [this::PNML1.path.to_s]
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
it "should compile with package name" do
|
14
|
+
res = TestHelper::Command.succeed do
|
15
|
+
Command::PioneCompiler.run [this::PNML1.path.to_s, "--name", "Sequence"]
|
16
|
+
end
|
17
|
+
res.stdout.string.should.include "@ PackageName :: \"Sequence\""
|
18
|
+
res.stdout.string.should.not.include "@ Editor ::"
|
19
|
+
res.stdout.string.should.not.include "@ Tag ::"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should compile with package name and editor" do
|
23
|
+
res = TestHelper::Command.succeed do
|
24
|
+
Command::PioneCompiler.run [this::PNML1.path.to_s, "--name", "Sequence", "--editor", "yamaguchi"]
|
25
|
+
end
|
26
|
+
res.stdout.string.should.include "@ PackageName :: \"Sequence\""
|
27
|
+
res.stdout.string.should.include "@ Editor :: \"yamaguchi\""
|
28
|
+
res.stdout.string.should.not.include "@ Tag ::"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should compile with package name, editor, and tag" do
|
32
|
+
res = TestHelper::Command.succeed do
|
33
|
+
Command::PioneCompiler.run [this::PNML1.path.to_s, "--name", "Sequence", "--editor", "yamaguchi", "--tag", "test"]
|
34
|
+
end
|
35
|
+
res.stdout.string.should.include "@ PackageName :: \"Sequence\""
|
36
|
+
res.stdout.string.should.include "@ Editor :: \"yamaguchi\""
|
37
|
+
res.stdout.string.should.include "@ Tag :: \"test\""
|
38
|
+
end
|
12
39
|
end
|
13
40
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
describe Pione::Command::PioneUpdatePackageInfo do
|
4
|
+
before do
|
5
|
+
# package
|
6
|
+
@location = Location[Temppath.mkdir]
|
7
|
+
|
8
|
+
# PIONE document
|
9
|
+
(@location + "TestPioneUpdatePackageInfo").write(<<-PIONE)
|
10
|
+
.@ PackageName :: "TestPioneUpdatePackageInfo"
|
11
|
+
|
12
|
+
Rule Main
|
13
|
+
input 'i'
|
14
|
+
output 'o'.touch
|
15
|
+
End
|
16
|
+
PIONE
|
17
|
+
|
18
|
+
# bin
|
19
|
+
(@location + "bin" + "test.sh").write("echo 'Hello, world!' > o")
|
20
|
+
|
21
|
+
# scenario
|
22
|
+
(@location + "scenario").mkdir
|
23
|
+
|
24
|
+
# scenario document
|
25
|
+
(@location + "scenario" + "Scenario.pione").write(<<-PIONE)
|
26
|
+
.@ ScenarioName :: "Test"
|
27
|
+
PIONE
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should update package info files" do
|
31
|
+
args = [@location.path.to_s]
|
32
|
+
TestHelper::Command.succeed do
|
33
|
+
Pione::Command::PioneUpdatePackageInfo.run(args)
|
34
|
+
end
|
35
|
+
(@location + "pione-package.json").should.exist
|
36
|
+
(@location + "pione-package.json").size.should > 0
|
37
|
+
(@location + "scenario" + "pione-scenario.json").should.exist
|
38
|
+
(@location + "scenario" + "pione-scenario.json").size.should > 0
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should not update package info files because they are newer than other files" do
|
42
|
+
ptime = (@location + "pione-package.json").write("").mtime
|
43
|
+
stime = (@location + "scenario" + "pione-scenario.json").write("").mtime
|
44
|
+
|
45
|
+
args = [@location.path.to_s]
|
46
|
+
TestHelper::Command.succeed do
|
47
|
+
Pione::Command::PioneUpdatePackageInfo.run(args)
|
48
|
+
end
|
49
|
+
|
50
|
+
(@location + "pione-package.json").mtime.should == ptime
|
51
|
+
(@location + "scenario" + "pione-scenario.json").mtime.should == stime
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should update package info files by 'force' option" do
|
55
|
+
ptime = (@location + "pione-package.json").write("").mtime
|
56
|
+
stime = (@location + "scenario" + "pione-scenario.json").write("").mtime
|
57
|
+
|
58
|
+
args = [@location.path.to_s, "--force"]
|
59
|
+
TestHelper::Command.succeed do
|
60
|
+
Pione::Command::PioneUpdatePackageInfo.run(args)
|
61
|
+
end
|
62
|
+
|
63
|
+
(@location + "pione-package.json").mtime.should > ptime
|
64
|
+
(@location + "scenario" + "pione-scenario.json").mtime.should > stime
|
65
|
+
end
|
66
|
+
end
|
@@ -18,6 +18,25 @@ describe 'Pione::Lang::Environment' do
|
|
18
18
|
TestHelper::Lang.expr!(@env, "$p.var($y)").should == Lang::IntegerSequence.of(2)
|
19
19
|
end
|
20
20
|
|
21
|
+
it 'should get variable names by package ID' do
|
22
|
+
@env = @env.setup_new_package("A")
|
23
|
+
TestHelper::Lang.declaration!(@env, "$a := 1")
|
24
|
+
@env = @env.setup_new_package("B", ["A"])
|
25
|
+
TestHelper::Lang.declaration!(@env, "$b := 2")
|
26
|
+
@env = @env.setup_new_package("C", ["B"])
|
27
|
+
TestHelper::Lang.declaration!(@env, "$c := 3")
|
28
|
+
@env = @env.setup_new_package("D")
|
29
|
+
TestHelper::Lang.declaration!(@env, "$d := 4")
|
30
|
+
@env = @env.setup_new_package("E", ["C", "D"])
|
31
|
+
TestHelper::Lang.declaration!(@env, "$e := 4")
|
32
|
+
|
33
|
+
@env.variable_table.select_names_by(@env, "A").sort.should == ["a"]
|
34
|
+
@env.variable_table.select_names_by(@env, "B").sort.should == ["a", "b"]
|
35
|
+
@env.variable_table.select_names_by(@env, "C").sort.should == ["a", "b", "c"]
|
36
|
+
@env.variable_table.select_names_by(@env, "D").sort.should == ["d"]
|
37
|
+
@env.variable_table.select_names_by(@env, "E").sort.should == ["a", "b", "c", "d", "e"]
|
38
|
+
end
|
39
|
+
|
21
40
|
it 'should append new package' do
|
22
41
|
# append a package
|
23
42
|
TestHelper::Lang.declaration!(@env, "package $p <- &Test")
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
TestHelper.scope do |this|
|
4
|
+
this::DIR = Location[File.dirname(__FILE__)] + "data"
|
5
|
+
this::D1 = this::DIR + "D1.md"
|
6
|
+
|
7
|
+
describe Pione::LiterateAction::Document do
|
8
|
+
it "should get action names" do
|
9
|
+
doc = LiterateAction::Document.load(this::D1)
|
10
|
+
doc.action_names.sort.should == ["Name1", "Name2"]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should get action handler by name" do
|
14
|
+
doc = LiterateAction::Document.load(this::D1)
|
15
|
+
doc.find("Name1").should.kind_of LiterateAction::Handler
|
16
|
+
doc.find("Name2").should.kind_of LiterateAction::Handler
|
17
|
+
doc.find("Name3").should.nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
TestHelper.scope do |this|
|
4
|
+
this::DIR = Location[File.dirname(__FILE__)] + "data"
|
5
|
+
this::D1 = this::DIR + "D1.md"
|
6
|
+
|
7
|
+
describe Pione::LiterateAction::Handler do
|
8
|
+
it "should get a text" do
|
9
|
+
doc = LiterateAction::Document.load(this::D1)
|
10
|
+
doc.find("Name1").tap do |handler|
|
11
|
+
handler.textize(nil).chomp.should == "echo A"
|
12
|
+
end
|
13
|
+
doc.find("Name2").tap do |handler|
|
14
|
+
handler.textize(nil).chomp.should == "puts \"A\"\nputs \"B\""
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should execute" do
|
19
|
+
doc = LiterateAction::Document.load(this::D1)
|
20
|
+
doc.find("Name1").tap do |handler|
|
21
|
+
handler.execute(nil).chomp.should == "A"
|
22
|
+
end
|
23
|
+
doc.find("Name2").tap do |handler|
|
24
|
+
handler.execute(nil).chomp.should == "A\nB"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
describe Pione::LiterateAction::Parser do
|
4
|
+
it "should parse" do
|
5
|
+
parsed = LiterateAction::Parser.parse(Util::Indentation.cut(<<-ACTION))
|
6
|
+
# Titile
|
7
|
+
|
8
|
+
desc
|
9
|
+
|
10
|
+
## Name1
|
11
|
+
|
12
|
+
desc
|
13
|
+
|
14
|
+
```sh
|
15
|
+
A
|
16
|
+
```
|
17
|
+
|
18
|
+
## Name2
|
19
|
+
|
20
|
+
desc1
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
A
|
24
|
+
```
|
25
|
+
|
26
|
+
desc2
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
B
|
30
|
+
```
|
31
|
+
ACTION
|
32
|
+
parsed.keys.sort.should == ["Name1", "Name2"]
|
33
|
+
parsed["Name1"][:lang].should == "sh"
|
34
|
+
parsed["Name1"][:content].should == "A\n"
|
35
|
+
parsed["Name2"][:lang].should == "ruby"
|
36
|
+
parsed["Name2"][:content].should == "A\nB\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should get a rule name without needless spaces" do
|
40
|
+
parsed = LiterateAction::Parser.parse(Util::Indentation.cut(<<-ACTION))
|
41
|
+
# Title
|
42
|
+
|
43
|
+
## Test
|
44
|
+
|
45
|
+
``` sh
|
46
|
+
A
|
47
|
+
```
|
48
|
+
ACTION
|
49
|
+
parsed.keys.first.should == "Test"
|
50
|
+
end
|
51
|
+
end
|
@@ -4,12 +4,12 @@ describe Pione::Package::ScenarioInfo do
|
|
4
4
|
it "should generate a JSON and read it" do
|
5
5
|
info = Package::ScenarioInfo.read(JSON.generate(Package::ScenarioInfo.new(
|
6
6
|
name: "S1",
|
7
|
-
|
7
|
+
textual_param_sets: "{}",
|
8
8
|
inputs: ["input/i1", "input/i2", "input/i3"],
|
9
9
|
outputs: ["output/o1", "output/o2", "output/o3"]
|
10
10
|
)))
|
11
11
|
info.name.should == "S1"
|
12
|
-
info.
|
12
|
+
info.textual_param_sets.should == "{}"
|
13
13
|
info.inputs.should == ["input/i1", "input/i2", "input/i3"]
|
14
14
|
info.outputs.should == ["output/o1", "output/o2", "output/o3"]
|
15
15
|
end
|
@@ -29,7 +29,7 @@ TestHelper.scope do |this|
|
|
29
29
|
it "should scan scenario direcotry: S1" do
|
30
30
|
s1 = Package::ScenarioScanner.new(this::S1).scan
|
31
31
|
s1.name.should == "S1"
|
32
|
-
s1.
|
32
|
+
s1.textual_param_sets.should.nil
|
33
33
|
s1.inputs.size.should == 3
|
34
34
|
s1.inputs.should.include "input/i1"
|
35
35
|
s1.inputs.should.include "input/i2"
|
@@ -43,7 +43,7 @@ TestHelper.scope do |this|
|
|
43
43
|
it "should scan scenario direcotry: S2" do
|
44
44
|
s2 = Package::ScenarioScanner.new(this::S2).scan
|
45
45
|
s2.name.should == "S2"
|
46
|
-
s2.
|
46
|
+
s2.textual_param_sets.should.nil
|
47
47
|
s2.inputs.size.should == 0
|
48
48
|
s2.outputs.size.should == 1
|
49
49
|
s2.outputs.should.include "output/o1"
|
@@ -52,7 +52,7 @@ TestHelper.scope do |this|
|
|
52
52
|
it "should scan scenario direcotry: S3" do
|
53
53
|
s3 = Package::ScenarioScanner.new(this::S3).scan
|
54
54
|
s3.name.should == "S3"
|
55
|
-
s3.
|
55
|
+
s3.textual_param_sets.should == "{PARAM: 1}"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should raise exception because of no scenario names" do
|
@@ -1,137 +1,137 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<!--PLEASE DO NOT EDIT THIS FILE
|
3
|
-
Created with Workflow PetriNet Designer Version 1.0 (woped.org)-->
|
4
|
-
<pnml>
|
5
|
-
<net type="http://www.informatik.hu-berlin.de/top/pntd/ptNetb" id="noID">
|
6
|
-
<place id="p3">
|
7
|
-
<name>
|
8
|
-
<text
|
9
|
-
<graphics>
|
10
|
-
<offset x="350" y="110"/>
|
11
|
-
</graphics>
|
12
|
-
</name>
|
13
|
-
<graphics>
|
14
|
-
<position x="350" y="70"/>
|
15
|
-
<dimension x="40" y="40"/>
|
16
|
-
</graphics>
|
17
|
-
</place>
|
18
|
-
<place id="p2">
|
19
|
-
<name>
|
20
|
-
<text>p1</text>
|
21
|
-
<graphics>
|
22
|
-
<offset x="200" y="110"/>
|
23
|
-
</graphics>
|
24
|
-
</name>
|
25
|
-
<graphics>
|
26
|
-
<position x="200" y="70"/>
|
27
|
-
<dimension x="40" y="40"/>
|
28
|
-
</graphics>
|
29
|
-
</place>
|
30
|
-
<place id="p1">
|
31
|
-
<name>
|
32
|
-
<text>i1</text>
|
33
|
-
<graphics>
|
34
|
-
<offset x="50" y="110"/>
|
35
|
-
</graphics>
|
36
|
-
</name>
|
37
|
-
<graphics>
|
38
|
-
<position x="50" y="70"/>
|
39
|
-
<dimension x="40" y="40"/>
|
40
|
-
</graphics>
|
41
|
-
</place>
|
42
|
-
<transition id="t2">
|
43
|
-
<name>
|
44
|
-
<text>B</text>
|
45
|
-
<graphics>
|
46
|
-
<offset x="270" y="110"/>
|
47
|
-
</graphics>
|
48
|
-
</name>
|
49
|
-
<graphics>
|
50
|
-
<position x="275" y="70"/>
|
51
|
-
<dimension x="40" y="40"/>
|
52
|
-
</graphics>
|
53
|
-
<toolspecific tool="WoPeD" version="1.0">
|
54
|
-
<time>0</time>
|
55
|
-
<timeUnit>1</timeUnit>
|
56
|
-
<orientation>1</orientation>
|
57
|
-
</toolspecific>
|
58
|
-
</transition>
|
59
|
-
<transition id="t1">
|
60
|
-
<name>
|
61
|
-
<text>A</text>
|
62
|
-
<graphics>
|
63
|
-
<offset x="120" y="110"/>
|
64
|
-
</graphics>
|
65
|
-
</name>
|
66
|
-
<graphics>
|
67
|
-
<position x="125" y="70"/>
|
68
|
-
<dimension x="40" y="40"/>
|
69
|
-
</graphics>
|
70
|
-
<toolspecific tool="WoPeD" version="1.0">
|
71
|
-
<time>0</time>
|
72
|
-
<timeUnit>1</timeUnit>
|
73
|
-
<orientation>1</orientation>
|
74
|
-
</toolspecific>
|
75
|
-
</transition>
|
76
|
-
<arc id="a1" source="p1" target="t1">
|
77
|
-
<inscription>
|
78
|
-
<text>1</text>
|
79
|
-
</inscription>
|
80
|
-
<graphics/>
|
81
|
-
<toolspecific tool="WoPeD" version="1.0">
|
82
|
-
<probability>1.0</probability>
|
83
|
-
<displayProbabilityOn>false</displayProbabilityOn>
|
84
|
-
<displayProbabilityPosition x="500.0" y="0.0"/>
|
85
|
-
</toolspecific>
|
86
|
-
</arc>
|
87
|
-
<arc id="a2" source="t1" target="p2">
|
88
|
-
<inscription>
|
89
|
-
<text>1</text>
|
90
|
-
</inscription>
|
91
|
-
<graphics/>
|
92
|
-
<toolspecific tool="WoPeD" version="1.0">
|
93
|
-
<probability>1.0</probability>
|
94
|
-
<displayProbabilityOn>false</displayProbabilityOn>
|
95
|
-
<displayProbabilityPosition x="500.0" y="0.0"/>
|
96
|
-
</toolspecific>
|
97
|
-
</arc>
|
98
|
-
<arc id="a3" source="p2" target="t2">
|
99
|
-
<inscription>
|
100
|
-
<text>1</text>
|
101
|
-
</inscription>
|
102
|
-
<graphics/>
|
103
|
-
<toolspecific tool="WoPeD" version="1.0">
|
104
|
-
<probability>1.0</probability>
|
105
|
-
<displayProbabilityOn>false</displayProbabilityOn>
|
106
|
-
<displayProbabilityPosition x="500.0" y="0.0"/>
|
107
|
-
</toolspecific>
|
108
|
-
</arc>
|
109
|
-
<arc id="a4" source="t2" target="p3">
|
110
|
-
<inscription>
|
111
|
-
<text>1</text>
|
112
|
-
</inscription>
|
113
|
-
<graphics/>
|
114
|
-
<toolspecific tool="WoPeD" version="1.0">
|
115
|
-
<probability>1.0</probability>
|
116
|
-
<displayProbabilityOn>false</displayProbabilityOn>
|
117
|
-
<displayProbabilityPosition x="500.0" y="0.0"/>
|
118
|
-
</toolspecific>
|
119
|
-
</arc>
|
120
|
-
<toolspecific tool="WoPeD" version="1.0">
|
121
|
-
<bounds>
|
122
|
-
<position x="2" y="
|
123
|
-
<dimension x="
|
124
|
-
</bounds>
|
125
|
-
<scale>
|
126
|
-
<treeWidthRight>
|
127
|
-
<overviewPanelVisible>true</overviewPanelVisible>
|
128
|
-
<treeHeightOverview>100</treeHeightOverview>
|
129
|
-
<treePanelVisible>true</treePanelVisible>
|
130
|
-
<verticalLayout>false</verticalLayout>
|
131
|
-
<resources/>
|
132
|
-
<simulations/>
|
133
|
-
<partnerLinks/>
|
134
|
-
<variables/>
|
135
|
-
</toolspecific>
|
136
|
-
</net>
|
3
|
+
Created with Workflow PetriNet Designer Version 1.0 (woped.org)-->
|
4
|
+
<pnml>
|
5
|
+
<net type="http://www.informatik.hu-berlin.de/top/pntd/ptNetb" id="noID">
|
6
|
+
<place id="p3">
|
7
|
+
<name>
|
8
|
+
<text>>'o1'</text>
|
9
|
+
<graphics>
|
10
|
+
<offset x="350" y="110"/>
|
11
|
+
</graphics>
|
12
|
+
</name>
|
13
|
+
<graphics>
|
14
|
+
<position x="350" y="70"/>
|
15
|
+
<dimension x="40" y="40"/>
|
16
|
+
</graphics>
|
17
|
+
</place>
|
18
|
+
<place id="p2">
|
19
|
+
<name>
|
20
|
+
<text>'p1'</text>
|
21
|
+
<graphics>
|
22
|
+
<offset x="200" y="110"/>
|
23
|
+
</graphics>
|
24
|
+
</name>
|
25
|
+
<graphics>
|
26
|
+
<position x="200" y="70"/>
|
27
|
+
<dimension x="40" y="40"/>
|
28
|
+
</graphics>
|
29
|
+
</place>
|
30
|
+
<place id="p1">
|
31
|
+
<name>
|
32
|
+
<text>'i1'</text>
|
33
|
+
<graphics>
|
34
|
+
<offset x="50" y="110"/>
|
35
|
+
</graphics>
|
36
|
+
</name>
|
37
|
+
<graphics>
|
38
|
+
<position x="50" y="70"/>
|
39
|
+
<dimension x="40" y="40"/>
|
40
|
+
</graphics>
|
41
|
+
</place>
|
42
|
+
<transition id="t2">
|
43
|
+
<name>
|
44
|
+
<text>B</text>
|
45
|
+
<graphics>
|
46
|
+
<offset x="270" y="110"/>
|
47
|
+
</graphics>
|
48
|
+
</name>
|
49
|
+
<graphics>
|
50
|
+
<position x="275" y="70"/>
|
51
|
+
<dimension x="40" y="40"/>
|
52
|
+
</graphics>
|
53
|
+
<toolspecific tool="WoPeD" version="1.0">
|
54
|
+
<time>0</time>
|
55
|
+
<timeUnit>1</timeUnit>
|
56
|
+
<orientation>1</orientation>
|
57
|
+
</toolspecific>
|
58
|
+
</transition>
|
59
|
+
<transition id="t1">
|
60
|
+
<name>
|
61
|
+
<text>A</text>
|
62
|
+
<graphics>
|
63
|
+
<offset x="120" y="110"/>
|
64
|
+
</graphics>
|
65
|
+
</name>
|
66
|
+
<graphics>
|
67
|
+
<position x="125" y="70"/>
|
68
|
+
<dimension x="40" y="40"/>
|
69
|
+
</graphics>
|
70
|
+
<toolspecific tool="WoPeD" version="1.0">
|
71
|
+
<time>0</time>
|
72
|
+
<timeUnit>1</timeUnit>
|
73
|
+
<orientation>1</orientation>
|
74
|
+
</toolspecific>
|
75
|
+
</transition>
|
76
|
+
<arc id="a1" source="p1" target="t1">
|
77
|
+
<inscription>
|
78
|
+
<text>1</text>
|
79
|
+
</inscription>
|
80
|
+
<graphics/>
|
81
|
+
<toolspecific tool="WoPeD" version="1.0">
|
82
|
+
<probability>1.0</probability>
|
83
|
+
<displayProbabilityOn>false</displayProbabilityOn>
|
84
|
+
<displayProbabilityPosition x="500.0" y="0.0"/>
|
85
|
+
</toolspecific>
|
86
|
+
</arc>
|
87
|
+
<arc id="a2" source="t1" target="p2">
|
88
|
+
<inscription>
|
89
|
+
<text>1</text>
|
90
|
+
</inscription>
|
91
|
+
<graphics/>
|
92
|
+
<toolspecific tool="WoPeD" version="1.0">
|
93
|
+
<probability>1.0</probability>
|
94
|
+
<displayProbabilityOn>false</displayProbabilityOn>
|
95
|
+
<displayProbabilityPosition x="500.0" y="0.0"/>
|
96
|
+
</toolspecific>
|
97
|
+
</arc>
|
98
|
+
<arc id="a3" source="p2" target="t2">
|
99
|
+
<inscription>
|
100
|
+
<text>1</text>
|
101
|
+
</inscription>
|
102
|
+
<graphics/>
|
103
|
+
<toolspecific tool="WoPeD" version="1.0">
|
104
|
+
<probability>1.0</probability>
|
105
|
+
<displayProbabilityOn>false</displayProbabilityOn>
|
106
|
+
<displayProbabilityPosition x="500.0" y="0.0"/>
|
107
|
+
</toolspecific>
|
108
|
+
</arc>
|
109
|
+
<arc id="a4" source="t2" target="p3">
|
110
|
+
<inscription>
|
111
|
+
<text>1</text>
|
112
|
+
</inscription>
|
113
|
+
<graphics/>
|
114
|
+
<toolspecific tool="WoPeD" version="1.0">
|
115
|
+
<probability>1.0</probability>
|
116
|
+
<displayProbabilityOn>false</displayProbabilityOn>
|
117
|
+
<displayProbabilityPosition x="500.0" y="0.0"/>
|
118
|
+
</toolspecific>
|
119
|
+
</arc>
|
120
|
+
<toolspecific tool="WoPeD" version="1.0">
|
121
|
+
<bounds>
|
122
|
+
<position x="2" y="22"/>
|
123
|
+
<dimension x="1351" y="472"/>
|
124
|
+
</bounds>
|
125
|
+
<scale>130</scale>
|
126
|
+
<treeWidthRight>1066</treeWidthRight>
|
127
|
+
<overviewPanelVisible>true</overviewPanelVisible>
|
128
|
+
<treeHeightOverview>100</treeHeightOverview>
|
129
|
+
<treePanelVisible>true</treePanelVisible>
|
130
|
+
<verticalLayout>false</verticalLayout>
|
131
|
+
<resources/>
|
132
|
+
<simulations/>
|
133
|
+
<partnerLinks/>
|
134
|
+
<variables/>
|
135
|
+
</toolspecific>
|
136
|
+
</net>
|
137
137
|
</pnml>
|
@@ -5,17 +5,28 @@ TestHelper.scope do |this|
|
|
5
5
|
|
6
6
|
describe Pione::Util::PNMLCompiler do
|
7
7
|
it "should compile from PNML to PIONE" do
|
8
|
-
pione = Util::PNMLCompiler.new(this::PNML1).compile
|
8
|
+
pione = Util::PNMLCompiler.new(this::PNML1, "Test", "E", "T").compile
|
9
|
+
|
9
10
|
env = Lang::Environment.new.setup_new_package("Test")
|
10
11
|
TestHelper::Lang.package_context!(env, pione)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
|
13
|
+
env.rule_get(Lang::RuleExpr.new("Main")).tap do |rule|
|
14
|
+
cond = rule.rule_condition_context.eval(env)
|
15
|
+
cond.inputs.should == [TestHelper::Lang.expr("'i1'")]
|
16
|
+
cond.outputs.should == [TestHelper::Lang.expr("'o1'")]
|
17
|
+
end
|
18
|
+
|
19
|
+
env.rule_get(Lang::RuleExpr.new("A")).tap do |rule|
|
20
|
+
cond = rule.rule_condition_context.eval(env)
|
21
|
+
cond.inputs.should == [TestHelper::Lang.expr("'i1'")]
|
22
|
+
cond.outputs.should == [TestHelper::Lang.expr("'p1'.touch")]
|
23
|
+
end
|
24
|
+
|
25
|
+
env.rule_get(Lang::RuleExpr.new("B")).tap do |rule|
|
26
|
+
cond = rule.rule_condition_context.eval(env)
|
27
|
+
cond.inputs.should == [TestHelper::Lang.expr("'p1'")]
|
28
|
+
cond.outputs.should == [TestHelper::Lang.expr("'o1'.touch")]
|
29
|
+
end
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|