Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
z_stack
Activiti
提交
25a95ab5
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,发现更多精彩内容 >>
提交
25a95ab5
编写于
2月 06, 2019
作者:
M
mergify-bot
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into 'miguel-2338-variables-conformance-tests'
上级
6e43de26
19a32c38
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
152 addition
and
5 deletion
+152
-5
activiti-api-impl/activiti-api-task-runtime-impl/src/main/java/org/activiti/runtime/api/impl/TaskRuntimeImpl.java
...n/java/org/activiti/runtime/api/impl/TaskRuntimeImpl.java
+4
-0
activiti-spring-boot-starter/src/main/java/org/activiti/spring/boot/ActivitiProperties.java
...ain/java/org/activiti/spring/boot/ActivitiProperties.java
+3
-3
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/HistoryConfigurationTest.java
...va/org/activiti/spring/boot/HistoryConfigurationTest.java
+119
-0
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/tasks/TaskRuntimeStandaloneTaskTest.java
...viti/spring/boot/tasks/TaskRuntimeStandaloneTaskTest.java
+24
-2
activiti-spring-boot-starter/src/test/resources/application-history.properties
...starter/src/test/resources/application-history.properties
+2
-0
未找到文件。
activiti-api-impl/activiti-api-task-runtime-impl/src/main/java/org/activiti/runtime/api/impl/TaskRuntimeImpl.java
浏览文件 @
25a95ab5
...
...
@@ -249,6 +249,10 @@ public class TaskRuntimeImpl implements TaskRuntime {
@Override
public
Task
create
(
CreateTaskPayload
createTaskPayload
)
{
if
(
createTaskPayload
.
getName
()
==
null
||
createTaskPayload
.
getName
().
isEmpty
())
{
throw
new
IllegalStateException
(
"You cannot create a task without name"
);
}
org
.
activiti
.
engine
.
task
.
Task
task
=
taskService
.
newTask
();
task
.
setName
(
createTaskPayload
.
getName
());
task
.
setDescription
(
createTaskPayload
.
getDescription
());
...
...
activiti-spring-boot-starter/src/main/java/org/activiti/spring/boot/ActivitiProperties.java
浏览文件 @
25a95ab5
...
...
@@ -35,7 +35,7 @@ public class ActivitiProperties {
private
boolean
mailServerUseTls
;
private
String
databaseSchemaUpdate
=
"true"
;
private
String
databaseSchema
;
private
boolean
isD
bHistoryUsed
=
false
;
private
boolean
d
bHistoryUsed
=
false
;
private
HistoryLevel
historyLevel
=
HistoryLevel
.
NONE
;
private
String
processDefinitionLocationPrefix
=
ResourcePatternResolver
.
CLASSPATH_ALL_URL_PREFIX
+
"**/processes/"
;
private
List
<
String
>
processDefinitionLocationSuffixes
=
Arrays
.
asList
(
"**.bpmn20.xml"
,
"**.bpmn"
);
...
...
@@ -88,11 +88,11 @@ public class ActivitiProperties {
}
public
boolean
isDbHistoryUsed
()
{
return
isD
bHistoryUsed
;
return
d
bHistoryUsed
;
}
public
void
setDbHistoryUsed
(
boolean
isDbHistoryUsed
)
{
this
.
isD
bHistoryUsed
=
isDbHistoryUsed
;
this
.
d
bHistoryUsed
=
isDbHistoryUsed
;
}
public
HistoryLevel
getHistoryLevel
()
{
...
...
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/HistoryConfigurationTest.java
0 → 100644
浏览文件 @
25a95ab5
package
org.activiti.spring.boot
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
org.activiti.api.process.model.ProcessInstance
;
import
org.activiti.api.process.model.builders.ProcessPayloadBuilder
;
import
org.activiti.api.process.runtime.ProcessRuntime
;
import
org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration
;
import
org.activiti.core.common.spring.security.policies.ProcessSecurityPoliciesManager
;
import
org.activiti.engine.HistoryService
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.runtime.api.impl.ProcessAdminRuntimeImpl
;
import
org.activiti.runtime.api.impl.ProcessRuntimeImpl
;
import
org.activiti.runtime.api.model.impl.APIProcessDefinitionConverter
;
import
org.activiti.runtime.api.model.impl.APIProcessInstanceConverter
;
import
org.activiti.runtime.api.model.impl.APIVariableInstanceConverter
;
import
org.activiti.spring.boot.security.util.SecurityUtil
;
import
org.activiti.spring.boot.test.util.ProcessCleanUpUtil
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.test.context.TestPropertySource
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
NONE
)
@TestPropertySource
(
"classpath:application-history.properties"
)
public
class
HistoryConfigurationTest
{
private
static
final
String
CATEGORIZE_PROCESS
=
"categorizeProcess"
;
@Autowired
private
ProcessRuntime
processRuntime
;
@Autowired
private
SecurityUtil
securityUtil
;
@Autowired
private
RepositoryService
repositoryService
;
@Autowired
private
HistoryService
historyService
;
@Autowired
private
APIProcessDefinitionConverter
processDefinitionConverter
;
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
ProcessSecurityPoliciesManager
securityPoliciesManager
;
@Autowired
private
APIProcessInstanceConverter
processInstanceConverter
;
@Autowired
private
APIVariableInstanceConverter
variableInstanceConverter
;
@Autowired
private
ProcessRuntimeConfiguration
configuration
;
@Autowired
private
ApplicationEventPublisher
applicationEventPublisher
;
@Autowired
private
ProcessCleanUpUtil
processCleanUpUtil
;
@After
public
void
cleanUp
(){
processCleanUpUtil
.
cleanUpWithAdmin
();
}
@Before
public
void
init
()
{
ApplicationEventPublisher
eventPublisher
=
spy
(
applicationEventPublisher
);
spy
(
new
ProcessRuntimeImpl
(
repositoryService
,
processDefinitionConverter
,
runtimeService
,
securityPoliciesManager
,
processInstanceConverter
,
variableInstanceConverter
,
configuration
,
eventPublisher
));
spy
(
new
ProcessAdminRuntimeImpl
(
repositoryService
,
processDefinitionConverter
,
runtimeService
,
processInstanceConverter
,
eventPublisher
));
//Reset test variables
RuntimeTestConfiguration
.
processImageConnectorExecuted
=
false
;
RuntimeTestConfiguration
.
tagImageConnectorExecuted
=
false
;
RuntimeTestConfiguration
.
discardImageConnectorExecuted
=
false
;
}
@Test
public
void
shouldRecordHistory
()
{
securityUtil
.
logInAs
(
"salaboy"
);
//when
ProcessInstance
categorizeProcess
=
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
CATEGORIZE_PROCESS
)
.
withVariable
(
"expectedKey"
,
true
)
.
build
());
assertThat
(
RuntimeTestConfiguration
.
completedProcesses
).
contains
(
categorizeProcess
.
getId
());
assertThat
(
historyService
.
createHistoricProcessInstanceQuery
().
processInstanceId
(
categorizeProcess
.
getId
()).
count
()).
isEqualTo
(
1
);
}
}
\ No newline at end of file
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/tasks/TaskRuntimeStandaloneTaskTest.java
浏览文件 @
25a95ab5
package
org.activiti.spring.boot.tasks
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
catchThrowable
;
import
org.activiti.api.runtime.shared.query.Page
;
import
org.activiti.api.runtime.shared.query.Pageable
;
import
org.activiti.api.task.model.Task
;
...
...
@@ -16,8 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
NONE
)
public
class
TaskRuntimeStandaloneTaskTest
{
...
...
@@ -115,5 +116,26 @@ public class TaskRuntimeStandaloneTaskTest {
}
@Test
public
void
createStandaloneTaskFailWithEmptyName
()
{
securityUtil
.
logInAs
(
"salaboy"
);
//when
Throwable
throwable
=
catchThrowable
(()
->
taskRuntime
.
create
(
TaskPayloadBuilder
.
create
()
.
withAssignee
(
"salaboy"
)
.
build
()));
//then
assertThat
(
throwable
)
.
isInstanceOf
(
IllegalStateException
.
class
);
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
assertThat
(
tasks
.
getContent
()).
hasSize
(
0
);
}
}
activiti-spring-boot-starter/src/test/resources/application-history.properties
0 → 100644
浏览文件 @
25a95ab5
spring.activiti.dbHistoryUsed
=
true
spring.activiti.historyLevel
=
audit
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录