Skip to content

Commit

Permalink
修复工作流的单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
entropy-cloud committed Nov 28, 2023
1 parent bf470ca commit 3bf4757
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [234:10:0:0]/nop/schema/wf/wf.xdef <p>
* generate from [236:10:0:0]/nop/schema/wf/wf.xdef <p>
*
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class _WfModel extends io.nop.core.resource.component.AbstractCo
* xml name: auths
*
*/
private java.util.List<io.nop.wf.core.model.WfModelAuth> _auths = java.util.Collections.emptyList();
private KeyedList<io.nop.wf.core.model.WfModelAuth> _auths = KeyedList.emptyList();

/**
*
Expand Down Expand Up @@ -269,11 +269,37 @@ public java.util.List<io.nop.wf.core.model.WfModelAuth> getAuths(){
public void setAuths(java.util.List<io.nop.wf.core.model.WfModelAuth> value){
checkAllowChange();

this._auths = value;
this._auths = KeyedList.fromList(value, io.nop.wf.core.model.WfModelAuth::getId);

}


public io.nop.wf.core.model.WfModelAuth getAuth(String name){
return this._auths.getByKey(name);
}

public boolean hasAuth(String name){
return this._auths.containsKey(name);
}

public void addAuth(io.nop.wf.core.model.WfModelAuth item) {
checkAllowChange();
java.util.List<io.nop.wf.core.model.WfModelAuth> list = this.getAuths();
if (list == null || list.isEmpty()) {
list = new KeyedList<>(io.nop.wf.core.model.WfModelAuth::getId);
setAuths(list);
}
list.add(item);
}

public java.util.Set<String> keySet_auths(){
return this._auths.keySet();
}

public boolean hasAuths(){
return !this._auths.isEmpty();
}

/**
*
* xml name: bizEntityStateProp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public abstract class _WfModelAuth extends io.nop.core.resource.component.Abstra
*/
private java.lang.String _deptId ;

/**
*
* xml name: id
*
*/
private java.lang.String _id ;

/**
*
* xml name: actorId
Expand Down Expand Up @@ -170,6 +177,25 @@ public void setDeptId(java.lang.String value){
}


/**
*
* xml name: id
*
*/

public java.lang.String getId(){
return _id;
}


public void setId(java.lang.String value){
checkAllowChange();

this._id = value;

}



public void freeze(boolean cascade){
if(frozen()) return;
Expand All @@ -189,6 +215,7 @@ protected void outputJson(IJsonHandler out){
out.put("allowManage",this.isAllowManage());
out.put("allowStart",this.isAllowStart());
out.put("deptId",this.getDeptId());
out.put("id",this.getId());
}
}
// resume CPD analysis - CPD-ON
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public abstract class _WfStepModel extends io.nop.core.resource.component.Abstra
*/
private io.nop.wf.core.model.WfAssignmentModel _assignment ;

/**
*
* xml name: before-transition
*
*/
private io.nop.core.lang.eval.IEvalAction _beforeTransition ;

/**
*
* xml name: bizEntityState
Expand Down Expand Up @@ -298,6 +305,25 @@ public void setAssignment(io.nop.wf.core.model.WfAssignmentModel value){
}


/**
*
* xml name: before-transition
*
*/

public io.nop.core.lang.eval.IEvalAction getBeforeTransition(){
return _beforeTransition;
}


public void setBeforeTransition(io.nop.core.lang.eval.IEvalAction value){
checkAllowChange();

this._beforeTransition = value;

}


/**
*
* xml name: bizEntityState
Expand Down Expand Up @@ -766,6 +792,7 @@ protected void outputJson(IJsonHandler out){
out.put("allowWithdraw",this.isAllowWithdraw());
out.put("appState",this.getAppState());
out.put("assignment",this.getAssignment());
out.put("beforeTransition",this.getBeforeTransition());
out.put("bizEntityState",this.getBizEntityState());
out.put("checkComplete",this.getCheckComplete());
out.put("displayName",this.getDisplayName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [252:18:0:0]/nop/schema/wf/wf.xdef <p>
* generate from [254:18:0:0]/nop/schema/wf/wf.xdef <p>
*
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [249:10:0:0]/nop/schema/wf/wf.xdef <p>
* generate from [251:10:0:0]/nop/schema/wf/wf.xdef <p>
* 子流程
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [259:18:0:0]/nop/schema/wf/wf.xdef <p>
* generate from [261:18:0:0]/nop/schema/wf/wf.xdef <p>
* 将子工作流中的output变量返回到本工作流中作为变量var
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [250:14:0:0]/nop/schema/wf/wf.xdef <p>
* generate from [252:14:0:0]/nop/schema/wf/wf.xdef <p>
*
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package io.nop.wf.service;

import io.nop.api.core.context.ContextProvider;
import io.nop.auth.dao.entity.NopAuthUser;
import io.nop.core.context.IServiceContext;
import io.nop.core.context.ServiceContextImpl;
Expand Down Expand Up @@ -58,13 +59,12 @@ void setUp() {

WorkflowEngineImpl engine = new WorkflowEngineImpl();
engine.setWfActorResolver(new MockWfActorResolver());
//engine.setWorkflowCoordinator();
workflowManager.setWorkflowEngine(engine);
MockWorkflowStore store = new MockWorkflowStore();
workflowManager.setWorkflowStore(store);
// workflowManager.setWorkflowModelStore(new ResourceWorkflowModelStore());

workflowManager.init();
ContextProvider.getOrCreateContext().setUserId("1");
}

/**
Expand Down

0 comments on commit 3bf4757

Please sign in to comment.