Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
c9469fc2
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,发现更多精彩内容 >>
提交
c9469fc2
编写于
4月 15, 2015
作者:
J
Joram Barrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixing various tests with simple fixes. Leaving the hard ones for Tijs.
上级
d7a57ff4
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
113 addition
and
121 deletion
+113
-121
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java
...gine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java
+4
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/IntermediateTimerCatchEventActivityBehavior.java
...behavior/IntermediateTimerCatchEventActivityBehavior.java
+43
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/ActivityBehaviorFactory.java
...ine/impl/bpmn/parser/factory/ActivityBehaviorFactory.java
+4
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
...l/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
+6
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/TimerEventDefinitionParseHandler.java
...bpmn/parser/handler/TimerEventDefinitionParseHandler.java
+3
-68
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceCmd.java
...org/activiti/engine/impl/cmd/StartProcessInstanceCmd.java
+3
-2
modules/activiti-engine/src/main/java/org/activiti/engine/impl/util/TimerUtil.java
...rc/main/java/org/activiti/engine/impl/util/TimerUtil.java
+2
-2
modules/activiti-engine/src/main/java/org/activiti/engine/test/TestActivityBehaviorFactory.java
...org/activiti/engine/test/TestActivityBehaviorFactory.java
+6
-0
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/Execution.xml
...in/resources/org/activiti/db/mapping/entity/Execution.xml
+1
-1
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/event/ActivityEventsTest.java
...rg/activiti/engine/test/api/event/ActivityEventsTest.java
+36
-42
modules/activiti-engine/src/test/java/org/activiti/standalone/deploy/CustomDeploymentCache.java
...org/activiti/standalone/deploy/CustomDeploymentCache.java
+3
-0
modules/activiti-engine/src/test/resources/activiti.cfg.xml
modules/activiti-engine/src/test/resources/activiti.cfg.xml
+2
-2
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java
浏览文件 @
c9469fc2
...
...
@@ -85,11 +85,11 @@ public class AbstractBpmnActivityBehavior extends FlowNodeActivityBehavior {
}
@Override
public
void
trigger
(
ActivityExecution
execution
,
String
signalName
,
Object
signal
Data
)
{
if
(
"compensationDone"
.
equals
(
signal
Name
))
{
signalCompensationDone
(
execution
,
signal
Data
);
public
void
trigger
(
ActivityExecution
execution
,
String
triggerName
,
Object
trigger
Data
)
{
if
(
"compensationDone"
.
equals
(
trigger
Name
))
{
signalCompensationDone
(
execution
,
trigger
Data
);
}
else
{
super
.
trigger
(
execution
,
signalName
,
signal
Data
);
super
.
trigger
(
execution
,
triggerName
,
trigger
Data
);
}
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/IntermediateTimerCatchEventActivityBehavior.java
0 → 100644
浏览文件 @
c9469fc2
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.bpmn.behavior
;
import
org.activiti.bpmn.model.BoundaryEvent
;
import
org.activiti.bpmn.model.TimerEventDefinition
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.context.Context
;
import
org.activiti.engine.impl.jobexecutor.TriggerTimerEventJobHandler
;
import
org.activiti.engine.impl.persistence.entity.ExecutionEntity
;
import
org.activiti.engine.impl.persistence.entity.TimerEntity
;
import
org.activiti.engine.impl.pvm.delegate.ActivityExecution
;
import
org.activiti.engine.impl.util.TimerUtil
;
public
class
IntermediateTimerCatchEventActivityBehavior
extends
AbstractBpmnActivityBehavior
{
protected
TimerEventDefinition
timerEventDefinition
;
public
IntermediateTimerCatchEventActivityBehavior
(
TimerEventDefinition
timerEventDefinition
)
{
this
.
timerEventDefinition
=
timerEventDefinition
;
}
public
void
execute
(
ActivityExecution
execution
)
{
TimerEntity
timer
=
TimerUtil
.
createTimerEntityForTimerEventDefinition
(
timerEventDefinition
,
false
,
(
ExecutionEntity
)
execution
,
TriggerTimerEventJobHandler
.
TYPE
,
execution
.
getCurrentActivityId
());
Context
.
getCommandContext
().
getJobEntityManager
().
schedule
(
timer
);
}
@Override
public
void
trigger
(
ActivityExecution
execution
,
String
triggerName
,
Object
triggerData
)
{
leave
(
execution
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/ActivityBehaviorFactory.java
浏览文件 @
c9469fc2
...
...
@@ -53,6 +53,7 @@ import org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBeha
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowCompensationEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowNoneEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowSignalEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateTimerCatchEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.ManualTaskActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior
;
...
...
@@ -175,6 +176,8 @@ public interface ActivityBehaviorFactory {
public
abstract
IntermediateCatchEventActivityBehavior
createIntermediateCatchEventActivityBehavior
(
IntermediateCatchEvent
intermediateCatchEvent
);
public
abstract
IntermediateTimerCatchEventActivityBehavior
createIntermediateTimerCatchEventActivityBehavior
(
IntermediateCatchEvent
intermediateCatchEvent
,
TimerEventDefinition
timerEventDefinition
);
public
abstract
IntermediateThrowNoneEventActivityBehavior
createIntermediateThrowNoneEventActivityBehavior
(
ThrowEvent
throwEvent
);
public
abstract
IntermediateThrowSignalEventActivityBehavior
createIntermediateThrowSignalEventActivityBehavior
(
ThrowEvent
throwEvent
,
Signal
signal
,
...
...
@@ -182,6 +185,7 @@ public interface ActivityBehaviorFactory {
public
abstract
IntermediateThrowCompensationEventActivityBehavior
createIntermediateThrowCompensationEventActivityBehavior
(
ThrowEvent
throwEvent
,
CompensateEventDefinition
compensateEventDefinition
);
public
abstract
NoneEndEventActivityBehavior
createNoneEndEventActivityBehavior
(
EndEvent
endEvent
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
浏览文件 @
c9469fc2
...
...
@@ -60,6 +60,7 @@ import org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBeha
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowCompensationEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowNoneEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowSignalEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateTimerCatchEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.ManualTaskActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior
;
...
...
@@ -379,6 +380,11 @@ public class DefaultActivityBehaviorFactory extends AbstractBehaviorFactory impl
public
IntermediateCatchEventActivityBehavior
createIntermediateCatchEventActivityBehavior
(
IntermediateCatchEvent
intermediateCatchEvent
)
{
return
new
IntermediateCatchEventActivityBehavior
();
}
@Override
public
IntermediateTimerCatchEventActivityBehavior
createIntermediateTimerCatchEventActivityBehavior
(
IntermediateCatchEvent
intermediateCatchEvent
,
TimerEventDefinition
timerEventDefinition
)
{
return
new
IntermediateTimerCatchEventActivityBehavior
(
timerEventDefinition
);
}
public
IntermediateThrowNoneEventActivityBehavior
createIntermediateThrowNoneEventActivityBehavior
(
ThrowEvent
throwEvent
)
{
return
new
IntermediateThrowNoneEventActivityBehavior
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/TimerEventDefinitionParseHandler.java
浏览文件 @
c9469fc2
...
...
@@ -12,30 +12,17 @@
*/
package
org.activiti.engine.impl.bpmn.parser.handler
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.bpmn.model.BaseElement
;
import
org.activiti.bpmn.model.BoundaryEvent
;
import
org.activiti.bpmn.model.IntermediateCatchEvent
;
import
org.activiti.bpmn.model.TimerEventDefinition
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.bpmn.parser.BpmnParse
;
import
org.activiti.engine.impl.el.ExpressionManager
;
import
org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl
;
import
org.activiti.engine.impl.jobexecutor.TimerDeclarationType
;
import
org.activiti.engine.impl.pvm.process.ScopeImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author Joram Barrez
*/
public
class
TimerEventDefinitionParseHandler
extends
AbstractBpmnParseHandler
<
TimerEventDefinition
>
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TimerEventDefinitionParseHandler
.
class
);
public
Class
<?
extends
BaseElement
>
getHandledType
()
{
return
TimerEventDefinition
.
class
;
}
...
...
@@ -44,21 +31,9 @@ public class TimerEventDefinitionParseHandler extends AbstractBpmnParseHandler<T
if
(
bpmnParse
.
getCurrentFlowElement
()
instanceof
IntermediateCatchEvent
)
{
throw
new
RuntimeException
(
"Need to implement"
);
// timerActivity.setProperty("type", "intermediateTimer");
// TimerDeclarationImpl timerDeclaration = createTimer(bpmnParse,
// timerEventDefinition, timerActivity,
// TimerCatchIntermediateEventJobHandler.TYPE);
// if (getPrecedingEventBasedGateway(bpmnParse,
// (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement()) !=
// null) {
// addTimerDeclaration(timerActivity.getParent(), timerDeclaration);
// } else {
// addTimerDeclaration(timerActivity, timerDeclaration);
// timerActivity.setScope(true);
// }
IntermediateCatchEvent
intermediateCatchEvent
=
(
IntermediateCatchEvent
)
bpmnParse
.
getCurrentFlowElement
();
intermediateCatchEvent
.
setBehavior
(
bpmnParse
.
getActivityBehaviorFactory
().
createIntermediateTimerCatchEventActivityBehavior
(
intermediateCatchEvent
,
timerEventDefinition
));
}
else
if
(
bpmnParse
.
getCurrentFlowElement
()
instanceof
BoundaryEvent
)
{
BoundaryEvent
boundaryEvent
=
(
BoundaryEvent
)
bpmnParse
.
getCurrentFlowElement
();
...
...
@@ -67,44 +42,4 @@ public class TimerEventDefinitionParseHandler extends AbstractBpmnParseHandler<T
}
}
protected
TimerDeclarationImpl
createTimer
(
BpmnParse
bpmnParse
,
TimerEventDefinition
timerEventDefinition
,
ScopeImpl
timerActivity
,
String
jobHandlerType
)
{
TimerDeclarationType
type
=
null
;
Expression
expression
=
null
;
ExpressionManager
expressionManager
=
bpmnParse
.
getExpressionManager
();
if
(
StringUtils
.
isNotEmpty
(
timerEventDefinition
.
getTimeDate
()))
{
// TimeDate
type
=
TimerDeclarationType
.
DATE
;
expression
=
expressionManager
.
createExpression
(
timerEventDefinition
.
getTimeDate
());
}
else
if
(
StringUtils
.
isNotEmpty
(
timerEventDefinition
.
getTimeCycle
()))
{
// TimeCycle
type
=
TimerDeclarationType
.
CYCLE
;
expression
=
expressionManager
.
createExpression
(
timerEventDefinition
.
getTimeCycle
());
}
else
if
(
StringUtils
.
isNotEmpty
(
timerEventDefinition
.
getTimeDuration
()))
{
// TimeDuration
type
=
TimerDeclarationType
.
DURATION
;
expression
=
expressionManager
.
createExpression
(
timerEventDefinition
.
getTimeDuration
());
}
// neither date, cycle or duration configured!
if
(
expression
==
null
)
{
logger
.
warn
(
"Timer needs configuration (either timeDate, timeCycle or timeDuration is needed) ("
+
timerActivity
.
getId
()
+
")"
);
}
// Parse the timer declaration
// TODO move the timer declaration into the bpmn activity or next to the TimerSession
TimerDeclarationImpl
timerDeclaration
=
new
TimerDeclarationImpl
(
expression
,
type
,
jobHandlerType
);
timerDeclaration
.
setJobHandlerConfiguration
(
timerActivity
.
getId
());
timerDeclaration
.
setExclusive
(
true
);
return
timerDeclaration
;
}
@SuppressWarnings
(
"unchecked"
)
protected
void
addTimerDeclaration
(
ScopeImpl
scope
,
TimerDeclarationImpl
timerDeclaration
)
{
List
<
TimerDeclarationImpl
>
timerDeclarations
=
(
List
<
TimerDeclarationImpl
>)
scope
.
getProperty
(
PROPERTYNAME_TIMER_DECLARATION
);
if
(
timerDeclarations
==
null
)
{
timerDeclarations
=
new
ArrayList
<
TimerDeclarationImpl
>();
scope
.
setProperty
(
PROPERTYNAME_TIMER_DECLARATION
,
timerDeclarations
);
}
timerDeclarations
.
add
(
timerDeclaration
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceCmd.java
浏览文件 @
c9469fc2
...
...
@@ -176,8 +176,9 @@ public class StartProcessInstanceCmd<T> implements Command<ProcessInstance>, Ser
return
processInstance
;
}
protected
ExecutionEntity
createProcessInstance
(
CommandContext
commandContext
,
ProcessDefinitionEntity
processDefinitionEntity
,
String
businessKey
,
String
initiatorVariableName
,
FlowElement
initialFlowElement
)
{
protected
ExecutionEntity
createProcessInstance
(
CommandContext
commandContext
,
ProcessDefinitionEntity
processDefinitionEntity
,
String
businessKey
,
String
initiatorVariableName
,
FlowElement
initialFlowElement
)
{
ExecutionEntity
processInstance
=
new
ExecutionEntity
();
processInstance
.
setProcessDefinitionId
(
processDefinitionEntity
.
getId
());
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/util/TimerUtil.java
浏览文件 @
c9469fc2
...
...
@@ -33,8 +33,8 @@ public class TimerUtil {
* Takes in an optional execution, if missing the
* {@link NoExecutionVariableScope} will be used (eg Timer start event)
*/
public
static
TimerEntity
createTimerEntityForTimerEventDefinition
(
TimerEventDefinition
timerEventDefinition
,
boolean
isInterruptingTimer
,
ExecutionEntity
executionEntity
,
String
jobHandlerType
,
String
jobHandlerConfig
)
{
public
static
TimerEntity
createTimerEntityForTimerEventDefinition
(
TimerEventDefinition
timerEventDefinition
,
boolean
isInterruptingTimer
,
ExecutionEntity
executionEntity
,
String
jobHandlerType
,
String
jobHandlerConfig
)
{
String
businessCalendarRef
=
null
;
Expression
expression
=
null
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/test/TestActivityBehaviorFactory.java
浏览文件 @
c9469fc2
...
...
@@ -61,6 +61,7 @@ import org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBeha
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowCompensationEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowNoneEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateThrowSignalEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.IntermediateTimerCatchEventActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.ManualTaskActivityBehavior
;
import
org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior
;
...
...
@@ -290,6 +291,11 @@ public class TestActivityBehaviorFactory extends AbstractBehaviorFactory impleme
public
IntermediateCatchEventActivityBehavior
createIntermediateCatchEventActivityBehavior
(
IntermediateCatchEvent
intermediateCatchEvent
)
{
return
wrappedActivityBehaviorFactory
.
createIntermediateCatchEventActivityBehavior
(
intermediateCatchEvent
);
}
@Override
public
IntermediateTimerCatchEventActivityBehavior
createIntermediateTimerCatchEventActivityBehavior
(
IntermediateCatchEvent
intermediateCatchEvent
,
TimerEventDefinition
timerEventDefinition
)
{
return
wrappedActivityBehaviorFactory
.
createIntermediateTimerCatchEventActivityBehavior
(
intermediateCatchEvent
,
timerEventDefinition
);
}
@Override
public
IntermediateThrowNoneEventActivityBehavior
createIntermediateThrowNoneEventActivityBehavior
(
ThrowEvent
throwEvent
)
{
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/Execution.xml
浏览文件 @
c9469fc2
...
...
@@ -352,7 +352,7 @@
inner join ${prefix}ACT_RU_VARIABLE A${index} on RES.ID_ = A${index}.EXECUTION_ID_
</when>
<otherwise>
inner join ${prefix}ACT_RU_VARIABLE A${index} on RES.
PROC_INST_
ID_ = A${index}.PROC_INST_ID_
inner join ${prefix}ACT_RU_VARIABLE A${index} on RES.ID_ = A${index}.PROC_INST_ID_
</otherwise>
</choose>
</foreach>
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/event/ActivityEventsTest.java
浏览文件 @
c9469fc2
...
...
@@ -88,8 +88,7 @@ public class ActivityEventsTest extends PluggableActivitiTestCase {
*/
@Deployment
public
void
testActivityEvents
()
throws
Exception
{
// We're interested in the raw events, alter the listener to keep those
// as well
// We're interested in the raw events, alter the listener to keep those as well
listener
.
setIgnoreRawActivityEvents
(
false
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"activityProcess"
);
...
...
@@ -590,47 +589,42 @@ public class ActivityEventsTest extends PluggableActivitiTestCase {
/**
* Test events related to message events, called from the API.
*/
//
@Deployment
@Deployment
public
void
testActivityMessageBoundaryEventsOnSubProcess
()
throws
Exception
{
// Uncomment the annotation and the lines below.
// This test made 400 other test fail ...
assertEquals
(
1
,
2
);
// ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("messageOnSubProcess");
// assertNotNull(processInstance);
//
// Execution executionWithMessage = runtimeService.createExecutionQuery().activityId("cloudformtask1").singleResult();
// assertNotNull(executionWithMessage);
//
// runtimeService.messageEventReceived("message_1", executionWithMessage.getId());
// assertEquals(2, listener.getEventsReceived().size());
//
// // First, a message-event is expected
// assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiMessageEvent);
// ActivitiMessageEvent messageEvent = (ActivitiMessageEvent) listener.getEventsReceived().get(0);
// assertEquals(ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED, messageEvent.getType());
// assertEquals("boundaryMessageEventCatching", messageEvent.getActivityId());
// assertEquals(executionWithMessage.getId(), messageEvent.getExecutionId());
// assertEquals(executionWithMessage.getProcessInstanceId(), messageEvent.getProcessInstanceId());
// assertEquals(processInstance.getProcessDefinitionId(), messageEvent.getProcessDefinitionId());
// assertEquals("message_1", messageEvent.getMessageName());
// assertNull(messageEvent.getMessageData());
//
// // Next, an signal-event is expected, as a result of the message
// assertTrue(listener.getEventsReceived().get(1) instanceof ActivitiActivityCancelledEvent);
// ActivitiActivityCancelledEvent signalEvent = (ActivitiActivityCancelledEvent) listener.getEventsReceived().get(1);
// assertEquals(ActivitiEventType.ACTIVITY_CANCELLED, signalEvent.getType());
// assertEquals("cloudformtask1", signalEvent.getActivityId());
// assertEquals(executionWithMessage.getId(), signalEvent.getExecutionId());
// assertEquals(executionWithMessage.getProcessInstanceId(), signalEvent.getProcessInstanceId());
// assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
// assertNotNull(signalEvent.getCause());
// assertTrue(signalEvent.getCause() instanceof MessageEventSubscriptionEntity);
// MessageEventSubscriptionEntity cause = (MessageEventSubscriptionEntity) signalEvent.getCause();
// assertEquals("message_1", cause.getEventName());
//
// assertDatabaseEventPresent(ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"messageOnSubProcess"
);
assertNotNull
(
processInstance
);
Execution
executionWithMessage
=
runtimeService
.
createExecutionQuery
().
activityId
(
"cloudformtask1"
).
singleResult
();
assertNotNull
(
executionWithMessage
);
runtimeService
.
messageEventReceived
(
"message_1"
,
executionWithMessage
.
getId
());
assertEquals
(
2
,
listener
.
getEventsReceived
().
size
());
// First, a message-event is expected
assertTrue
(
listener
.
getEventsReceived
().
get
(
0
)
instanceof
ActivitiMessageEvent
);
ActivitiMessageEvent
messageEvent
=
(
ActivitiMessageEvent
)
listener
.
getEventsReceived
().
get
(
0
);
assertEquals
(
ActivitiEventType
.
ACTIVITY_MESSAGE_RECEIVED
,
messageEvent
.
getType
());
assertEquals
(
"boundaryMessageEventCatching"
,
messageEvent
.
getActivityId
());
assertEquals
(
executionWithMessage
.
getId
(),
messageEvent
.
getExecutionId
());
assertEquals
(
executionWithMessage
.
getProcessInstanceId
(),
messageEvent
.
getProcessInstanceId
());
assertEquals
(
processInstance
.
getProcessDefinitionId
(),
messageEvent
.
getProcessDefinitionId
());
assertEquals
(
"message_1"
,
messageEvent
.
getMessageName
());
assertNull
(
messageEvent
.
getMessageData
());
// Next, an signal-event is expected, as a result of the message
assertTrue
(
listener
.
getEventsReceived
().
get
(
1
)
instanceof
ActivitiActivityCancelledEvent
);
ActivitiActivityCancelledEvent
signalEvent
=
(
ActivitiActivityCancelledEvent
)
listener
.
getEventsReceived
().
get
(
1
);
assertEquals
(
ActivitiEventType
.
ACTIVITY_CANCELLED
,
signalEvent
.
getType
());
assertEquals
(
"cloudformtask1"
,
signalEvent
.
getActivityId
());
assertEquals
(
executionWithMessage
.
getId
(),
signalEvent
.
getExecutionId
());
assertEquals
(
executionWithMessage
.
getProcessInstanceId
(),
signalEvent
.
getProcessInstanceId
());
assertEquals
(
processInstance
.
getProcessDefinitionId
(),
signalEvent
.
getProcessDefinitionId
());
assertNotNull
(
signalEvent
.
getCause
());
assertTrue
(
signalEvent
.
getCause
()
instanceof
MessageEventSubscriptionEntity
);
MessageEventSubscriptionEntity
cause
=
(
MessageEventSubscriptionEntity
)
signalEvent
.
getCause
();
assertEquals
(
"message_1"
,
cause
.
getEventName
());
assertDatabaseEventPresent
(
ActivitiEventType
.
ACTIVITY_MESSAGE_RECEIVED
);
}
@Deployment
...
...
modules/activiti-engine/src/test/java/org/activiti/standalone/deploy/CustomDeploymentCache.java
浏览文件 @
c9469fc2
...
...
@@ -61,6 +61,9 @@ public class CustomDeploymentCache implements DeploymentCache<ProcessDefinitionC
// For testing purposes only
public
ProcessDefinitionEntity
getCachedProcessDefinition
()
{
if
(
entry
==
null
)
{
return
null
;
}
return
entry
.
getProcessDefinitionEntity
();
}
...
...
modules/activiti-engine/src/test/resources/activiti.cfg.xml
浏览文件 @
c9469fc2
...
...
@@ -16,11 +16,11 @@
<property
name=
"databaseSchemaUpdate"
value=
"drop-create"
/>
<!-- Test logger -->
<property
name=
"configurators"
>
<
!-- <
property name="configurators">
<list>
<bean class="org.activiti.engine.test.impl.logger.ProcessExecutionLoggerConfigurator" />
</list>
</property>
</property>
-->
<!-- job executor configurations -->
<property
name=
"jobExecutorActivate"
value=
"false"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录