From 72a77dd8fd2c9777527cf261d8f8096fecda70c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20M=C3=A4kinen?= Date: Thu, 27 Jun 2019 16:49:17 +0300 Subject: [PATCH] Remove changes thats been moved to #412 --- .../fi/nls/oskari/mybatis/MyBatisHelper.java | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/service-mybatis/src/main/java/fi/nls/oskari/mybatis/MyBatisHelper.java b/service-mybatis/src/main/java/fi/nls/oskari/mybatis/MyBatisHelper.java index b9521f501e..223e8821f4 100755 --- a/service-mybatis/src/main/java/fi/nls/oskari/mybatis/MyBatisHelper.java +++ b/service-mybatis/src/main/java/fi/nls/oskari/mybatis/MyBatisHelper.java @@ -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 { @@ -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"); } @@ -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);