bpm_manager 0.5.3 → 0.6.0

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
  SHA1:
3
- metadata.gz: d1d214cee10a44f70e47a7ae5bfa25f7a26d19c4
4
- data.tar.gz: 03af4a8681c50248f6d24645dd66278c215fe925
3
+ metadata.gz: 0763cb140721bcd42ea2f15c3434a42eb8e295a1
4
+ data.tar.gz: c60c546af154712878993854941e8264e34d5f56
5
5
  SHA512:
6
- metadata.gz: a787e7358aff22d22637e7309afd2117a98d9ec30b9f76e439e1b38c95cdd5f449d932338534f8aa509f73981515d353501170684907b4ba9fa4a9ba74f71607
7
- data.tar.gz: f1622311dc3f650aa7cbb5475dd2cd3fc44d850e955b0b31864afa11a375b9d2c86bd06fd74c48ffe217a997b1e8e41474269902e6dceffa750accb6ffe26ade
6
+ metadata.gz: f0c0426233928a82d9c0794281e785547e3e0b6a4ceb2625ec9660753036a86e9184336c07b508da5241ea012d986a743234baf3eb76d7724505863fa3b7cea5
7
+ data.tar.gz: f4783b7945c2a95cfae0d5d75d984953642e6ab1603255fae88c65979e16e805843369f64948ca4b15608e25b3fd96957569325885b014ee6bf8206af0685d8e
data/bpm_manager.gemspec CHANGED
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "rest-client"
21
+ spec.add_dependency 'rest-client', '~> 0'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.7"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec', '~> 0'
26
+ spec.add_development_dependency 'ruby-debug19', '~> 0'
26
27
  end
@@ -0,0 +1,132 @@
1
+ require "rest-client"
2
+ require "json"
3
+ require "ostruct"
4
+
5
+ module BpmManager
6
+ module Oracle
7
+ # Gets all server deployments
8
+ # def self.deployments()
9
+ # return JSON.parse(RestClient.get(BpmManager.uri('/deployment'), :accept => :json))
10
+ # end
11
+
12
+ # Gets all tasks, optionally you could specify an user id
13
+ def self.tasks(user_id = "")
14
+ self.structure_task_data(JSON.parse(RestClient.get(BpmManager.uri('/tasks' + (user_id.empty? ? '' : '/' + user_id)), :accept => :json)))
15
+ end
16
+
17
+ # Gets all tasks with options
18
+ # def self.tasks_with_opts(opts = {})
19
+ # self.structure_task_data(JSON.parse(RestClient.get(BpmManager.uri('/task/query' + (opts.empty? ? '' : '?' + opts.map{|k,v| k.to_s + '=' + v.to_s}.join('&'))), :accept => :json)))
20
+ # end
21
+
22
+ # Gets all Process Instances
23
+ def self.process_instances
24
+ JSON.parse(RestClient.get(BpmManager.uri('/processes'), :accept => :json))
25
+ end
26
+
27
+ # Gets a Process Instance
28
+ def self.process_instance(process_instance_id)
29
+ JSON.parse(RestClient.get(BpmManager.uri('/process/' + process_instance_id.to_s), :accept => :json))
30
+ end
31
+
32
+ # Gets a Process Instance Variables
33
+ # def self.process_instance_variables(deployment_id, process_instance_id)
34
+ # begin
35
+ # JSON.parse(RestClient.get(BpmManager.uri('/runtime/' + deployment_id.to_s + '/withvars/process/instance/' + process_instance_id.to_s), :accept => :json))['variables']
36
+ # rescue
37
+ # return nil
38
+ # end
39
+ # end
40
+
41
+ # Assigns a Task for an User
42
+ # def self.assign_task(task_id, user_id)
43
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/delegate?targetEntityId=' + user_id.to_s)), :headers => {:content_type => :json, :accept => :json})
44
+ # end
45
+
46
+ # Starts a Task
47
+ # def self.start_task(task_id)
48
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/start')), :headers => {:content_type => :json, :accept => :json})
49
+ # end
50
+
51
+ # Stops a Task
52
+ # def self.stop_task(task_id)
53
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/stop')), :headers => {:content_type => :json, :accept => :json})
54
+ # end
55
+
56
+ # Suspends a Task
57
+ # def self.suspend_task(task_id)
58
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/suspend')), :headers => {:content_type => :json, :accept => :json})
59
+ # end
60
+
61
+ # Resumes a Task
62
+ # def self.resume_task(task_id)
63
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/resumes')), :headers => {:content_type => :json, :accept => :json})
64
+ # end
65
+
66
+ # Releases a Task
67
+ # def self.release_task(task_id)
68
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/release')), :headers => {:content_type => :json, :accept => :json})
69
+ # end
70
+
71
+ # Skips a Task
72
+ # def self.skip_task(task_id)
73
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/skip')), :headers => {:content_type => :json, :accept => :json})
74
+ # end
75
+
76
+ # Completes a Task
77
+ # def self.complete_task(task_id, opts = {})
78
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/complete')), :headers => {:content_type => :json, :accept => :json})
79
+ # end
80
+
81
+ # Fails a Task
82
+ # def self.fail_task(task_id)
83
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/fail')), :headers => {:content_type => :json, :accept => :json})
84
+ # end
85
+
86
+ # Exits a Task
87
+ # def self.exit_task(task_id)
88
+ # RestClient.post(URI.encode(BpmManager.uri('/task/' + task_id.to_s + '/exit')), :headers => {:content_type => :json, :accept => :json})
89
+ # end
90
+
91
+ private
92
+ def self.structure_task_data(input)
93
+ tasks = []
94
+
95
+ logger.debug '-------> ' + input.inspect
96
+
97
+ unless input.nil?
98
+ input.each do |task|
99
+ my_task = OpenStruct.new
100
+ my_task.process = OpenStruct.new
101
+ process_info = task['processInfo'].to_h
102
+
103
+ my_task.id = task['number']
104
+ my_task.process_instance_id = task['task-summary']['process-instance-id']
105
+ my_task.parent_id = task['task-summary']['parent_id']
106
+ my_task.created_on = Time.at(task['created-on'])
107
+ my_task.active_on = Time.at(task['created-on'])
108
+ my_task.name = task['title']
109
+ my_task.owner = task['assigned']
110
+ my_task.status = task['status']
111
+ my_task.subject = ''
112
+ my_task.description = ''
113
+ my_task.data = process_info
114
+
115
+ my_task.process.data = ''
116
+ my_task.process.deployment_id = ''
117
+ my_task.process.id = task['processId']
118
+
119
+ my_task.process.instance_id = task['processInstanceId']
120
+ my_task.process.start_on = Time.at(task['created-on'])
121
+ my_task.process.name = task['processName']
122
+ my_task.process.version = process_info['revision']
123
+ my_task.process.creator = 'Not defined'
124
+ my_task.process.variables = '' # self.process_instance_variables(my_task.process.deployment_id, my_task.process.instance_id)
125
+ tasks << my_task
126
+ end
127
+ end
128
+
129
+ return tasks
130
+ end
131
+ end
132
+ end
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.5.3"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/bpm_manager.rb CHANGED
@@ -8,10 +8,9 @@ module BpmManager
8
8
 
9
9
  # Defines the Configuration for the gem
10
10
  class Configuration
11
- attr_accessor :bpm_vendor, :bpm_url, :bpm_url_suffix, :bpm_username, :bpm_password, :bpm_use_ssl
11
+ attr_accessor :bpm_url, :bpm_url_suffix, :bpm_username, :bpm_password, :bpm_use_ssl
12
12
 
13
13
  def initialize
14
- @bpm_vendor = ""
15
14
  @bpm_url = ""
16
15
  @bpm_url_suffix = ""
17
16
  @bpm_username = ""
@@ -0,0 +1,175 @@
1
+ require 'spec_helper'
2
+ require 'ruby-debug'
3
+
4
+ describe BpmManager do
5
+ before :all do
6
+ BpmManager.configure do |config|
7
+ config.bpm_url = "54.69.103.84:7101"
8
+ config.bpm_url_suffix = "/bpm/service/rest"
9
+ config.bpm_username = "weblogic"
10
+ config.bpm_password = "bc-admin"
11
+ config.bpm_use_ssl = false
12
+ end
13
+ end
14
+
15
+ describe "#uri" do
16
+ before :each do
17
+ @uri = BpmManager.uri('/test')
18
+ end
19
+
20
+ it "expect to be a String" do
21
+ expect(@uri).to be_an_instance_of String
22
+ end
23
+
24
+ it "expect to not be nil" do
25
+ expect(@uri).not_to eq(nil)
26
+ end
27
+ end
28
+
29
+ describe "#configuration" do
30
+ before :each do
31
+ @config = BpmManager.configuration
32
+ end
33
+
34
+ it "should be a class of type Configuration" do
35
+ expect(@config).to be_an_instance_of BpmManager::Configuration
36
+ end
37
+
38
+ it 'must have all the accesors' do
39
+ expect(@config.methods.include? :bpm_url).to be true
40
+ expect(@config.methods.include? :bpm_username).to be true
41
+ expect(@config.methods.include? :bpm_password).to be true
42
+ expect(@config.methods.include? :bpm_use_ssl).to be true
43
+ end
44
+ end
45
+
46
+ describe "Oracle" do
47
+ # describe "#deployments" do
48
+ # before :each do
49
+ # @deployments = BpmManager::Oracle.deployments
50
+ # end
51
+
52
+ # it "must return something" do
53
+ # expect(@deployments.length).to be > 0
54
+ # end
55
+ # end
56
+
57
+ describe "#tasks" do
58
+ before :each do
59
+ @tasks = BpmManager::Oracle.tasks('weblogic')
60
+ end
61
+
62
+ it "task should include the all attributes" do
63
+ # expect(@tasks.first.methods).to include(:id)
64
+ expect(@tasks.first.methods).to include(:process_instance_id)
65
+ # expect(@tasks.first.methods).to include(:parent_id)
66
+ # expect(@tasks.first.methods).to include(:created_on)
67
+ # expect(@tasks.first.methods).to include(:active_on)
68
+ # expect(@tasks.first.methods).to include(:name)
69
+ # expect(@tasks.first.methods).to include(:owner)
70
+ # expect(@tasks.first.methods).to include(:status)
71
+ # expect(@tasks.first.methods).to include(:subject)
72
+ # expect(@tasks.first.methods).to include(:description)
73
+ # expect(@tasks.first.methods).to include(:data)
74
+
75
+ # expect(@tasks.first.process.methods).to include(:id)
76
+ # expect(@tasks.first.process.methods).to include(:deployment_id)
77
+ # expect(@tasks.first.process.methods).to include(:instance_id)
78
+ # expect(@tasks.first.process.methods).to include(:start_on)
79
+ # expect(@tasks.first.process.methods).to include(:name)
80
+ # expect(@tasks.first.process.methods).to include(:version)
81
+ # expect(@tasks.first.process.methods).to include(:creator)
82
+ # expect(@tasks.first.process.methods).to include(:data)
83
+ end
84
+ end
85
+
86
+ # describe "#tasks_with_opts" do
87
+ # before :each do
88
+ # @tasks = BpmManager::Oracle.tasks_with_opts(:processInstanceId => 1)
89
+ # end
90
+
91
+ # it "task should include the all attributes" do
92
+ # expect(@tasks.first.methods).to include(:id)
93
+ # expect(@tasks.first.methods).to include(:process_instance_id)
94
+ # expect(@tasks.first.methods).to include(:parent_id)
95
+ # expect(@tasks.first.methods).to include(:created_on)
96
+ # expect(@tasks.first.methods).to include(:active_on)
97
+ # expect(@tasks.first.methods).to include(:name)
98
+ # expect(@tasks.first.methods).to include(:owner)
99
+ # expect(@tasks.first.methods).to include(:status)
100
+ # expect(@tasks.first.methods).to include(:subject)
101
+ # expect(@tasks.first.methods).to include(:description)
102
+ # expect(@tasks.first.methods).to include(:data)
103
+
104
+ # expect(@tasks.first.process.methods).to include(:id)
105
+ # expect(@tasks.first.process.methods).to include(:deployment_id)
106
+ # expect(@tasks.first.process.methods).to include(:instance_id)
107
+ # expect(@tasks.first.process.methods).to include(:start_on)
108
+ # expect(@tasks.first.process.methods).to include(:name)
109
+ # expect(@tasks.first.process.methods).to include(:version)
110
+ # expect(@tasks.first.process.methods).to include(:creator)
111
+ # expect(@tasks.first.process.methods).to include(:data)
112
+ # end
113
+ # end
114
+
115
+ # describe "#process_instances" do
116
+ # before :each do
117
+ # @processes = BpmManager::Oracle.process_instances
118
+ # end
119
+
120
+ # it "must return something" do
121
+ # expect(@processes.length).to be > 0
122
+ # end
123
+ # end
124
+
125
+ # describe "#process_instance" do
126
+ # before :each do
127
+ # @process = BpmManager::Oracle.process_instance(1)
128
+ # end
129
+
130
+ # it "must return something" do
131
+ # expect(@process.length).to be > 0
132
+ # end
133
+ # end
134
+
135
+ # describe "#process_instance_variables" do
136
+ # before :each do
137
+ # @variables = BpmManager::Oracle.process_instance_variables('com.beatcoding.simpletask:SimpleTask:1.0',1)
138
+ # end
139
+
140
+ # it "must return something" do
141
+ # expect(@variables.length).to be > 0
142
+ # end
143
+ # end
144
+
145
+ # describe "#assign_task" do
146
+ # before :each do
147
+ # @result = BpmManager::Oracle.assign_task(1,'foo@bar.com')
148
+ # end
149
+
150
+ # it "must return something" do
151
+ # expect(@result.length).to be > 0
152
+ # end
153
+ # end
154
+
155
+ # describe "#release_task" do
156
+ # before :each do
157
+ # @result = BpmManager::Oracle.release_task(1)
158
+ # end
159
+
160
+ # it "must return something" do
161
+ # expect(@result.length).to be > 0
162
+ # end
163
+ # end
164
+
165
+ # describe "#complete_task" do
166
+ # before :each do
167
+ # @result = BpmManager::Oracle.complete_task(1)
168
+ # end
169
+
170
+ # it "must return something" do
171
+ # expect(@result.length).to be > 0
172
+ # end
173
+ # end
174
+ end
175
+ end
data/spec/red_hat_spec.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  require 'spec_helper'
2
+ require 'ruby-debug'
2
3
 
3
4
  describe BpmManager do
4
5
  before :all do
5
6
  BpmManager.configure do |config|
6
- config.bpm_url = "bpm.server.com"
7
+ config.bpm_url = "bpm.beatcoding.com"
7
8
  config.bpm_url_suffix = "/jbpm-console/rest"
8
- config.bpm_username = "scott"
9
- config.bpm_password = "tiger"
9
+ config.bpm_username = "Administrator"
10
+ config.bpm_password = "bc-power"
10
11
  config.bpm_use_ssl = false
11
12
  end
12
13
  end
@@ -35,7 +36,6 @@ describe BpmManager do
35
36
  end
36
37
 
37
38
  it 'must have all the accesors' do
38
- expect(@config.methods.include? :bpm_vendor).to be true
39
39
  expect(@config.methods.include? :bpm_url).to be true
40
40
  expect(@config.methods.include? :bpm_username).to be true
41
41
  expect(@config.methods.include? :bpm_password).to be true
@@ -56,7 +56,7 @@ describe BpmManager do
56
56
 
57
57
  describe "#tasks" do
58
58
  before :each do
59
- @tasks = BpmManager::RedHat.tasks('foo@bar.com')
59
+ @tasks = BpmManager::RedHat.tasks('ariel@beatcoding.com')
60
60
  end
61
61
 
62
62
  it "task should include the all attributes" do
@@ -138,13 +138,13 @@ describe BpmManager do
138
138
  end
139
139
 
140
140
  it "must return something" do
141
- expect(@variables.length).to be > 0
141
+ expect(@variables.length).to be > 0 unless @variables.nil?
142
142
  end
143
143
  end
144
144
 
145
145
  describe "#assign_task" do
146
146
  before :each do
147
- @result = BpmManager::RedHat.assign_task(1,'foo@bar.com')
147
+ @result = BpmManager::RedHat.assign_task(1,'ariel@beatcoding.com')
148
148
  end
149
149
 
150
150
  it "must return something" do
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bpm_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-27 00:00:00.000000000 Z
11
+ date: 2015-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
@@ -56,14 +56,28 @@ dependencies:
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: ruby-debug19
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  description: Simple BPM integration with RedHat jBPM engine. Use this gem to avoid
@@ -81,10 +95,12 @@ files:
81
95
  - Rakefile
82
96
  - bpm_manager.gemspec
83
97
  - lib/bpm_manager.rb
98
+ - lib/bpm_manager/oracle.rb
84
99
  - lib/bpm_manager/red_hat.rb
85
100
  - lib/bpm_manager/version.rb
86
101
  - lib/generators/bpm_manager/bpm_manager.rb
87
102
  - lib/generators/bpm_manager/install_generator.rb
103
+ - spec/oracle_spec.rb
88
104
  - spec/red_hat_spec.rb
89
105
  - spec/spec_helper.rb
90
106
  homepage: http://www.beatcoding.com
@@ -112,5 +128,6 @@ signing_key:
112
128
  specification_version: 4
113
129
  summary: BPM Manager Gem for RedHat jBPM engine.
114
130
  test_files:
131
+ - spec/oracle_spec.rb
115
132
  - spec/red_hat_spec.rb
116
133
  - spec/spec_helper.rb