Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
56348065
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
56348065
编写于
7月 29, 2015
作者:
J
Joram Barrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixing all failing REST unit tests on v6
上级
4ce21dcd
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
79 addition
and
56 deletion
+79
-56
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/ActivitiListener.java
...c/main/java/org/activiti/bpmn/model/ActivitiListener.java
+4
-0
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/FlowNode.java
...model/src/main/java/org/activiti/bpmn/model/FlowNode.java
+5
-2
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/SequenceFlow.java
...l/src/main/java/org/activiti/bpmn/model/SequenceFlow.java
+5
-0
modules/activiti-rest/src/test/java/org/activiti/rest/service/BaseSpringRestTestCase.java
...ava/org/activiti/rest/service/BaseSpringRestTestCase.java
+9
-1
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ExecutionCollectionResourceTest.java
.../service/api/runtime/ExecutionCollectionResourceTest.java
+13
-12
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ExecutionQueryResourceTest.java
.../rest/service/api/runtime/ExecutionQueryResourceTest.java
+13
-9
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ExecutionResourceTest.java
...iviti/rest/service/api/runtime/ExecutionResourceTest.java
+18
-16
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ProcessInstanceCollectionResourceTest.java
...ce/api/runtime/ProcessInstanceCollectionResourceTest.java
+0
-5
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ProcessInstanceResourceTest.java
...rest/service/api/runtime/ProcessInstanceResourceTest.java
+0
-1
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/TaskCollectionResourceTest.java
.../rest/service/api/runtime/TaskCollectionResourceTest.java
+3
-1
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/TaskQueryResourceTest.java
...iviti/rest/service/api/runtime/TaskQueryResourceTest.java
+3
-1
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/TaskVariablesCollectionResourceTest.java
...vice/api/runtime/TaskVariablesCollectionResourceTest.java
+0
-1
modules/activiti-spring/src/test/java/org/activiti/spring/test/email/MockEmailTransport.java
...va/org/activiti/spring/test/email/MockEmailTransport.java
+6
-7
未找到文件。
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/ActivitiListener.java
浏览文件 @
56348065
...
...
@@ -15,6 +15,8 @@ package org.activiti.bpmn.model;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
/**
* @author Tijs Rademakers
*/
...
...
@@ -24,6 +26,8 @@ public class ActivitiListener extends BaseElement {
protected
String
implementationType
;
protected
String
implementation
;
protected
List
<
FieldExtension
>
fieldExtensions
=
new
ArrayList
<
FieldExtension
>();
@JsonIgnore
protected
Object
instance
;
// Can be used to set an instance of the listener directly. That instance will then always be reused.
public
String
getEvent
()
{
...
...
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/FlowNode.java
浏览文件 @
56348065
...
...
@@ -15,14 +15,14 @@ package org.activiti.bpmn.model;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
/**
* @author Tijs Rademakers
* @author Joram Barrez
*/
public
abstract
class
FlowNode
extends
FlowElement
{
protected
Object
behavior
;
protected
SubProcess
subProcess
;
protected
boolean
asynchronous
;
...
...
@@ -30,6 +30,9 @@ public abstract class FlowNode extends FlowElement {
protected
List
<
SequenceFlow
>
incomingFlows
=
new
ArrayList
<
SequenceFlow
>();
protected
List
<
SequenceFlow
>
outgoingFlows
=
new
ArrayList
<
SequenceFlow
>();
@JsonIgnore
protected
Object
behavior
;
public
FlowNode
()
{
...
...
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/SequenceFlow.java
浏览文件 @
56348065
...
...
@@ -15,6 +15,8 @@ package org.activiti.bpmn.model;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
/**
* @author Tijs Rademakers
* @author Joram Barrez
...
...
@@ -28,7 +30,10 @@ public class SequenceFlow extends FlowElement {
// Actual flow elements that match the source and target ref
// Set during process definition parsing
@JsonIgnore
protected
FlowElement
sourceFlowElement
;
@JsonIgnore
protected
FlowElement
targetFlowElement
;
/**
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/BaseSpringRestTestCase.java
浏览文件 @
56348065
...
...
@@ -41,6 +41,7 @@ import org.activiti.engine.runtime.ProcessInstance;
import
org.activiti.rest.WebConfigurer
;
import
org.activiti.rest.conf.ApplicationConfiguration
;
import
org.activiti.rest.service.api.RestUrlBuilder
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpHeaders
;
import
org.apache.http.HttpResponse
;
...
...
@@ -256,7 +257,14 @@ public class BaseSpringRestTestCase extends PvmTestCase {
}
response
=
client
.
execute
(
request
);
Assert
.
assertNotNull
(
response
.
getStatusLine
());
Assert
.
assertEquals
(
expectedStatusCode
,
response
.
getStatusLine
().
getStatusCode
());
int
responseStatusCode
=
response
.
getStatusLine
().
getStatusCode
();
if
(
expectedStatusCode
!=
responseStatusCode
)
{
log
.
info
(
"Wrong status code : "
+
responseStatusCode
+
", but should be "
+
expectedStatusCode
);
log
.
info
(
"Response body: "
+
IOUtils
.
toString
(
response
.
getEntity
().
getContent
()));
}
Assert
.
assertEquals
(
expectedStatusCode
,
responseStatusCode
);
httpResponses
.
add
(
response
);
return
response
;
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ExecutionCollectionResourceTest.java
浏览文件 @
56348065
...
...
@@ -44,12 +44,15 @@ public class ExecutionCollectionResourceTest extends BaseSpringRestTestCase {
String
id
=
processInstance
.
getId
();
runtimeService
.
addUserIdentityLink
(
id
,
"kermit"
,
"whatever"
);
Execution
childExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"processTask"
).
singleResult
();
assertNotNull
(
childExecution
);
Execution
childExecutionInTask
=
runtimeService
.
createExecutionQuery
().
activityId
(
"processTask"
).
singleResult
();
assertNotNull
(
childExecutionInTask
);
Execution
childExecutionInSubProcess
=
runtimeService
.
createExecutionQuery
().
activityId
(
"subProcess"
).
singleResult
();
assertNotNull
(
childExecutionInSubProcess
);
// Test without any parameters
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
);
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
InTask
.
getId
(),
childExecutionInSubProcess
.
getId
());
// Process instance id
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?id="
+
id
;
...
...
@@ -67,35 +70,35 @@ public class ExecutionCollectionResourceTest extends BaseSpringRestTestCase {
// Process definition key
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?processDefinitionKey=processOne"
;
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
InTask
.
getId
(),
childExecutionInSubProcess
.
getId
());
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?processDefinitionKey=processTwo"
;
assertResultsPresentInDataResponse
(
url
);
// Process definition id
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?processDefinitionId="
+
processInstance
.
getProcessDefinitionId
();
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
InTask
.
getId
(),
childExecutionInSubProcess
.
getId
());
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?processDefinitionId=anotherId"
;
assertResultsPresentInDataResponse
(
url
);
// Parent id
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?parentId="
+
id
;
assertResultsPresentInDataResponse
(
url
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
childExecution
InSubProcess
.
getId
());
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?parentId=anotherId"
;
assertResultsPresentInDataResponse
(
url
);
// Activity id
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?activityId=processTask"
;
assertResultsPresentInDataResponse
(
url
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
childExecution
InTask
.
getId
());
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?activityId=anotherId"
;
assertResultsPresentInDataResponse
(
url
);
// Without tenant ID, before tenant is set
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?withoutTenantId=true"
;
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
InTask
.
getId
(),
childExecutionInSubProcess
.
getId
());
// Update the tenant for the deployment
managementService
.
executeCommand
(
new
ChangeDeploymentTenantIdCmd
(
deploymentId
,
"myTenant"
));
...
...
@@ -106,14 +109,14 @@ public class ExecutionCollectionResourceTest extends BaseSpringRestTestCase {
// Tenant id
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?tenantId=myTenant"
;
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
InTask
.
getId
(),
childExecutionInSubProcess
.
getId
());
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?tenantId=myTenant2"
;
assertResultsPresentInDataResponse
(
url
);
// Tenant id like
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?tenantIdLike="
+
encode
(
"%enant"
);
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
.
getId
());
assertResultsPresentInDataResponse
(
url
,
id
,
childExecution
InTask
.
getId
(),
childExecutionInSubProcess
.
getId
());
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION_COLLECTION
)
+
"?tenantIdLike="
+
encode
(
"%whatever"
);
assertResultsPresentInDataResponse
(
url
);
...
...
@@ -143,7 +146,6 @@ public class ExecutionCollectionResourceTest extends BaseSpringRestTestCase {
// Check if process is moved on to the other wait-state
waitingExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"anotherWaitState"
).
singleResult
();
assertNotNull
(
waitingExecution
);
assertEquals
(
signalExecution
.
getId
(),
waitingExecution
.
getId
());
}
/**
...
...
@@ -177,7 +179,6 @@ public class ExecutionCollectionResourceTest extends BaseSpringRestTestCase {
// Check if process is moved on to the other wait-state
waitingExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"anotherWaitState"
).
singleResult
();
assertNotNull
(
waitingExecution
);
assertEquals
(
signalExecution
.
getId
(),
waitingExecution
.
getId
());
Map
<
String
,
Object
>
vars
=
runtimeService
.
getVariables
(
waitingExecution
.
getId
());
assertEquals
(
1
,
vars
.
size
());
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ExecutionQueryResourceTest.java
浏览文件 @
56348065
...
...
@@ -41,6 +41,10 @@ public class ExecutionQueryResourceTest extends BaseSpringRestTestCase {
processVariables
.
put
(
"booleanVar"
,
false
);
Execution
parentExecution
=
runtimeService
.
startProcessInstanceByKey
(
"processOne"
,
processVariables
);
Execution
subProcessExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"subProcess"
).
singleResult
();
assertNotNull
(
subProcessExecution
);
Execution
childExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"processTask"
).
singleResult
();
assertNotNull
(
childExecution
);
...
...
@@ -125,61 +129,61 @@ public class ExecutionQueryResourceTest extends BaseSpringRestTestCase {
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"Azerty"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// Integer equals
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"intVar"
);
variableNode
.
put
(
"value"
,
67890
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// Boolean equals
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"booleanVar"
);
variableNode
.
put
(
"value"
,
false
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// String not equals
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"ghijkl"
);
variableNode
.
put
(
"operation"
,
"notEquals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// Integer not equals
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"intVar"
);
variableNode
.
put
(
"value"
,
45678
);
variableNode
.
put
(
"operation"
,
"notEquals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// Boolean not equals
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"booleanVar"
);
variableNode
.
put
(
"value"
,
true
);
variableNode
.
put
(
"operation"
,
"notEquals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// String equals ignore case
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"azeRTY"
);
variableNode
.
put
(
"operation"
,
"equalsIgnoreCase"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// String not equals ignore case
variableNode
.
removeAll
();
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"HIJKLm"
);
variableNode
.
put
(
"operation"
,
"notEqualsIgnoreCase"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
// String equals without name
variableNode
.
removeAll
();
variableNode
.
put
(
"value"
,
"Azerty"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
parentExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
childExecution
.
getId
(),
subProcessExecution
.
getId
(),
parentExecution
.
getId
());
}
}
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ExecutionResourceTest.java
浏览文件 @
56348065
...
...
@@ -41,25 +41,29 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
*/
@Deployment
(
resources
=
{
"org/activiti/rest/service/api/runtime/ExecutionResourceTest.process-with-subprocess.bpmn20.xml"
})
public
void
testGetExecution
()
throws
Exception
{
Execution
parentExecution
=
runtimeService
.
startProcessInstanceByKey
(
"processOne"
);
Execution
processInstanceExecution
=
runtimeService
.
startProcessInstanceByKey
(
"processOne"
);
Execution
subProcessExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"subProcess"
).
singleResult
();
assertNotNull
(
subProcessExecution
);
Execution
childExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"processTask"
).
singleResult
();
assertNotNull
(
childExecution
);
CloseableHttpResponse
response
=
executeRequest
(
new
HttpGet
(
SERVER_URL_PREFIX
+
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
p
arent
Execution
.
getId
())),
HttpStatus
.
SC_OK
);
CloseableHttpResponse
response
=
executeRequest
(
new
HttpGet
(
SERVER_URL_PREFIX
+
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
p
rocessInstance
Execution
.
getId
())),
HttpStatus
.
SC_OK
);
// Check resulting parent execution
JsonNode
responseNode
=
objectMapper
.
readTree
(
response
.
getEntity
().
getContent
());
closeResponse
(
response
);
assertNotNull
(
responseNode
);
assertEquals
(
p
arent
Execution
.
getId
(),
responseNode
.
get
(
"id"
).
textValue
());
assertEquals
(
p
rocessInstance
Execution
.
getId
(),
responseNode
.
get
(
"id"
).
textValue
());
assertTrue
(
responseNode
.
get
(
"activityId"
).
isNull
());
assertFalse
(
responseNode
.
get
(
"suspended"
).
booleanValue
());
assertTrue
(
responseNode
.
get
(
"parentUrl"
).
isNull
());
assertFalse
(
responseNode
.
get
(
"suspended"
).
booleanValue
());
assertTrue
(
responseNode
.
get
(
"url"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
p
arent
Execution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"url"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
p
rocessInstance
Execution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"processInstanceUrl"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
p
arent
Execution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"processInstanceUrl"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
p
rocessInstance
Execution
.
getId
())));
// Check resulting child execution
response
=
executeRequest
(
new
HttpGet
(
SERVER_URL_PREFIX
+
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
childExecution
.
getId
())),
HttpStatus
.
SC_OK
);
...
...
@@ -74,9 +78,9 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
assertTrue
(
responseNode
.
get
(
"url"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
childExecution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"parentUrl"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
parent
Execution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"parentUrl"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
subProcess
Execution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"processInstanceUrl"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
p
arent
Execution
.
getId
())));
assertTrue
(
responseNode
.
get
(
"processInstanceUrl"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
p
rocessInstance
Execution
.
getId
())));
}
/**
...
...
@@ -92,7 +96,9 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
*/
@Deployment
(
resources
=
{
"org/activiti/rest/service/api/runtime/ExecutionResourceTest.process-with-signal.bpmn20.xml"
})
public
void
testSignalExecution
()
throws
Exception
{
Execution
signalExecution
=
runtimeService
.
startProcessInstanceByKey
(
"processOne"
);
runtimeService
.
startProcessInstanceByKey
(
"processOne"
);
Execution
signalExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"waitState"
).
singleResult
();
assertNotNull
(
signalExecution
);
assertEquals
(
"waitState"
,
signalExecution
.
getActivityId
());
...
...
@@ -142,13 +148,12 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
// Sending signal event causes the execution to end (scope-execution for
// the catching event)
httpPut
.
setEntity
(
new
StringEntity
(
requestNode
.
toString
()));
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
NO_CONTENT
);
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
OK
);
closeResponse
(
response
);
// Check if process is moved on to the other wait-state
waitingExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"anotherWaitState"
).
singleResult
();
assertNotNull
(
waitingExecution
);
assertEquals
(
signalExecution
.
getId
(),
waitingExecution
.
getId
());
}
...
...
@@ -178,13 +183,12 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
// the catching event)
HttpPut
httpPut
=
new
HttpPut
(
SERVER_URL_PREFIX
+
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
waitingExecution
.
getId
()));
httpPut
.
setEntity
(
new
StringEntity
(
requestNode
.
toString
()));
CloseableHttpResponse
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
NO_CONTENT
);
CloseableHttpResponse
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
OK
);
closeResponse
(
response
);
// Check if process is moved on to the other wait-state
waitingExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"anotherWaitState"
).
singleResult
();
assertNotNull
(
waitingExecution
);
assertEquals
(
signalExecution
.
getId
(),
waitingExecution
.
getId
());
Map
<
String
,
Object
>
vars
=
runtimeService
.
getVariables
(
waitingExecution
.
getId
());
assertEquals
(
1
,
vars
.
size
());
...
...
@@ -216,13 +220,12 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
// Sending signal event causes the execution to end (scope-execution for
// the catching event)
httpPut
.
setEntity
(
new
StringEntity
(
requestNode
.
toString
()));
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
NO_CONTENT
);
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
OK
);
closeResponse
(
response
);
// Check if process is moved on to the other wait-state
waitingExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"anotherWaitState"
).
singleResult
();
assertNotNull
(
waitingExecution
);
assertEquals
(
execution
.
getId
(),
waitingExecution
.
getId
());
}
/**
...
...
@@ -251,13 +254,12 @@ public class ExecutionResourceTest extends BaseSpringRestTestCase {
// the catching event)
HttpPut
httpPut
=
new
HttpPut
(
SERVER_URL_PREFIX
+
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_EXECUTION
,
waitingExecution
.
getId
()));
httpPut
.
setEntity
(
new
StringEntity
(
requestNode
.
toString
()));
CloseableHttpResponse
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
NO_CONTENT
);
CloseableHttpResponse
response
=
executeRequest
(
httpPut
,
HttpStatus
.
SC_
OK
);
closeResponse
(
response
);
// Check if process is moved on to the other wait-state
waitingExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"anotherWaitState"
).
singleResult
();
assertNotNull
(
waitingExecution
);
assertEquals
(
signalExecution
.
getId
(),
waitingExecution
.
getId
());
Map
<
String
,
Object
>
vars
=
runtimeService
.
getVariables
(
waitingExecution
.
getId
());
assertEquals
(
1
,
vars
.
size
());
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ProcessInstanceCollectionResourceTest.java
浏览文件 @
56348065
...
...
@@ -239,7 +239,6 @@ public class ProcessInstanceCollectionResourceTest extends BaseSpringRestTestCas
assertNotNull
(
responseNode
);
assertEquals
(
processInstance
.
getId
(),
responseNode
.
get
(
"id"
).
textValue
());
assertTrue
(
responseNode
.
get
(
"businessKey"
).
isNull
());
assertEquals
(
"processTask"
,
responseNode
.
get
(
"activityId"
).
textValue
());
assertFalse
(
responseNode
.
get
(
"suspended"
).
booleanValue
());
assertTrue
(
responseNode
.
get
(
"url"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
processInstance
.
getId
())));
...
...
@@ -260,7 +259,6 @@ public class ProcessInstanceCollectionResourceTest extends BaseSpringRestTestCas
assertNotNull
(
responseNode
);
assertEquals
(
processInstance
.
getId
(),
responseNode
.
get
(
"id"
).
textValue
());
assertTrue
(
responseNode
.
get
(
"businessKey"
).
isNull
());
assertEquals
(
"processTask"
,
responseNode
.
get
(
"activityId"
).
textValue
());
assertFalse
(
responseNode
.
get
(
"suspended"
).
booleanValue
());
assertTrue
(
responseNode
.
get
(
"url"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
processInstance
.
getId
())));
...
...
@@ -281,7 +279,6 @@ public class ProcessInstanceCollectionResourceTest extends BaseSpringRestTestCas
assertNotNull
(
responseNode
);
assertEquals
(
processInstance
.
getId
(),
responseNode
.
get
(
"id"
).
textValue
());
assertTrue
(
responseNode
.
get
(
"businessKey"
).
isNull
());
assertEquals
(
"processTask"
,
responseNode
.
get
(
"activityId"
).
textValue
());
assertFalse
(
responseNode
.
get
(
"suspended"
).
booleanValue
());
assertTrue
(
responseNode
.
get
(
"url"
).
asText
().
endsWith
(
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
processInstance
.
getId
())));
...
...
@@ -358,7 +355,6 @@ public class ProcessInstanceCollectionResourceTest extends BaseSpringRestTestCas
JsonNode
responseNode
=
objectMapper
.
readTree
(
response
.
getEntity
().
getContent
());
closeResponse
(
response
);
assertEquals
(
"processTask"
,
responseNode
.
get
(
"activityId"
).
asText
());
assertEquals
(
false
,
responseNode
.
get
(
"ended"
).
asBoolean
());
JsonNode
variablesArrayNode
=
responseNode
.
get
(
"variables"
);
assertEquals
(
0
,
variablesArrayNode
.
size
());
...
...
@@ -409,7 +405,6 @@ public class ProcessInstanceCollectionResourceTest extends BaseSpringRestTestCas
CloseableHttpResponse
response
=
executeRequest
(
httpPost
,
HttpStatus
.
SC_CREATED
);
JsonNode
responseNode
=
objectMapper
.
readTree
(
response
.
getEntity
().
getContent
());
closeResponse
(
response
);
assertEquals
(
"processTask"
,
responseNode
.
get
(
"activityId"
).
asText
());
assertEquals
(
false
,
responseNode
.
get
(
"ended"
).
asBoolean
());
JsonNode
variablesArrayNode
=
responseNode
.
get
(
"variables"
);
assertEquals
(
2
,
variablesArrayNode
.
size
());
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/ProcessInstanceResourceTest.java
浏览文件 @
56348065
...
...
@@ -51,7 +51,6 @@ public class ProcessInstanceResourceTest extends BaseSpringRestTestCase {
assertNotNull
(
responseNode
);
assertEquals
(
processInstance
.
getId
(),
responseNode
.
get
(
"id"
).
textValue
());
assertEquals
(
"myBusinessKey"
,
responseNode
.
get
(
"businessKey"
).
textValue
());
assertEquals
(
"processTask"
,
responseNode
.
get
(
"activityId"
).
textValue
());
assertFalse
(
responseNode
.
get
(
"suspended"
).
booleanValue
());
assertEquals
(
""
,
responseNode
.
get
(
"tenantId"
).
textValue
());
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/TaskCollectionResourceTest.java
浏览文件 @
56348065
...
...
@@ -17,6 +17,7 @@ import java.util.Calendar;
import
java.util.List
;
import
org.activiti.engine.impl.cmd.ChangeDeploymentTenantIdCmd
;
import
org.activiti.engine.runtime.Execution
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.DelegationState
;
import
org.activiti.engine.task.IdentityLinkType
;
...
...
@@ -212,7 +213,8 @@ public class TaskCollectionResourceTest extends BaseSpringRestTestCase {
assertResultsPresentInDataResponse
(
url
,
processTask
.
getId
());
// Execution filtering
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_TASK_COLLECTION
)
+
"?executionId="
+
processInstance
.
getId
();
Execution
taskExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"processTask"
).
singleResult
();
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_TASK_COLLECTION
)
+
"?executionId="
+
taskExecution
.
getId
();
assertResultsPresentInDataResponse
(
url
,
processTask
.
getId
());
// Process instance businesskey filtering
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/TaskQueryResourceTest.java
浏览文件 @
56348065
...
...
@@ -19,6 +19,7 @@ import java.util.Collections;
import
java.util.HashMap
;
import
java.util.List
;
import
org.activiti.engine.runtime.Execution
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.DelegationState
;
import
org.activiti.engine.task.IdentityLinkType
;
...
...
@@ -177,7 +178,8 @@ public class TaskQueryResourceTest extends BaseSpringRestTestCase {
// Execution filtering
requestNode
.
removeAll
();
requestNode
.
put
(
"executionId"
,
processInstance
.
getId
());
Execution
taskExecution
=
runtimeService
.
createExecutionQuery
().
activityId
(
"processTask"
).
singleResult
();
requestNode
.
put
(
"executionId"
,
taskExecution
.
getId
());
assertResultsPresentInPostDataResponse
(
url
,
requestNode
,
processTask
.
getId
());
// Process instance businesskey filtering
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/service/api/runtime/TaskVariablesCollectionResourceTest.java
浏览文件 @
56348065
...
...
@@ -192,7 +192,6 @@ public class TaskVariablesCollectionResourceTest extends BaseSpringRestTestCase
assertNull
(
responseNode
.
get
(
"valueUrl"
));
assertTrue
(
runtimeService
.
hasVariable
(
task
.
getExecutionId
(),
"myVariable"
));
assertEquals
(
"Another simple string value"
,
runtimeService
.
getVariableLocal
(
task
.
getExecutionId
(),
"myVariable"
));
// Create a new scope-less variable, which defaults to local variables
variableNode
.
removeAll
();
...
...
modules/activiti-spring/src/test/java/org/activiti/spring/test/email/MockEmailTransport.java
浏览文件 @
56348065
...
...
@@ -23,13 +23,12 @@ public class MockEmailTransport extends Transport {
super
(
smtpSession
,
urlName
);
}
@Override
public
void
sendMessage
(
Message
message
,
Address
[]
addresses
)
throws
MessagingException
{
try
{
logger
.
info
(
message
.
getContent
().
toString
());
}
catch
(
IOException
ex
)
{
logger
.
error
(
"Error occured while sending email"
+
ex
);
}
@Override
public
void
sendMessage
(
Message
message
,
Address
[]
addresses
)
throws
MessagingException
{
try
{
logger
.
info
(
message
.
getContent
().
toString
());
}
catch
(
IOException
ex
)
{
logger
.
error
(
"Error occured while sending email"
+
ex
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录