jruby_activiti 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/jruby_activiti/templates/initializer.rb +1 -1
- data/lib/jruby_activiti/version.rb +1 -1
- data/lib/jruby_activiti.rb +21 -13
- data/test/base_test.rb +31 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f0a93eb101989b4848b8163247a7bc291af024a
|
4
|
+
data.tar.gz: 2206467cd0bac8c5affab560814b82a37cf8a5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab7464720bfeaea53b840e408d2dbafb1a6140b5b578661a02c7fa70a22d304af4b0ad3227280cba1198a9173d7daebfab580c694eb3e8413cc91cce5290ad15
|
7
|
+
data.tar.gz: 3dffa1d82d9325692cdee98c3b426614dd47596fc3f2f86d278f258c8526c6911190a964062c5961490326546fdb283fd736a5c128f7136616789b05e3a232c4
|
@@ -1 +1 @@
|
|
1
|
-
Activiti = JrubyActiviti
|
1
|
+
Activiti = JrubyActiviti.build_engine
|
data/lib/jruby_activiti.rb
CHANGED
@@ -7,22 +7,30 @@ module JrubyActiviti
|
|
7
7
|
ConfigPath ||= "config/activiti.cfg.xml"
|
8
8
|
|
9
9
|
def self.build_engine
|
10
|
-
|
11
|
-
|
12
|
-
configuration = Java::OrgActivitiEngine::ProcessEngineConfiguration.
|
13
|
-
createProcessEngineConfigurationFromResource(ConfigPath)
|
14
|
-
@engine = configuration.buildProcessEngine
|
10
|
+
Activiti.build_engine
|
15
11
|
end
|
16
12
|
|
17
13
|
module Activiti
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
def self.build_engine
|
15
|
+
return self if @engine
|
16
|
+
|
17
|
+
configuration = Java::OrgActivitiEngine::ProcessEngineConfiguration.
|
18
|
+
createProcessEngineConfigurationFromResource(ConfigPath)
|
19
|
+
@engine = configuration.buildProcessEngine
|
20
|
+
self.set_activiti_const
|
21
|
+
|
22
|
+
return self
|
23
|
+
end
|
26
24
|
|
25
|
+
def self.set_activiti_const
|
26
|
+
const_set 'Engine', @engine
|
27
|
+
const_set 'RepositoryService', @engine.getRepositoryService()
|
28
|
+
const_set 'RuntimeService', @engine.getRuntimeService()
|
29
|
+
const_set 'TaskService', @engine.getTaskService()
|
30
|
+
const_set 'ManagementService', @engine.getManagementService()
|
31
|
+
const_set 'IdentityService', @engine.getIdentityService()
|
32
|
+
const_set 'HistoryService', @engine.getHistoryService()
|
33
|
+
const_set 'FormService', @engine.getFormService()
|
34
|
+
end
|
27
35
|
end
|
28
36
|
end
|
data/test/base_test.rb
CHANGED
@@ -2,9 +2,21 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
Bundler.require "h2"
|
4
4
|
|
5
|
-
Activiti = JrubyActiviti
|
5
|
+
Activiti = JrubyActiviti.build_engine
|
6
|
+
|
7
|
+
def assert_difference(cmd, target_count)
|
8
|
+
count1 = eval(cmd)
|
9
|
+
yield if block_given?
|
10
|
+
count2 = eval(cmd)
|
11
|
+
|
12
|
+
assert_equal target_count, count2-count1
|
13
|
+
end
|
6
14
|
|
7
15
|
class BaseTest < Minitest::Test
|
16
|
+
def before_setup
|
17
|
+
@@deployed ||= deploy_vacation_request
|
18
|
+
end
|
19
|
+
|
8
20
|
def deploy_vacation_request
|
9
21
|
Activiti::RepositoryService.createDeployment().
|
10
22
|
addClasspathResource("test/resources/VacationRequest.bpmn20.xml").
|
@@ -20,43 +32,44 @@ class BaseTest < Minitest::Test
|
|
20
32
|
end
|
21
33
|
|
22
34
|
def test_create_deploy
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
assert_equal 1, after_count - before_count
|
35
|
+
assert_difference 'Activiti::RepositoryService.createProcessDefinitionQuery().count()', 1 do
|
36
|
+
deploy_vacation_request
|
37
|
+
end
|
27
38
|
end
|
28
39
|
|
29
40
|
def test_create_process_instance
|
30
|
-
|
41
|
+
assert_difference 'Activiti::RuntimeService.createProcessInstanceQuery().count()', 1 do
|
42
|
+
Activiti::RuntimeService.startProcessInstanceByKey("vacationRequest", task_variables);
|
43
|
+
end
|
44
|
+
end
|
31
45
|
|
32
|
-
|
46
|
+
def test_create_process_instance_with_output
|
33
47
|
assert_output(/hello, this is a script task/) do
|
34
48
|
Activiti::RuntimeService.startProcessInstanceByKey("vacationRequest", task_variables);
|
35
49
|
end
|
36
|
-
|
37
|
-
instance_count = Activiti::RuntimeService.createProcessInstanceQuery().count()
|
38
|
-
assert_equal 1, instance_count
|
39
50
|
end
|
40
51
|
|
41
|
-
def
|
42
|
-
deploy_vacation_request
|
43
|
-
|
52
|
+
def test_task_query
|
44
53
|
Activiti::RuntimeService.startProcessInstanceByKey("vacationRequest", task_variables);
|
45
54
|
|
46
55
|
tasks = Activiti::TaskService.createTaskQuery().taskCandidateGroup("management").list();
|
47
|
-
task = tasks.first
|
48
|
-
assert_equal 'Handle vacation request', task.getName
|
56
|
+
task = tasks.first()
|
57
|
+
assert_equal 'Handle vacation request', task.getName()
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_complete_task
|
61
|
+
Activiti::RuntimeService.startProcessInstanceByKey("vacationRequest", task_variables);
|
49
62
|
|
50
63
|
tasks = Activiti::TaskService.createTaskQuery().taskCandidateGroup("management").list();
|
51
|
-
task = tasks.first
|
64
|
+
task = tasks.first()
|
52
65
|
task_variables = {
|
53
66
|
"vacationApproved" => "false",
|
54
67
|
"managerMotivation" => "We have a tight deadline!"
|
55
68
|
}
|
56
|
-
Activiti::TaskService.complete(task.getId, task_variables);
|
69
|
+
Activiti::TaskService.complete(task.getId(), task_variables);
|
57
70
|
|
58
71
|
tasks = Activiti::TaskService.createTaskQuery().taskAssignee("Kermit").list();
|
59
72
|
task = tasks.first
|
60
|
-
assert_equal 'Adjust vacation request', task.getName
|
73
|
+
assert_equal 'Adjust vacation request', task.getName()
|
61
74
|
end
|
62
75
|
end
|