cpee-instantiation 1.0.3 → 1.0.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f53d408e5dbfd7e322a845330ae10df4b8352798576d8bc244b6db6de0a3933
4
- data.tar.gz: 8cbae1d0f118f5f7a53a5b6df2dc95946daaf30fa30c964d74ea5fcda0f6dbc8
3
+ metadata.gz: 0d8b35ec9b565e1bab33b2b5a241aca5bef057a5346e318a200f97ee5a747858
4
+ data.tar.gz: ce3baeadef619b73cafdcb68911fd80a3fa1431e3c9e4e4943073774dcd7fecd
5
5
  SHA512:
6
- metadata.gz: 0ce67354922c16a1da5fa2077129081d043f8bb44fc308b2c991f5d6258a5e5eb8a834d68cbc7225db43445114e5447d2234ff90c027029244fa2070a691612d
7
- data.tar.gz: 0516e8ba967d5896c925c8d82e2e651b0fa523bbddee621aba94ed995cbc6f7d002ec3d7e42852d4a81d0f5e69fbf43c8c2cbdb1b55d5feac89ad280f06d1a1b
6
+ metadata.gz: 148655d1172ff9741a123fb868d6f96aecde9b520482d6611073b0fe25ac1ad8b0edc0cc041e683ed578565fe8559d5b539fe719d25e9c7dc4af3ff319ce4f2b
7
+ data.tar.gz: 5ab0d7a92da34ebb58e533a99226a1d89764272aaf1b324a913214e9ceaef3b52789646dd1c645316490c066cface0093d8c871d46a54959b95412ded8e7510c
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-instantiation"
3
- s.version = "1.0.3"
3
+ s.version = "1.0.9"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Subprocess instantiation service for the cloud process execution engine (cpee.org)"
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'riddl', '~> 0.99'
24
24
  s.add_runtime_dependency 'json', '~> 2.1'
25
25
  s.add_runtime_dependency 'redis', '~> 4.1'
26
- s.add_runtime_dependency 'cpee', '~> 1', '>= 1.5'
26
+ s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.4'
27
27
  end
@@ -30,12 +30,13 @@ module CPEE
30
30
  SERVER = File.expand_path(File.join(__dir__,'instantiation.xml'))
31
31
 
32
32
  module Helpers #{{{
33
- def load_testset(tdoc,cpee,name=nil,stream=nil) #{{{
33
+ def load_testset(tdoc,cpee,name=nil,customization=nil) #{{{
34
34
  ins = -1
35
35
  uuid = nil
36
36
  XML::Smart.string(tdoc) do |doc|
37
37
  doc.register_namespace 'desc', 'http://cpee.org/ns/description/1.0'
38
38
  doc.register_namespace 'prop', 'http://cpee.org/ns/properties/2.0'
39
+ doc.register_namespace 'sub', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
39
40
 
40
41
  srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
41
42
  res = srv.resource('/')
@@ -44,13 +45,13 @@ module CPEE
44
45
  e.text = name
45
46
  end
46
47
  end
47
- if stream && !stream.empty?
48
- JSON.parse(stream).each do |e|
48
+ if customization && !customization.empty?
49
+ JSON.parse(customization).each do |e|
49
50
  begin
50
- stream = Typhoeus.get e['url']
51
- if stream.success?
52
- XML::Smart::string(stream.response_body) do |str|
53
- doc.find("//desc:call[@id=\"#{e['id']}\"]/desc:parameters/desc:stream").each do |ele|
51
+ customization = Typhoeus.get e['url']
52
+ if customization.success?
53
+ XML::Smart::string(customization.response_body) do |str|
54
+ doc.find("//desc:call[@id=\"#{e['id']}\"]/desc:parameters/desc:customization").each do |ele|
54
55
  ele.replace_by str.root
55
56
  end
56
57
  end
@@ -70,23 +71,30 @@ module CPEE
70
71
 
71
72
  inp = XML::Smart::string('<properties xmlns="http://cpee.org/ns/properties/2.0"/>')
72
73
  inp.register_namespace 'prop', 'http://cpee.org/ns/properties/2.0'
73
- %w{handlerwrapper positions dataelements endpoints attributes description transformation}.each do |item|
74
+ %w{executionhandler positions dataelements endpoints attributes description transformation}.each do |item|
74
75
  ele = doc.find("/*/prop:#{item}")
75
76
  inp.root.add(ele.first) if ele.any?
76
77
  end
77
78
  res = srv.resource("/#{ins}/properties").put Riddl::Parameter::Complex.new('properties','application/xml',inp.to_s)
78
- doc.find('/*/prop:handlers/prop:handler').each do |han|
79
- url = han.attributes['url']
80
- inp = 'url=' + URI.encode_www_form_component(url)
81
- inp = inp + '&topic=' + han.children.first.attributes['topic']
82
- inp = inp + '&' + han.children.first.qname.to_s + '=' + han.children.first.to_s
83
- status,body = Riddl::Client::new(cpee+ins+'/notifications/subscriptions/').post(
84
- [
85
- Riddl::Parameter::Simple.new('url',han.attributes['url']),
86
- Riddl::Parameter::Simple.new('topic',han.children.first.attributes['topic']),
87
- Riddl::Parameter::Simple.new(han.children.first.qname.to_s,han.children.first.to_s)
88
- ]
89
- )
79
+ # TODO new versions
80
+ doc.find('/*/sub:subscriptions/sub:subscription').each do |s|
81
+ parts = []
82
+ if id = s.attributes['id']
83
+ parts << Riddl::Parameter::Simple.new('id', id)
84
+ end
85
+ parts << Riddl::Parameter::Simple.new('url', s.attributes['url'])
86
+ s.find('sub:topic').each do |t|
87
+ p s.find('sub:event').map{ |e| e.text }
88
+ if (evs = t.find('sub:event').map{ |e| e.text }.join(',')).length > 0
89
+ parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
90
+ parts << Riddl::Parameter::Simple.new('events', evs)
91
+ end
92
+ if (vos = t.find('sub:vote').map{ |e| e.text }.join(',')).length > 0
93
+ parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
94
+ parts << Riddl::Parameter::Simple.new('votes', vos)
95
+ end
96
+ end
97
+ status,body = Riddl::Client::new(cpee+ins+'/notifications/subscriptions/').post parts
90
98
  end
91
99
  end
92
100
  end
@@ -167,8 +175,8 @@ module CPEE
167
175
  else
168
176
  (@status = 500) && return
169
177
  end
170
- stream = @p.find{ |e| e.name == 'stream' }&.value
171
- if (instance, uuid = load_testset(tdoc,cpee,nil,stream)).first == -1
178
+ customization = @p.find{ |e| e.name == 'customization' }&.value
179
+ if (instance, uuid = load_testset(tdoc,cpee,nil,customization)).first == -1
172
180
  @status = 500
173
181
  else
174
182
  EM.defer do
@@ -210,8 +218,8 @@ module CPEE
210
218
  else
211
219
  (@status = 500) && return
212
220
  end
213
- stream = @p.find{ |e| e.name == 'stream' }&.value
214
- if (instance, uuid = load_testset(tdoc,cpee,name,stream)).first == -1
221
+ customization = @p.find{ |e| e.name == 'customization' }&.value
222
+ if (instance, uuid = load_testset(tdoc,cpee,name,customization)).first == -1
215
223
  @status = 500
216
224
  else
217
225
  EM.defer do
@@ -34,7 +34,7 @@
34
34
  <parameter name="endpoints" type="string"/>
35
35
  </optional>
36
36
  <optional>
37
- <parameter name="stream" type="string"/>
37
+ <parameter name="customization" type="string"/>
38
38
  </optional>
39
39
  </message>
40
40
  <message name="url">
@@ -54,7 +54,7 @@
54
54
  <parameter name="endpoints" type="string"/>
55
55
  </optional>
56
56
  <optional>
57
- <parameter name="stream" type="string"/>
57
+ <parameter name="customization" type="string"/>
58
58
  </optional>
59
59
  </message>
60
60
  <message name="git">
@@ -76,7 +76,7 @@
76
76
  <parameter name="endpoints" type="string"/>
77
77
  </optional>
78
78
  <optional>
79
- <parameter name="stream" type="string"/>
79
+ <parameter name="customization" type="string"/>
80
80
  </optional>
81
81
  </message>
82
82
  <message name="instance">
@@ -30,7 +30,7 @@ ARGV.options { |opt|
30
30
  opt.on("Options:")
31
31
  opt.on("--help", "-h", "This text") { puts opt; exit }
32
32
  opt.on("")
33
- opt.on(wrap("[DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
33
+ opt.on(wrap("[DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
34
34
  opt.parse!
35
35
  }
36
36
  if (ARGV.length != 1)
@@ -40,8 +40,10 @@ else
40
40
  p1 = ARGV[0]
41
41
  end
42
42
 
43
+ insta = "#{curpath}/../server/"
43
44
  if !File.exists?(p1)
44
- FileUtils.cp_r("#{curpath}/../server/",p1)
45
+ FileUtils.cp_r(insta,p1)
45
46
  else
46
- puts 'Directory already exists.'
47
+ FileUtils.cp_r(Dir.glob(File.join(insta,'*')).delete_if{|e| e =~ /\.conf/ },p1,remove_destination: true)
48
+ puts 'Directory already exists, updating ...'
47
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-instantiation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2020-10-23 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -58,20 +58,20 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
61
+ version: '2.1'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: '1.5'
64
+ version: 2.1.4
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: '1'
71
+ version: '2.1'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '1.5'
74
+ version: 2.1.4
75
75
  description: see http://cpee.org
76
76
  email: juergen.mangler@gmail.com
77
77
  executables:
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.1.4
111
+ rubygems_version: 3.1.6
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Subprocess instantiation service for the cloud process execution engine (cpee.org)