Skip to content

Commit 34b1d10

Browse files
authored
Merge branch 'master' into classloader
2 parents fcc8481 + dcb0dd4 commit 34b1d10

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

src/main/java/com/alibaba/compileflow/engine/runtime/impl/AbstractProcessRuntime.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,9 @@ public String generateTestCode() {
231231
method.addAnnotation("@Test");
232232
method.addException(ClassWrapper.of(Exception.class));
233233
method.addBodyLine("String code = \"" + code + "\";");
234+
234235
String engineCode = isBpmn20() ? "ProcessEngine<BpmnModel> engine = ProcessEngineFactory.getProcessEngine(FlowModelType.BPMN);"
235-
: "ProcessEngine<TbbpmModel> engine = ProcessEngineFactory.getProcessEngine();";
236+
: "ProcessEngine engine = ProcessEngineFactory.getProcessEngine();";
236237
method.addBodyLine(engineCode);
237238
method.addBodyLine("System.out.println(engine.getJavaCode(code));");
238239
method.addBodyLine("Map<String, Object> context = new HashMap<String, Object>();");
@@ -244,7 +245,7 @@ public String generateTestCode() {
244245
}
245246
}
246247
method.addBodyLine("try {");
247-
method.addBodyLine("System.out.println(engine.start(code, context));");
248+
method.addBodyLine("System.out.println(engine.execute(code, context));");
248249
method.addBodyLine("}");
249250
method.addBodyLine("catch (Exception e) {");
250251
method.addBodyLine("e.printStackTrace();");
@@ -564,10 +565,7 @@ private void validateRuntime() {
564565

565566
@SuppressWarnings("unchecked")
566567
protected List<ValidateMessage> validateFlowModel() {
567-
//Class<? extends FlowModelValidator> validatorClass = FlowModelType.BPMN.equals(getFlowModelType())
568-
// ? BpmnModelValidator.class : TbbpmModelValidator.class;
569-
//return ExtensionInvoker.getInstance().invoke(FlowModelValidator.CODE, validatorClass,
570-
// ReduceFilter.allCollectionNonEmpty(), flowModel);
568+
571569
FlowModelValidator validator = ModelValidatorFactory.getFlowModelValidator(getFlowModelType());
572570
List<ValidateMessage> validateMessages = validator.validate(flowModel);
573571
List<TransitionNode> transitionNodes = flowModel.getTransitionNodes();
@@ -639,6 +637,7 @@ private String getFlowTestClassFullName(String code, String id) {
639637
}
640638

641639
private String wrapClassFullName(String name) {
640+
642641
return "compileflow." + name;
643642
}
644643

src/test/java/com/allibaba/compileflow/test/ProcessEngineTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void testProcessEngine() {
3737
context.put("pList", pList);
3838

3939
final ProcessEngine processEngine = ProcessEngineFactory.getProcessEngine();
40-
System.out.println(processEngine.getTestCode(code));
40+
System.out.println(processEngine.getJavaCode(code));
4141

4242
System.out.println(processEngine.execute(code, context));
4343
}

src/test/resources/bpm/om/waitPaySuccessFlow.bpm

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version='1.0' encoding='UTF-8'?>
22
<bpm code="bpm.om.waitpaySuccessflow" name="test" type="process" description="This is test demo.">
3-
<var name="num" description="入参" dataType="java.lang.Integer" inOutType="param"></var>
4-
<var name="numSqrt" description="开根号结果" dataType="java.lang.Integer" inOutType="return"></var>
3+
<var name="num" description="入参" dataType="java.lang.Integer" inOutType="param"/>
4+
<var name="numSqrt" description="开根号结果" dataType="java.lang.Integer" inOutType="return"/>
55
<start id="1" name="开始" tag="start" g="115,16,30,30">
6-
<transition to="17" g=":-15,20"></transition>
6+
<transition to="17" g=":-15,20"/>
77
</start>
8-
<end id="11" name="结束" tag="end" g="130,815,30,30"></end>
8+
<end id="11" name="结束" tag="end" g="130,815,30,30"/>
99
<autoTask id="17" name="计算平方根" tag="rate" g="95,160,88,48">
10-
<transition to="29" g=":-15,20"></transition>
10+
<transition to="29" g=":-15,20"/>
1111
<action type="java">
1212
<actionHandle clazz="com.allibaba.compileflow.test.mock.MockJavaClazz" method="mockReturnMethod">
13-
<var name="input" dataType="java.lang.Integer" contextVarName="num" inOutType="param"></var>
14-
<var name="output" dataType="java.lang.Integer" contextVarName="numSqrt" inOutType="return"></var>
13+
<var name="input" dataType="java.lang.Integer" contextVarName="num" inOutType="param"/>
14+
<var name="output" dataType="java.lang.Integer" contextVarName="numSqrt" inOutType="return"/>
1515
</actionHandle>
1616
</action>
1717
</autoTask>
18-
<waitEventTask id="29" name="֧等待支付成功事件" tag="PaymentPendingCallback" eventName="PaymentPendingCallback"
19-
g="100,370,101,53">
20-
<inAction type="java">
21-
<actionHandle clazz="com.allibaba.compileflow.test.mock.MockJavaClazz" method="calPrice">
22-
<var name="input" dataType="java.lang.Integer" contextVarName="num" inOutType="param"></var>
23-
<var name="output" dataType="java.lang.Integer" contextVarName="numSqrt" inOutType="return"></var>
24-
</actionHandle>
25-
</inAction>
26-
<transition to="38" g=":-15,20"></transition>
18+
<waitEventTask id="29" name="֧等待支付成功事件" tag="PaymentPendingCallback" eventName="PaymentPendingCallback" g="100,370,101,53">
19+
<transition to="38" g=":-15,20"/>
20+
<inAction type="java">
21+
<actionHandle clazz="com.allibaba.compileflow.test.mock.MockJavaClazz" method="calPrice">
22+
<var name="input" dataType="java.lang.Integer" contextVarName="num" defaultValue="1" inOutType="param"/>
23+
<var name="output" dataType="java.lang.Integer" contextVarName="numSqrt" defaultValue="2" inOutType="return"/>
24+
</actionHandle>
25+
</inAction>
2726
</waitEventTask>
2827
<autoTask id="38" name="计算价格2" tag="rate2" g="95,545,88,48">
29-
<transition to="11" g=":-15,20"></transition>
28+
<transition to="11" g=":-15,20"/>
3029
<action type="java">
3130
<actionHandle clazz="com.allibaba.compileflow.test.mock.MockJavaClazz" method="calPrice">
32-
<var name="input" dataType="java.lang.Integer" contextVarName="num" inOutType="param"></var>
33-
<var name="output" dataType="java.lang.Integer" contextVarName="numSqrt" inOutType="return"></var>
31+
<var name="input" dataType="java.lang.Integer" contextVarName="num" inOutType="param"/>
32+
<var name="output" dataType="java.lang.Integer" contextVarName="numSqrt" inOutType="return"/>
3433
</actionHandle>
3534
</action>
3635
</autoTask>

0 commit comments

Comments
 (0)