Updated light services and fixed the tests.
Change-Id: Ia2744ae1d7f76d2af27d030546f4eeb5119b3d5e
diff --git a/full/pom.xml b/full/pom.xml
index 6feb320..6422a7d 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -7,7 +7,7 @@
<properties>
<java.version>1.7</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <spring-framework.version>4.3.7.RELEASE</spring-framework.version>
+ <spring-framework.version>4.3.11.RELEASE</spring-framework.version>
<jersey.version>1.19.4</jersey.version>
</properties>
<build>
@@ -196,14 +196,6 @@
</dependency>
<!-- Spring -->
-<!-- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring-framework.version}</version>
- <scope>compile</scope>
- </dependency>
- -->
-<!-- copied from extension -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
diff --git a/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java b/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
index 2d9e984..1479564 100644
--- a/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
+++ b/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
@@ -1,20 +1,22 @@
package de.ids_mannheim.korap.handlers;
-import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
-import de.ids_mannheim.korap.utils.BooleanUtils;
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.Setter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.SQLException;
+import java.util.HashMap;
+
+import javax.sql.DataSource;
+
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
-import javax.sql.DataSource;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.SQLException;
-import java.util.HashMap;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.utils.BooleanUtils;
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.Setter;
/**
* @author hanl
@@ -25,8 +27,7 @@
@Setter(AccessLevel.NONE)
private DataSource dataSource;
-
-
+
public JDBCClient (DataSource datasource) {
NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(
datasource);
diff --git a/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java b/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java
index 890beb7..f3a79a8 100644
--- a/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java
@@ -135,7 +135,6 @@
public void initMethod () throws KustvaktException {
helper().setupAccount();
c1 = new Corpus("WPD_test");
-// helper().runBootInterfaces();
helper().setupResource(c1);
}
}
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index 5ba2749..f5ddb0d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -1,7 +1,6 @@
package de.ids_mannheim.korap.web.service;
import org.junit.Before;
-import org.springframework.beans.factory.annotation.Autowired;
import de.ids_mannheim.korap.config.ContextHolder;
import de.ids_mannheim.korap.config.TestHelper;
@@ -13,13 +12,6 @@
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils" };
-
- @Override
- public void close () {
- super.close();
-
- }
-
protected TestHelper helper () {
try {
return TestHelper.newInstance(this.context);
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index de4cfe2..593d38e 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -36,8 +36,6 @@
<array>
<value>classpath:test-jdbc.properties</value>
<value>classpath:hibernate.properties</value>
- <!-- <value>file:./jdbc.properties</value> -->
- <!-- <value>file:./kustvakt-test.conf</value> -->
<value>classpath:kustvakt-test.conf</value>
</array>
</property>
@@ -55,43 +53,49 @@
<constructor-arg name="properties" ref="props" />
</bean>
- <!--class="org.apache.commons.dbcp2.BasicDataSource" -->
- <!-- org.springframework.jdbc.datasource.SingleConnectionDataSource -->
<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="maxTotal" value="1" />
+ <property name="maxIdle" value="1" />
<property name="minIdle" value="1" />
<property name="maxWaitMillis" value="15000" />
<!--<property name="poolPreparedStatements" value="true"/> -->
</bean>
+ <!-- use SingleConnection only for testing! -->
<bean id="sqliteDataSource"
class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
- lazy-init="true">
- <property name="driverClassName" value="${jdbc.driverClassName}" />
+ lazy-init="true" destroy-method="destroy">
+ <!-- <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 -->
+ <!-- Sqlite can only have a single connection -->
<property name="suppressClose">
<value>true</value>
</property>
- <!--<property name="initialSize" value="2"/> -->
- <!--<property name="poolPreparedStatements" value="true"/> -->
+ </bean>
+
+ <bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
+ destroy-method="close">
+ <property name="driverClass" value="${jdbc.driverClassName}" />
+ <property name="jdbcUrl" value="${jdbc.url}" />
+ <property name="user" value="${jdbc.username}" />
+ <property name="password" value="${jdbc.password}" />
+ <property name="maxPoolSize" value="1" />
+ <property name="minPoolSize" value="1" />
+ <property name="maxStatements" value="1" />
+ <property name="testConnectionOnCheckout" value="true" />
</bean>
<!-- to configure database for sqlite, mysql, etc. migrations -->
<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
- <property name="baselineOnMigrate" value="true" />
- <property name="locations" value="classpath:db.sqlite" />
+ <property name="baselineOnMigrate" value="false" />
+ <property name="locations" value="${jdbc.schemaPath}" />
<property name="dataSource" ref="sqliteDataSource" />
</bean>