Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
z_stack
Activiti
提交
07860cb0
A
Activiti
项目概览
z_stack
/
Activiti
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Activiti
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07860cb0
编写于
2月 06, 2019
作者:
M
Miguel Ruiz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactoring adding util methods
上级
5a82a94e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
85 addition
and
176 deletion
+85
-176
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/ProcessVariablesTest.java
...ti/spring/conformance/variables/ProcessVariablesTest.java
+40
-83
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/TaskVariablesTest.java
...iviti/spring/conformance/variables/TaskVariablesTest.java
+45
-93
未找到文件。
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/ProcessVariablesTest.java
浏览文件 @
07860cb0
...
...
@@ -49,6 +49,8 @@ public class ProcessVariablesTest {
@Autowired
private
ProcessAdminRuntime
processAdminRuntime
;
private
String
processInstanceId
;
@Before
public
void
cleanUp
()
{
collectedEvents
.
clear
();
...
...
@@ -59,34 +61,15 @@ public class ProcessVariablesTest {
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
collectedEvents
.
clear
();
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
processRuntime
.
setVariables
(
new
SetVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
List
<
VariableInstance
>
variableInstanceList
=
processRuntime
.
variables
(
new
GetVariablesPayloadBuilder
().
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
String
valueOne
=
variableOne
.
getValue
();
assertThat
(
valueOne
).
isEqualTo
(
"variableOne"
);
String
nameOne
=
variableOne
.
getName
();
assertThat
(
nameOne
).
isEqualTo
(
"one"
);
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
checkVariableEvents
();
}
@Test
...
...
@@ -94,91 +77,74 @@ public class ProcessVariablesTest {
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
collectedEvents
.
clear
();
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
processRuntime
.
setVariables
(
new
SetVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
processRuntime
.
variables
(
new
GetVariablesPayloadBuilder
().
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
assertThat
(
variableOne
.
getTaskId
()).
isNull
();
assertThat
(
variableOne
.
getProcessInstanceId
()).
isEqualTo
(
processInstance
.
getId
()
);
assertThat
(
variableOne
.
getProcessInstanceId
()).
isEqualTo
(
processInstance
Id
);
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
checkVariableEvents
();
}
@Test
public
void
shouldNotBeTaskVariable
()
{
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
collectedEvents
.
clear
();
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
processRuntime
.
setVariables
(
new
SetVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
processRuntime
.
variables
(
new
GetVariablesPayloadBuilder
().
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
assertThat
(
variableOne
.
isTaskVariable
()).
isFalse
();
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
checkVariableEvents
();
}
@Test
public
void
shouldGetRightVariableType
(){
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
VariableInstance
variableTwo
=
variableInstanceList
.
get
(
1
);
assertThat
(
variableOne
.
getType
()).
isEqualTo
(
"string"
);
assertThat
(
variableTwo
.
getType
()).
isEqualTo
(
"integer"
);
checkVariableEvents
();
}
@After
public
void
cleanup
()
{
securityUtil
.
logInAs
(
"admin"
);
Page
<
ProcessInstance
>
processInstancePage
=
processAdminRuntime
.
processInstances
(
Pageable
.
of
(
0
,
50
));
for
(
ProcessInstance
pi
:
processInstancePage
.
getContent
())
{
processAdminRuntime
.
delete
(
ProcessPayloadBuilder
.
delete
(
pi
.
getId
()));
}
}
private
void
startProcess
(){
processInstanceId
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
.
build
())
.
getId
()
;
collectedEvents
.
clear
();
}
private
List
<
VariableInstance
>
setVariables
(){
startProcess
();
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
processRuntime
.
setVariables
(
new
SetVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
processRuntime
.
variables
(
new
GetVariablesPayloadBuilder
().
withProcessInstanceId
(
processInstance
.
getId
()).
build
());
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
VariableInstance
variableTwo
=
variableInstanceList
.
get
(
1
);
assertThat
(
variableOne
.
getType
()).
isEqualTo
(
"string"
);
assertThat
(
variableTwo
.
getType
()).
isEqualTo
(
"integer"
);
processRuntime
.
setVariables
(
new
SetVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withProcessInstanceId
(
processInstanceId
).
build
());
return
processRuntime
.
variables
(
new
GetVariablesPayloadBuilder
().
withProcessInstanceId
(
processInstanceId
).
build
());
}
private
void
checkVariableEvents
(){
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
...
...
@@ -187,13 +153,4 @@ public class ProcessVariablesTest {
);
}
@After
public
void
cleanup
()
{
securityUtil
.
logInAs
(
"admin"
);
Page
<
ProcessInstance
>
processInstancePage
=
processAdminRuntime
.
processInstances
(
Pageable
.
of
(
0
,
50
));
for
(
ProcessInstance
pi
:
processInstancePage
.
getContent
())
{
processAdminRuntime
.
delete
(
ProcessPayloadBuilder
.
delete
(
pi
.
getId
()));
}
}
}
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/TaskVariablesTest.java
浏览文件 @
07860cb0
...
...
@@ -47,6 +47,10 @@ public class TaskVariablesTest {
@Autowired
private
ProcessAdminRuntime
processAdminRuntime
;
private
String
taskId
;
private
String
processInstanceId
;
@Before
public
void
cleanUp
()
{
collectedEvents
.
clear
();
...
...
@@ -57,38 +61,15 @@ public class TaskVariablesTest {
securityUtil
.
logInAs
(
"user1"
);
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
collectedEvents
.
clear
();
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
Task
task
=
tasks
.
getContent
().
get
(
0
);
assertThat
(
tasks
.
getTotalItems
()).
isEqualTo
(
1
);
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
taskRuntime
.
setVariables
(
new
SetTaskVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withTaskId
(
task
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
taskRuntime
.
variables
(
new
GetTaskVariablesPayloadBuilder
().
withTaskId
(
task
.
getId
()).
build
());
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
String
valueOne
=
variableOne
.
getValue
();
assertThat
(
valueOne
).
isEqualTo
(
"variableOne"
);
String
nameOne
=
variableOne
.
getName
();
assertThat
(
nameOne
).
isEqualTo
(
"one"
);
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
checkVariableEvents
();
}
@Test
...
...
@@ -96,101 +77,81 @@ public class TaskVariablesTest {
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
collectedEvents
.
clear
();
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
Task
task
=
tasks
.
getContent
().
get
(
0
);
assertThat
(
tasks
.
getTotalItems
()).
isEqualTo
(
1
);
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
taskRuntime
.
setVariables
(
new
SetTaskVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withTaskId
(
task
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
List
<
VariableInstance
>
variableInstanceList
=
taskRuntime
.
variables
(
new
GetTaskVariablesPayloadBuilder
().
withTaskId
(
task
.
getId
()).
build
());
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
assertThat
(
variableOne
.
getTaskId
()).
isEqualTo
(
task
.
getId
()
);
assertThat
(
variableOne
.
getProcessInstanceId
()).
isEqualTo
(
processInstance
.
getId
()
);
assertThat
(
variableOne
.
getTaskId
()).
isEqualTo
(
task
Id
);
assertThat
(
variableOne
.
getProcessInstanceId
()).
isEqualTo
(
processInstance
Id
);
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
checkVariableEvents
();
}
@Test
public
void
shouldBeTaskVariable
()
{
securityUtil
.
logInAs
(
"user1"
);
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
collectedEvents
.
clear
();
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
Task
task
=
tasks
.
getContent
().
get
(
0
);
assertThat
(
tasks
.
getTotalItems
()).
isEqualTo
(
1
);
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
taskRuntime
.
setVariables
(
new
SetTaskVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withTaskId
(
task
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
taskRuntime
.
variables
(
new
GetTaskVariablesPayloadBuilder
().
withTaskId
(
task
.
getId
()).
build
());
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
assertThat
(
variableOne
.
isTaskVariable
()).
isTrue
();
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
checkVariableEvents
();
}
@Test
public
void
shouldGetRightVariableType
(){
securityUtil
.
logInAs
(
"user1"
);
processRuntime
.
start
(
ProcessPayloadBuilder
List
<
VariableInstance
>
variableInstanceList
=
setVariables
();
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
VariableInstance
variableTwo
=
variableInstanceList
.
get
(
1
);
assertThat
(
variableOne
.
getType
()).
isEqualTo
(
"string"
);
assertThat
(
variableTwo
.
getType
()).
isEqualTo
(
"integer"
);
checkVariableEvents
();
}
@After
public
void
cleanup
()
{
securityUtil
.
logInAs
(
"admin"
);
Page
<
ProcessInstance
>
processInstancePage
=
processAdminRuntime
.
processInstances
(
Pageable
.
of
(
0
,
50
));
for
(
ProcessInstance
pi
:
processInstancePage
.
getContent
())
{
processAdminRuntime
.
delete
(
ProcessPayloadBuilder
.
delete
(
pi
.
getId
()));
}
}
private
void
startProcess
(){
processInstanceId
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
processKey
)
.
withBusinessKey
(
"my-business-key"
)
.
withName
(
"my-process-instance-name"
)
.
build
());
.
build
())
.
getId
()
;
collectedEvents
.
clear
();
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
Task
task
=
tasks
.
getContent
().
get
(
0
);
taskId
=
tasks
.
getContent
().
get
(
0
).
getId
(
);
assertThat
(
tasks
.
getTotalItems
()).
isEqualTo
(
1
);
}
private
List
<
VariableInstance
>
setVariables
(){
startProcess
();
Map
<
String
,
Object
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"one"
,
"variableOne"
);
variablesMap
.
put
(
"two"
,
2
);
taskRuntime
.
setVariables
(
new
SetTaskVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withTaskId
(
task
.
getId
()).
build
());
List
<
VariableInstance
>
variableInstanceList
=
taskRuntime
.
variables
(
new
GetTaskVariablesPayloadBuilder
().
withTaskId
(
task
.
getId
()).
build
());
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
VariableInstance
variableTwo
=
variableInstanceList
.
get
(
1
);
assertThat
(
variableOne
.
getType
()).
isEqualTo
(
"string"
);
assertThat
(
variableTwo
.
getType
()).
isEqualTo
(
"integer"
);
taskRuntime
.
setVariables
(
new
SetTaskVariablesPayloadBuilder
().
withVariables
(
variablesMap
).
withTaskId
(
taskId
).
build
());
return
taskRuntime
.
variables
(
new
GetTaskVariablesPayloadBuilder
().
withTaskId
(
taskId
).
build
());
}
private
void
checkVariableEvents
(){
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
...
...
@@ -199,13 +160,4 @@ public class TaskVariablesTest {
);
}
@After
public
void
cleanup
()
{
securityUtil
.
logInAs
(
"admin"
);
Page
<
ProcessInstance
>
processInstancePage
=
processAdminRuntime
.
processInstances
(
Pageable
.
of
(
0
,
50
));
for
(
ProcessInstance
pi
:
processInstancePage
.
getContent
())
{
processAdminRuntime
.
delete
(
ProcessPayloadBuilder
.
delete
(
pi
.
getId
()));
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录