Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
z_stack
Activiti
提交
76a9abb8
A
Activiti
项目概览
z_stack
/
Activiti
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
76a9abb8
编写于
2月 05, 2019
作者:
M
Miguel Ruiz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding events check to tests
上级
3cbc3f6d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
44 addition
and
8 deletion
+44
-8
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/TaskVariablesTest.java
...iviti/spring/conformance/variables/TaskVariablesTest.java
+42
-3
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/VariablesRuntimeTestConfiguration.java
...formance/variables/VariablesRuntimeTestConfiguration.java
+2
-5
未找到文件。
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/TaskVariablesTest.java
浏览文件 @
76a9abb8
package
org.activiti.spring.conformance.variables
;
import
org.activiti.api.model.shared.event.RuntimeEvent
;
import
org.activiti.api.model.shared.event.VariableEvent
;
import
org.activiti.api.process.model.ProcessInstance
;
import
org.activiti.api.process.model.builders.ProcessPayloadBuilder
;
import
org.activiti.api.process.runtime.ProcessAdminRuntime
;
...
...
@@ -55,13 +57,15 @@ public class TaskVariablesTest {
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
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
);
...
...
@@ -69,6 +73,7 @@ public class TaskVariablesTest {
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
());
...
...
@@ -77,6 +82,13 @@ public class TaskVariablesTest {
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
);
}
@Test
...
...
@@ -91,6 +103,8 @@ public class TaskVariablesTest {
.
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
);
...
...
@@ -105,19 +119,28 @@ public class TaskVariablesTest {
assertThat
(
variableOne
.
getTaskId
()).
isEqualTo
(
task
.
getId
());
assertThat
(
variableOne
.
getProcessInstanceId
()).
isEqualTo
(
processInstance
.
getId
());
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
}
@Test
public
void
shouldBeTaskVariable
()
{
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
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
);
...
...
@@ -131,19 +154,28 @@ public class TaskVariablesTest {
VariableInstance
variableOne
=
variableInstanceList
.
get
(
0
);
assertThat
(
variableOne
.
isTaskVariable
()).
isTrue
();
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
}
@Test
public
void
shouldGetRightVariableType
(){
securityUtil
.
logInAs
(
"user1"
);
ProcessInstance
processInstance
=
processRuntime
.
start
(
ProcessPayloadBuilder
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
);
...
...
@@ -158,6 +190,13 @@ public class TaskVariablesTest {
VariableInstance
variableTwo
=
variableInstanceList
.
get
(
1
);
assertThat
(
variableOne
.
getType
()).
isEqualTo
(
"string"
);
assertThat
(
variableTwo
.
getType
()).
isEqualTo
(
"integer"
);
assertThat
(
collectedEvents
)
.
extracting
(
RuntimeEvent:
:
getEventType
)
.
containsExactly
(
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
,
VariableEvent
.
VariableEvents
.
VARIABLE_CREATED
);
}
@After
...
...
activiti-spring-conformance-tests/activiti-spring-conformance-variables/src/test/java/org/activiti/spring/conformance/variables/VariablesRuntimeTestConfiguration.java
浏览文件 @
76a9abb8
...
...
@@ -14,20 +14,17 @@ import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListe
import
org.activiti.api.runtime.shared.events.VariableEventListener
;
import
org.activiti.api.task.runtime.events.*
;
import
org.activiti.api.task.runtime.events.listener.TaskEventListener
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
public
class
VariablesRuntimeTestConfiguration
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
VariablesRuntimeTestConfiguration
.
class
);
public
static
List
<
RuntimeEvent
>
collectedEvents
=
new
ArrayList
<>();
@Bean
public
BPMNElementEventListener
<
BPMNActivityStartedEvent
>
bpmnActivityStartedListener
()
{
return
bpmnActivityStartedEvent
->
collectedEvents
.
add
(
bpmnActivityStartedEvent
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录