Commit 2c162c22 authored by Quxl's avatar Quxl

优化代码

parent 8a45e49f
......@@ -2,18 +2,19 @@ package com.egolm.workflow.test;
import java.util.Map;
import org.junit.Test;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.workflow.AbstractOpenApi;
import com.egolm.workflow.bean.TFlowTask;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class TestApiImpl extends AbstractOpenApi {
private JdbcTemplate jdbcTemplate;
public TestApiImpl(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
public JdbcTemplate getFlowDBTemplate() {
return this.jdbcTemplate;
......@@ -38,4 +39,27 @@ public class TestApiImpl extends AbstractOpenApi {
return null;
}
@Test
public void exec(){
ComboPooledDataSource ds = new ComboPooledDataSource("db");
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(ds);
jdbcTemplate.setDialect(new SqlServerDialect());
jdbcTemplate.setSql_level(3);
TestApiImpl openApi = new TestApiImpl();
openApi.jdbcTemplate = jdbcTemplate;
String flowName = "测试4";
String owner = "quxl";
String manager = "hanxu";
TFlowTask task = openApi.start(flowName, owner, null);
openApi.accept(task.getsTaskID(), owner);
task = openApi.commit(task.getsTaskID(), "提交请假单", "流程发起人提交请假单", owner, null);
openApi.accept(task.getsTaskID(), manager);
task = openApi.commit(task.getsTaskID(), "同意", "经理批准请假", manager, null);
}
}
\ No newline at end of file
package com.egolm.workflow.test;
import java.beans.PropertyVetoException;
import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.workflow.AbstractOpenApi;
import com.egolm.workflow.bean.TFlowTask;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class TestApplication {
private final String flowName = "测试4";
private final String owner = "quxinliang";
private final String manager = "hanxu";
private final String formId = "Leave_001";
private AbstractOpenApi openApi = null;
@Before
public void init() throws PropertyVetoException, SQLException {
ComboPooledDataSource ds = new ComboPooledDataSource("db");
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(ds);
jdbcTemplate.setDialect(new SqlServerDialect());
jdbcTemplate.setSql_level(3);
openApi = new TestApiImpl(jdbcTemplate);
}
@Test
public void exec(){
TFlowTask task = openApi.start(flowName, owner, null);
Map<String, Object> vars = new LinkedHashMap<String, Object>();
vars.put("id", formId);
openApi.accept(task.getsTaskID(), owner);
task = openApi.commit(task.getsTaskID(), "提交请假单", "流程发起人提交请假单", owner, vars);
openApi.accept(task.getsTaskID(), manager);
task = openApi.commit(task.getsTaskID(), "同意", "经理批准请假", manager, null);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment