Commit 120b53ca authored by Quxl's avatar Quxl

优化

parent cd5a8e42
...@@ -8,8 +8,11 @@ import java.util.Map; ...@@ -8,8 +8,11 @@ import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; 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.AbstractOpenApi;
import com.egolm.workflow.bean.TFlowTask; import com.egolm.workflow.bean.TFlowTask;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class TestApplication { public class TestApplication {
...@@ -22,7 +25,12 @@ public class TestApplication { ...@@ -22,7 +25,12 @@ public class TestApplication {
@Before @Before
public void init() throws PropertyVetoException, SQLException { public void init() throws PropertyVetoException, SQLException {
openApi = new TestApiImpl(TestConfig.getJdbcTemplate()); 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 @Test
......
package com.egolm.workflow.test;
import java.beans.PropertyVetoException;
import java.sql.SQLException;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class TestConfig {
private static JdbcTemplate jdbcTemplate;
public static JdbcTemplate getJdbcTemplate() throws PropertyVetoException, SQLException {
if(jdbcTemplate == null) {
ComboPooledDataSource ds = new ComboPooledDataSource("db");
jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(ds);
jdbcTemplate.setDialect(new SqlServerDialect());
jdbcTemplate.setSql_level(3);
}
return jdbcTemplate;
}
}
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