tla-sbuilder 0.3.4 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -70
- data/VERSION +1 -1
- data/lib/sbuilder/constants.rb +4 -4
- data/lib/sbuilder/controller.rb +232 -76
- data/lib/sbuilder/default-sbuilder.yaml +66 -22
- data/lib/sbuilder/facade/api_loader_facade.rb +47 -11
- data/lib/sbuilder/facade/facade_constants.rb +26 -0
- data/lib/sbuilder/facade/loader_plugin_root.rb +4 -1
- data/lib/sbuilder/facade/param_set_root.rb +38 -1
- data/lib/sbuilder/facade/snippet_loader_facade.rb +90 -8
- data/lib/sbuilder/factory.rb +9 -4
- data/lib/sbuilder/model.rb +25 -3
- data/lib/sbuilder/param_set.rb +8 -7
- data/mustache/cfg/const_def.mustache +2 -0
- data/mustache/{setup → config}/assumptions_activate.mustache +0 -0
- data/mustache/{setup → config}/domains_run.mustache +0 -0
- data/mustache/config/module_footer.mustache +1 -0
- data/mustache/config/module_header.mustache +10 -0
- data/mustache/{setup → config}/operator_run.mustache +0 -0
- data/mustache/{setup → config}/operator_tick.mustache +0 -0
- data/mustache/config/steps_run.mustache +43 -0
- data/mustache/{setup → config}/steps_run_bind_rule.mustache +5 -2
- data/mustache/{setup → config}/steps_run_bind_set.mustache +11 -5
- data/mustache/{setup → config}/steps_run_parameterBind.mustache +10 -4
- data/mustache/{setup → config}/steps_run_parameterExact.mustache +11 -3
- data/mustache/inherit/inherit_config.mustache +29 -0
- data/mustache/interface_processes.mustache +6 -2
- data/mustache/interfaces/interface_mapper.mustache +12 -0
- data/mustache/possibility/module_extends.mustache +1 -1
- data/mustache/possibility/operator_set_step_input.mustache +8 -0
- data/mustache/possibility/possibility_definition.mustache +4 -4
- data/mustache/possibility/possility_setup.mustache +4 -3
- data/mustache/setup/module_header.mustache +3 -1
- data/mustache/setup/operator_set_step_input.mustache +8 -0
- data/mustache/state_type_invariant-infrastructure-service.mustache +2 -2
- data/mustache/tla/const_def.mustache +1 -0
- data/mustache/tla/macro_run.mustache +10 -2
- data/mustache/tla/plc_run_state.mustache +2 -0
- data/src/pet/infrastructure_id_get.tla +6 -2
- data/src/pet/service_pet_post.tla +2 -2
- data/src/pet/service_tag_post.tla +1 -1
- data/tla-sbuilder.gemspec +1 -1
- metadata +21 -13
- data/mustache/setup/steps_run.mustache +0 -23
data/lib/sbuilder/factory.rb
CHANGED
@@ -169,7 +169,7 @@ module Sbuilder
|
|
169
169
|
# return 'objectName' plugin instance, or create new plugin object
|
170
170
|
# with 'className.new'.configure( configuration )
|
171
171
|
#
|
172
|
-
# @param [String] className name of the plugin, if nil objectName
|
172
|
+
# @param [String, Class] className name of the plugin, if nil objectName
|
173
173
|
# must be nil
|
174
174
|
#
|
175
175
|
# @param [Object] configuration to pass to className.new
|
@@ -210,7 +210,7 @@ module Sbuilder
|
|
210
210
|
|
211
211
|
# create new 'unnamed object'
|
212
212
|
|
213
|
-
if loaderPlugins[className].nil? then
|
213
|
+
if className.is_a?(String) && loaderPlugins[className].nil? then
|
214
214
|
msg = <<-EOS
|
215
215
|
Unknown parameter className #{className}"
|
216
216
|
|
@@ -220,8 +220,13 @@ module Sbuilder
|
|
220
220
|
@logger.error( "#{__method__} #{msg}" )
|
221
221
|
raise NameError.new( msg )
|
222
222
|
end
|
223
|
-
|
224
|
-
|
223
|
+
|
224
|
+
klass = className.is_a?( String ) ? loaderPlugins[className] : className
|
225
|
+
|
226
|
+
# newObject = loaderPlugins[className].new( options )
|
227
|
+
newObject = klass.new( options )
|
228
|
+
# newObject.configure( configuration ) if configuration #
|
229
|
+
newObject.configure( configuration )
|
225
230
|
return newObject
|
226
231
|
end
|
227
232
|
end
|
data/lib/sbuilder/model.rb
CHANGED
@@ -114,7 +114,7 @@ module Sbuilder
|
|
114
114
|
|
115
115
|
def getDomain( domainName )
|
116
116
|
ret = domains[domainName]
|
117
|
-
raise ModelException.new "Could not locate domain set #{domainName}" unless ret
|
117
|
+
raise ModelException.new "Could not locate domain set #{domainName}, known domains #{domains.keys.join(",")}" unless ret
|
118
118
|
return ret
|
119
119
|
end
|
120
120
|
|
@@ -369,8 +369,25 @@ module Sbuilder
|
|
369
369
|
# :interface_id => step.interfaceReference.getId,
|
370
370
|
'_comma' => (i< steps.length-1 ? "," : ""),
|
371
371
|
:bindRule => step.bindExact == false ? step.inputs : false,
|
372
|
-
|
373
|
-
|
372
|
+
:bindRules => step.bindExact == false ?
|
373
|
+
# for bindRules i.e. when bindSets== false:
|
374
|
+
# mustache iterates set with these elements
|
375
|
+
step.inputs.map.with_index do |input,index|
|
376
|
+
{
|
377
|
+
:process => step.getName,
|
378
|
+
:interface_name => step.interfaceReference.getName,
|
379
|
+
:interface_operation => step.interfaceReference.getId,
|
380
|
+
:interface_path => step.interfaceReference.path,
|
381
|
+
:bindRule => input,
|
382
|
+
"_comma" => (index<step.inputs.length-1 ? "," : ""),
|
383
|
+
}
|
384
|
+
end :
|
385
|
+
false,
|
386
|
+
# :bindSets => step.bindExact ? step.inputs.map.with_index { |input,i| input['_comma'] = i<step.inputs.length-1 ? ',' : ''; input } : false,
|
387
|
+
# for 'bindSets' bindRules == false mustache step is
|
388
|
+
# one entry with set for 'bindSets' elements
|
389
|
+
:bindSets => step.bindExact ? step.inputs : false,
|
390
|
+
:noBinds => step.inputs.length == 0,
|
374
391
|
}
|
375
392
|
},
|
376
393
|
}
|
@@ -455,6 +472,11 @@ module Sbuilder
|
|
455
472
|
:interface_name => iface.getName, # e.g._pet_post_
|
456
473
|
:interface_operation => iface.getId, # e.g /pet(post)
|
457
474
|
:implementation => getImplementationExtension( iface ),
|
475
|
+
:source => {
|
476
|
+
:sourceModule => iface.sourceModule,
|
477
|
+
:sourceLine => iface.sourceLine,
|
478
|
+
:sourceColumn => iface.sourceColumn,
|
479
|
+
},
|
458
480
|
:completion => getCompletionExtension( iface ),
|
459
481
|
'_comma' => ',',
|
460
482
|
:parameter_definitions => iface.parameter_definitions( self ),
|
data/lib/sbuilder/param_set.rb
CHANGED
@@ -103,13 +103,14 @@ module Sbuilder
|
|
103
103
|
|
104
104
|
# getId with invalid-caharacters as underscpce
|
105
105
|
def getName
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
106
|
+
self.class.id2name(getId)
|
107
|
+
# return getId.
|
108
|
+
# gsub( /\//, "_" ). # / --> _
|
109
|
+
# gsub( /\(/, "_" ). # ( --> _
|
110
|
+
# gsub( /\{/, "_" ). # { --> _
|
111
|
+
# gsub( /\}/, "_" ). # } --> _
|
112
|
+
# gsub( /\./, "_" ). # . --> _
|
113
|
+
# gsub( /\)/, "_" ) # ) --> _
|
113
114
|
|
114
115
|
end
|
115
116
|
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
=============================================================================
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Model version: {{META.model_version}}
|
2
|
+
Generator version: {{META.version}}
|
3
|
+
Generation timestemp: {{META.timestamp}}
|
4
|
+
|
5
|
+
------------------------------ MODULE config ------------------------------
|
6
|
+
(* Common configuration module for various setup run configuration *)
|
7
|
+
|
8
|
+
EXTENDS model, TLC
|
9
|
+
|
10
|
+
|
File without changes
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
(******************************************************************
|
3
|
+
Environment model running the steps
|
4
|
+
|
5
|
+
{{META.desc}}
|
6
|
+
- modelData {{META.modelData}}
|
7
|
+
- template {{META.template}}
|
8
|
+
******************************************************************)
|
9
|
+
|
10
|
+
|
11
|
+
RunSteps == <<
|
12
|
+
{{#steps}} {{!
|
13
|
+
|
14
|
+
Start set {
|
15
|
+
|
16
|
+
}} {
|
17
|
+
{{!
|
18
|
+
Generate noBinds (!bindExact && !bindRules)
|
19
|
+
}}{{#noBinds}} [ process |-> "p_{{process}}"
|
20
|
+
, bindRule |-> WildCard
|
21
|
+
, bindSet |-> Nil
|
22
|
+
, ctx |-> Nil
|
23
|
+
] {{/noBinds}}{{^noBinds}}{{!
|
24
|
+
|
25
|
+
Generate for bindExact
|
26
|
+
|
27
|
+
}}{{#bindSets.length}} [ process |-> "p_{{process}}"
|
28
|
+
, bindRule |-> {{>config/steps_run_bind_rule.mustache }}
|
29
|
+
, bindSet |-> {{>config/steps_run_bind_set.mustache }}
|
30
|
+
, ctx |-> Nil
|
31
|
+
]{{/bindSets.length}}{{!
|
32
|
+
|
33
|
+
Generat for bindRules
|
34
|
+
}}{{^bindSets}}{{#bindRules}}[ process |-> "p_{{process}}"
|
35
|
+
, bindRule |-> {{>config/steps_run_bind_rule.mustache }}
|
36
|
+
, bindSet |-> {{>config/steps_run_bind_set.mustache }}
|
37
|
+
, ctx |-> Nil
|
38
|
+
]{{_comma}}{{/bindRules}}{{/bindSets}}{{/noBinds}}
|
39
|
+
} {{_comma}} (* interface/process : {{process}} *)
|
40
|
+
{{/steps}}
|
41
|
+
|
42
|
+
>>
|
43
|
+
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
Iterate 'bindRule' for each column
|
19
19
|
|
20
|
-
}}{{/columns.length}}{{#columns}}{{>
|
20
|
+
}}{{/columns.length}}{{#columns}}{{>config/steps_run_parameterBind.mustache}}{{/columns}}{{!
|
21
21
|
|
22
22
|
end of some columns defined
|
23
23
|
|
@@ -48,4 +48,7 @@
|
|
48
48
|
}}{{^bindRule}}WildCard{{/bindRule}}{{!
|
49
49
|
|
50
50
|
No new line --> outputs on one line
|
51
|
-
|
51
|
+
Local Variables:
|
52
|
+
require-final-newline: nil
|
53
|
+
End:
|
54
|
+
}}
|
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
- open with {
|
5
5
|
|
6
|
-
}}{{#bindSets.length}} {
|
6
|
+
}}{{#bindSets.length}} {
|
7
|
+
{{/bindSets.length}}{{#bindSets}}{{!
|
7
8
|
|
8
9
|
|
9
10
|
|
@@ -11,13 +12,14 @@
|
|
11
12
|
- iterate each input as an record
|
12
13
|
|
13
14
|
|
14
|
-
}} {{#columns.length}}[ {{/columns.length}}{{>
|
15
|
+
}} {{#columns.length}}[ {{/columns.length}}{{>config/steps_run_parameterExact.mustache}}{{#columns.length}} ] {{/columns.length}}{{!
|
15
16
|
|
16
17
|
End of bind set iteration
|
17
18
|
|
18
19
|
output _comma (to separate bind sets
|
19
20
|
|
20
|
-
}}{{_comma}}
|
21
|
+
}}{{_comma}}
|
22
|
+
{{/bindSets}}{{!
|
21
23
|
|
22
24
|
|
23
25
|
End of bind set
|
@@ -33,5 +35,9 @@
|
|
33
35
|
|
34
36
|
|
35
37
|
}}Nil{{/bindSets}}{{!
|
36
|
-
|
37
|
-
|
38
|
+
No new line --> output to one line
|
39
|
+
|
40
|
+
Local Variables:
|
41
|
+
require-final-newline: nil
|
42
|
+
End:
|
43
|
+
}}
|
@@ -60,7 +60,7 @@
|
|
60
60
|
Here recurse columns
|
61
61
|
|
62
62
|
|
63
|
-
}}{{#columns}}{{>
|
63
|
+
}}{{#columns}}{{>config/steps_run_parameterBind.mustache}}{{/columns}}{{!
|
64
64
|
|
65
65
|
end of columsn iteration
|
66
66
|
|
@@ -77,14 +77,20 @@ Start array parameter
|
|
77
77
|
|
78
78
|
}}{{#rows}}{{!
|
79
79
|
row with singleton elements (i.e. columns: false )
|
80
|
-
}}{{^columns.length}}{{>
|
80
|
+
}}{{^columns.length}}{{>config/steps_run_parameterBind.mustache}} {{/columns.length}}{{!
|
81
81
|
|
82
82
|
row with hash element starts (i.e. columns.length defined )
|
83
83
|
|
84
|
-
}}{{#columns.length}}[ {{/columns.length}}{{#columns}}{{>
|
84
|
+
}}{{#columns.length}}[ {{/columns.length}}{{#columns}}{{>config/steps_run_parameterBind.mustache}} {{/columns}} {{!
|
85
85
|
row with hash element ends
|
86
86
|
}}{{#columns.length}} ]{{_comma}}{{/columns.length}} {{/rows}}{{!
|
87
87
|
|
88
88
|
End of rows
|
89
89
|
|
90
|
-
}}{{#rows.length}} } ]}{{_comma}} {{/rows.length}}
|
90
|
+
}}{{#rows.length}} } ]}{{_comma}} {{/rows.length}}{{!
|
91
|
+
|
92
|
+
No new line --> outputs on one line
|
93
|
+
Local Variables:
|
94
|
+
require-final-newline: nil
|
95
|
+
End:
|
96
|
+
}}
|
@@ -69,15 +69,23 @@
|
|
69
69
|
|
70
70
|
when iterating rows check if row defines columns (i.e. columns.length given ) --> surround with [ ... ]
|
71
71
|
|
72
|
-
}}{{#columns.length}}[ {{/columns.length}} {{>
|
72
|
+
}}{{#columns.length}}[ {{/columns.length}} {{>config/steps_run_parameterExact.mustache}} {{#columns.length}} ]{{/columns.length}}{{_comma}}
|
73
|
+
{{/rows}}{{#rows.length}} }{{/rows.length}}{{!
|
73
74
|
|
74
75
|
Case 5: columns
|
75
76
|
- output [
|
76
77
|
<recursion>
|
77
78
|
- output ]
|
78
79
|
|
79
|
-
}}{{#columns.length}}[ {{>
|
80
|
+
}}{{#columns.length}}[ {{>config/steps_run_parameterExact.mustache}} ] {{/columns.length}}{{!
|
80
81
|
|
81
82
|
End of columns (add comma)
|
82
83
|
|
83
|
-
}}{{_comma}}{{/columns}}{{!
|
84
|
+
}}{{_comma}}{{/columns}}{{!
|
85
|
+
|
86
|
+
no new line
|
87
|
+
|
88
|
+
Local Variables:
|
89
|
+
require-final-newline: nil
|
90
|
+
End:
|
91
|
+
}}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
(*
|
2
|
+
|
3
|
+
Model version: {{META.model_version}}
|
4
|
+
Generator version: {{META.version}}
|
5
|
+
Generation timestemp: {{META.timestamp}}
|
6
|
+
|
7
|
+
*)
|
8
|
+
|
9
|
+
\* Configuration included from {{META.setup}}/config.cfg
|
10
|
+
|
11
|
+
|
12
|
+
\* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
13
|
+
\* Start here
|
14
|
+
|
15
|
+
{{!
|
16
|
+
|
17
|
+
Concatenate content of config.cfg for current setup 'META.setup'
|
18
|
+
generated under directory 'CONFIG.gen_dir'.
|
19
|
+
|
20
|
+
}}
|
21
|
+
{{#ACTIONS.cat}}
|
22
|
+
{{CONFIG.gen_dir}}/{{META.setup}}/tla/config.cfg
|
23
|
+
{{/ACTIONS.cat}}
|
24
|
+
|
25
|
+
|
26
|
+
\* End here
|
27
|
+
\* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
28
|
+
|
29
|
+
\* Possible configs on top of 'config.cfg' follow this line
|
@@ -19,8 +19,12 @@ fair process ({{#SPEC_NAME}}processes.{{interface_operation}}{{/SPEC_NAME}}="{{i
|
|
19
19
|
(* enable next process to run parallel *)
|
20
20
|
\* process_done( "{{interface_operation}}" );
|
21
21
|
with ( _input \in { t \in ProcessParameterInput( {{#SPEC_NAME}}interface_types.{{interface_operation}}{{/SPEC_NAME}} ) : ProcessParameterBind( t ) } ) {
|
22
|
+
\* step_input allows extracting input from error trace - at the cost of creating extra state
|
23
|
+
if ( SetStepInput ) {
|
24
|
+
step_input := _input;
|
25
|
+
};
|
22
26
|
\* PREFERENCES.debug-output: {{PREFERENCES.debug-output}}
|
23
|
-
{{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}}print <<"Default process {{#SPEC_NAME}}processes.{{interface_operation}}{{/SPEC_NAME}} for operation '{{interface_operation}}',tick=", currentTime>>;
|
27
|
+
{{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}}print <<"Default process {{#SPEC_NAME}}processes.{{interface_operation}}{{/SPEC_NAME}} for operation '{{interface_operation}}',tick=", currentTime, "input=", step_input >>;
|
24
28
|
{{^implementation}}
|
25
29
|
{{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}}print <<" - input=>", _input >>;
|
26
30
|
(* print <<" - {{#SPEC_NAME}}interface_types.{{interface_operation}}{{/SPEC_NAME}} =>", {{#SPEC_NAME}}interface_types.{{interface_operation}}{{/SPEC_NAME}} >>; *)
|
@@ -38,7 +42,7 @@ fair process ({{#SPEC_NAME}}processes.{{interface_operation}}{{/SPEC_NAME}}="{{i
|
|
38
42
|
}; \* with _input
|
39
43
|
(* enable next process - after current process *)
|
40
44
|
{{#SPEC_NAME}}processes.{{interface_operation}}{{/SPEC_NAME}}_exit:
|
41
|
-
{{#completion}}{{completion}}( "{{interface_operation}}" );
|
45
|
+
{{#completion}}{{#SPEC_NAME}}{{completion}}{{/SPEC_NAME}}( "{{interface_operation}}" );
|
42
46
|
{{/completion}}{{!
|
43
47
|
|
44
48
|
above adds call to completion macro (to simulate transactions)
|
@@ -1 +1 @@
|
|
1
|
-
EXTENDS
|
1
|
+
EXTENDS config
|
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
(* Save process input to variable 'step_input' at start?
|
3
|
+
** Setting this variable allows presenting process input
|
4
|
+
** in error trace, however, at the cost of possibly generating
|
5
|
+
** an extra state (in a case, where different input bindings
|
6
|
+
** would result otherwise to identical states).
|
7
|
+
*)
|
8
|
+
Run_SetStepInput == TRUE
|
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
(*
|
3
|
-
Define possibility for operator {{possibility}}
|
3
|
+
Define possibility for operator '{{possibility}}'.
|
4
4
|
|
5
|
-
We require that {{META.outputModule}} is false
|
6
|
-
|
7
|
-
to reach a state where the
|
5
|
+
We require that '{{META.outputModule}}' is false always.
|
6
|
+
Interpret violation of this property to mean that it is
|
7
|
+
possible to reach a state where the operator holds.
|
8
8
|
|
9
9
|
*)
|
10
10
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
*)
|
8
8
|
|
9
|
-
\* Configuration
|
9
|
+
\* Configuration included from {{META.setup}}/config.cfg
|
10
10
|
|
11
11
|
|
12
12
|
\* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
@@ -14,15 +14,16 @@
|
|
14
14
|
|
15
15
|
{{!
|
16
16
|
|
17
|
-
Concatenate content of
|
17
|
+
Concatenate content of config.cfg for current setup 'META.setup'
|
18
18
|
generated under directory 'CONFIG.gen_dir'.
|
19
19
|
|
20
20
|
}}
|
21
21
|
{{#ACTIONS.cat}}
|
22
|
-
{{CONFIG.gen_dir}}/{{META.setup}}/tla/
|
22
|
+
{{CONFIG.gen_dir}}/{{META.setup}}/tla/config.cfg
|
23
23
|
{{/ACTIONS.cat}}
|
24
24
|
|
25
25
|
|
26
26
|
\* End here
|
27
27
|
\* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
28
28
|
|
29
|
+
\* Possible configs on top of 'config.cfg' follow this line
|
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
(* Save process input to variable 'step_input' at start?
|
3
|
+
** Setting this variable allows presenting process input
|
4
|
+
** in error trace, however, at the cost of possibly generating
|
5
|
+
** an extra state (in a case, where different input bindings
|
6
|
+
** would result otherwise to identical states).
|
7
|
+
*)
|
8
|
+
Run_SetStepInput == FALSE
|
@@ -24,13 +24,13 @@
|
|
24
24
|
|
25
25
|
iterate response definitions
|
26
26
|
|
27
|
-
}}{{#response_definitions}}{{!
|
27
|
+
}}{{#response_definitions.length}}{{!
|
28
28
|
|
29
29
|
end of response definitions
|
30
30
|
|
31
31
|
add ???
|
32
32
|
|
33
|
-
}} \union {{#SPEC_NAME}}
|
33
|
+
}} \union {{#SPEC_NAME}}interface_response_types.{{interface_operation}}{{/SPEC_NAME}}{{/response_definitions.length}} {{!
|
34
34
|
|
35
35
|
end of intefaces
|
36
36
|
|