Set up the test framework with SpringServlet.
Change-Id: Ie5a4e05e54fdf4c77b52daf9a34808e2bf7f0581
diff --git a/src/test/resources/test-default-config.xml b/src/test/resources/test-default-config.xml
index 8c6464d..09d4822 100644
--- a/src/test/resources/test-default-config.xml
+++ b/src/test/resources/test-default-config.xml
@@ -34,9 +34,11 @@
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<array>
- <value>classpath:jdbc.properties</value>
+ <value>classpath:test-jdbc.properties</value>
<value>classpath:hibernate.properties</value>
<!-- <value>file:./jdbc.properties</value> -->
+ <value>file:./kustvakt.conf</value>
+ <value>classpath:kustvakt.conf</value>
</array>
</property>
</bean>
@@ -55,17 +57,29 @@
<!--class="org.apache.commons.dbcp2.BasicDataSource" -->
<!-- org.springframework.jdbc.datasource.SingleConnectionDataSource -->
- <!-- org.springframework.jdbc.datasource.DriverManagerDataSource -->
- <bean id="dataSource"
+ <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
+ lazy-init="true">
+ <property name="driverClassName" value="${jdbc.driverClassName}" />
+ <property name="url" value="${jdbc.url}" />
+ <property name="username" value="${jdbc.username}" />
+ <property name="password" value="${jdbc.password}" />
+ <!-- relevant for single connection datasource and sqlite -->
+ <!-- <property name="suppressClose"> <value>true</value> </property> -->
+ <!--<property name="initialSize" value="2"/> -->
+ <property name="maxTotal" value="4" />
+ <property name="maxIdle" value="2" />
+ <property name="minIdle" value="1" />
+ <property name="maxWaitMillis" value="15000" />
+ <!--<property name="poolPreparedStatements" value="true"/> -->
+ </bean>
+
+ <bean id="sqliteDataSource"
class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
- lazy-init="false">
- <property name="driverClassName" value="org.sqlite.JDBC" />
- <property name="url" value="jdbc:sqlite::memory:" />
- <!--<property name="initialSize" value="1" /> -->
- <!--<property name="maxTotal" value="1" /> -->
- <!--<property name="maxIdle" value="1" /> -->
- <!--<property name="username" value="${jdbc.username}"/> -->
- <!--<property name="password" value="${jdbc.password}"/> -->
+ lazy-init="true">
+ <property name="driverClassName" value="${jdbc.driverClassName}" />
+ <property name="url" value="${jdbc.url}" />
+ <property name="username" value="${jdbc.username}" />
+ <property name="password" value="${jdbc.password}" />
<!-- relevant for single connection datasource and sqlite -->
<property name="suppressClose">
<value>true</value>
@@ -76,9 +90,9 @@
<!-- to configure database for sqlite, mysql, etc. migrations -->
<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
- <property name="baselineOnMigrate" value="false" />
+ <property name="baselineOnMigrate" value="true" />
<property name="locations" value="classpath:db.sqlite" />
- <property name="dataSource" ref="dataSource" />
+ <property name="dataSource" ref="sqliteDataSource" />
</bean>
<bean id="kustvakt_db" class="de.ids_mannheim.korap.handlers.JDBCClient">
@@ -126,6 +140,11 @@
<bean id="resourceDao" class="de.ids_mannheim.korap.dao.ResourceDao"/>
<!-- <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao"/> -->
+ <!-- Krill -->
+ <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">
+ <constructor-arg value="${krill.indexDir}"/>
+ </bean>
+
<bean id="kustvakt_auditing" class="de.ids_mannheim.korap.handlers.JDBCAuditing">
<constructor-arg ref="kustvakt_db" />
</bean>
diff --git a/src/test/resources/test-jdbc.properties b/src/test/resources/test-jdbc.properties
new file mode 100644
index 0000000..1865408
--- /dev/null
+++ b/src/test/resources/test-jdbc.properties
@@ -0,0 +1,10 @@
+#-------------------------------------------------------------------------------
+# Sqlite Settings
+
+jdbc.database=sqlite
+jdbc.driverClassName=org.sqlite.JDBC
+jdbc.url=jdbc:sqlite:db.sqlite
+# jdbc.url=jdbc:sqlite:kustvakt_init_test.sqlite
+jdbc.username=pc
+jdbc.password=pc
+jdbc.schemaPath=classpath:db.sqlite