Skip to content

Commit

Permalink
Remove changes thats been moved to oskariorg#412
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakarFin committed Jun 27, 2019
1 parent c832ede commit 72a77dd
Showing 1 changed file with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import javax.sql.DataSource;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

public class MyBatisHelper {

Expand All @@ -18,9 +15,6 @@ public static SqlSessionFactory initMyBatis(DataSource ds, Class<?>... mappers)
}

public static Configuration getConfig(DataSource ds, Class<?>... mappers) {
if (ds == null) {
// ds = getTestDS();
}
if (ds == null) {
throw new NullPointerException("Tried initializing MyBatis without a datasource");
}
Expand All @@ -32,21 +26,6 @@ public static Configuration getConfig(DataSource ds, Class<?>... mappers) {
return configuration;
}

/**
* Work in progress. This could be used to init mem-based database for unit tests.
* @return
*/
private static DataSource getTestDS() {
try {
// try to dig up TestHelper that is only available while testing to get a mem-based datasource
Class helper = Class.forName("fi.nls.test.util.TestHelper");
Method m = helper.getMethod("createMemDBforUnitTest", List.class);
return (DataSource) m.invoke(null, (Object) Collections.emptyList());
} catch (Exception e) {
throw new RuntimeException("Tried to create mem-based db for testing but test libraries not in classpath");
}
}

public static void addAliases(Configuration config, Class<?>... aliases) {
for (Class<?> alias : aliases) {
config.getTypeAliasRegistry().registerAlias(alias);
Expand Down

0 comments on commit 72a77dd

Please sign in to comment.