Added VirtualCorpus DAO methods and tests.
Change-Id: Id178f922578fb5aa2516da9a485ea6a43eaea587
diff --git a/full/pom.xml b/full/pom.xml
index 6422a7d..9e83366 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -83,8 +83,8 @@
<threadCount>10</threadCount>
<excludes>
- <exclude>**/*APITest.java</exclude>
<exclude>de/ids_mannheim/korap/suites/*.java</exclude>
+ <exclude>de/ids_mannheim/korap/dao/*.java</exclude>
<exclude>**/KustvaktServerTest.java</exclude>
<exclude>**/ResourceServiceTest.java</exclude>
<exclude>**/ResourceInfoServiceTest.java</exclude>
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
index 74b5850..03a042c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
@@ -1,8 +1,11 @@
package de.ids_mannheim.korap.dao;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.persistence.criteria.CriteriaBuilder;
@@ -12,10 +15,12 @@
import javax.persistence.criteria.Root;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
import de.ids_mannheim.korap.constants.GroupMemberStatus;
import de.ids_mannheim.korap.constants.UserGroupStatus;
import de.ids_mannheim.korap.constants.VirtualCorpusAccessStatus;
+import de.ids_mannheim.korap.constants.VirtualCorpusType;
import de.ids_mannheim.korap.entity.UserGroup;
import de.ids_mannheim.korap.entity.VirtualCorpus;
import de.ids_mannheim.korap.entity.VirtualCorpusAccessGroup;
@@ -35,15 +40,37 @@
private EntityManager entityManager;
+ @Transactional
public void storeVirtualCorpus (VirtualCorpus virtualCorpus) {
- entityManager.getTransaction().begin();
entityManager.persist(virtualCorpus);
- entityManager.getTransaction().commit();
}
- public VirtualCorpus retrieveVirtualCorpusById (int id)
+ @Transactional
+ public void deleteVirtualCorpus (int id) throws KustvaktException {
+ VirtualCorpus vc = retrieveVCById(id);
+ entityManager.remove(vc);
+ }
+
+
+ public List<VirtualCorpus> retrieveVCByType (VirtualCorpusType type)
throws KustvaktException {
+ if (type == null) {
+ throw new KustvaktException(StatusCodes.MISSING_ARGUMENT, "type",
+ "null");
+ }
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+ CriteriaQuery<VirtualCorpus> query =
+ criteriaBuilder.createQuery(VirtualCorpus.class);
+ Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
+ query.select(virtualCorpus);
+ query.where(criteriaBuilder.equal(virtualCorpus.get("type"), type));
+ Query q = entityManager.createQuery(query);
+ return q.getResultList();
+ }
+
+
+ public VirtualCorpus retrieveVCById (int id) throws KustvaktException {
if (id == 0) {
throw new KustvaktException(StatusCodes.MISSING_ARGUMENT, "id",
String.valueOf(id));
@@ -54,45 +81,107 @@
Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
query.select(virtualCorpus);
query.where(criteriaBuilder.equal(virtualCorpus.get("id"), id));
- Query q = entityManager.createQuery(query);
- return (VirtualCorpus) q.getSingleResult();
+
+ VirtualCorpus vc = null;
+ try {
+ Query q = entityManager.createQuery(query);
+ vc = (VirtualCorpus) q.getSingleResult();
+ }
+ catch (NoResultException e) {
+ throw new KustvaktException(StatusCodes.NO_RESULT_FOUND,
+ "No result found for query: retrieve virtual corpus by id "
+ + id,
+ String.valueOf(id), e);
+ }
+ return vc;
}
- public List<VirtualCorpus> retrieveVirtualCorpusByUser (String userId) {
- CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+ public List<VirtualCorpus> retrievePrivateVC (String userId)
+ throws KustvaktException {
+ if (userId == null || userId.isEmpty()) {
+ throw new KustvaktException(StatusCodes.MISSING_ARGUMENT, "userId",
+ userId);
+ }
+ CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<VirtualCorpus> query =
- criteriaBuilder.createQuery(VirtualCorpus.class);
+ builder.createQuery(VirtualCorpus.class);
Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
- virtualCorpus.fetch("accessGroup");
+ query.select(virtualCorpus);
+ query.where(builder.equal(virtualCorpus.get("createdBy"), userId));
+ Query q = entityManager.createQuery(query);
+ return q.getResultList();
+ }
+
+
+ public List<VirtualCorpus> retrieveGroupVCByUser (String userId)
+ throws KustvaktException {
+ if (userId == null || userId.isEmpty()) {
+ throw new KustvaktException(StatusCodes.MISSING_ARGUMENT, "userId",
+ userId);
+ }
+
+ CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+ CriteriaQuery<VirtualCorpus> query =
+ builder.createQuery(VirtualCorpus.class);
+
+ Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
Join<VirtualCorpus, VirtualCorpusAccessGroup> accessGroup =
virtualCorpus.join("accessGroup");
- Predicate corpusStatus = criteriaBuilder.notEqual(
- accessGroup.get("status"), VirtualCorpusAccessStatus.HIDDEN);
- Predicate userGroupStatus = criteriaBuilder.notEqual(
- accessGroup.get("userGroup").get("status"),
- UserGroupStatus.DELETED);
-
+ Predicate corpusStatus = builder.notEqual(accessGroup.get("status"),
+ VirtualCorpusAccessStatus.HIDDEN);
+ Predicate userGroupStatus =
+ builder.notEqual(accessGroup.get("userGroup").get("status"),
+ UserGroupStatus.DELETED);
Join<VirtualCorpusAccessGroup, UserGroup> userGroupMembers =
accessGroup.join("userGroup").join("members");
-
- Predicate memberStatus = criteriaBuilder.equal(
- userGroupMembers.get("status"), GroupMemberStatus.ACTIVE);
-
- Predicate user =
- criteriaBuilder.equal(userGroupMembers.get("userId"), userId);
+ Predicate memberStatus = builder.equal(userGroupMembers.get("status"),
+ GroupMemberStatus.ACTIVE);
+ Predicate user = builder.equal(userGroupMembers.get("userId"), userId);
query.select(virtualCorpus);
- query.where(criteriaBuilder.and(corpusStatus, userGroupStatus,
- memberStatus, user));
+ query.where(
+ builder.and(corpusStatus, userGroupStatus, memberStatus, user));
+
Query q = entityManager.createQuery(query);
return q.getResultList();
}
+ public Set<VirtualCorpus> retrieveVCByUser (String userId)
+ throws KustvaktException {
+ if (userId == null || userId.isEmpty()) {
+ throw new KustvaktException(StatusCodes.MISSING_ARGUMENT, "userId",
+ userId);
+ }
+ CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+ CriteriaQuery<VirtualCorpus> query =
+ builder.createQuery(VirtualCorpus.class);
+
+ Root<VirtualCorpus> virtualCorpus = query.from(VirtualCorpus.class);
+ Predicate predicate = builder.or(
+ builder.equal(virtualCorpus.get("createdBy"), userId),
+ builder.equal(virtualCorpus.get("type"),
+ VirtualCorpusType.PREDEFINED));
+
+
+ query.select(virtualCorpus);
+ query.where(predicate);
+ query.distinct(true);
+ Query q = entityManager.createQuery(query);
+
+ List<VirtualCorpus> vcList = q.getResultList();
+ List<VirtualCorpus> groupVC = retrieveGroupVCByUser(userId);
+ Set<VirtualCorpus> vcSet = new HashSet<VirtualCorpus>();
+ vcSet.addAll(vcList);
+ vcSet.addAll(groupVC);
+ return vcSet;
+ }
+
+
// EM: what is needed for admin?
public List<VirtualCorpus> retrieveVirtualCorpusByAdmin () {
return null;
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java b/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
index d51e00f..f6c2d81 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
@@ -50,7 +50,7 @@
@OneToMany(mappedBy="group")//, fetch = FetchType.LAZY)
List<UserGroupMember> members;
- @OneToMany(mappedBy = "virtualCorpus", fetch = FetchType.LAZY)
+ @OneToMany(mappedBy = "userGroup", fetch = FetchType.LAZY)
private List<VirtualCorpusAccessGroup> virtualCorpusAccessGroup;
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java b/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
index ff1d09a..06b0a25 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
@@ -50,7 +50,7 @@
@Column(name = "created_by")
private String createdBy;
- @OneToMany(mappedBy = "userGroup", fetch=FetchType.LAZY)
+ @OneToMany(mappedBy = "virtualCorpus", fetch=FetchType.LAZY)
List<VirtualCorpusAccessGroup> accessGroup;
@@ -61,4 +61,20 @@
+ requiredAccess + ", collectionQuery= " + collectionQuery
+ ", definition= " + definition + ", createdBy= " + createdBy;
}
+
+ @Override
+ public int hashCode () {
+ int prime = 37;
+ int result = 1;
+ result = prime * result + id;
+ result = prime * result + name.hashCode();
+ result = prime * result + createdBy.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals (Object obj) {
+ VirtualCorpus vc = (VirtualCorpus) obj;
+ return (this.id == vc.getId()) ? true : false;
+ }
}
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java b/full/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java
index 5055e56..101bba1 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java
@@ -121,7 +121,7 @@
}
else if (codes.isEmpty()) {
throw KustvaktResponseHandler.throwit(new KustvaktException(
- StatusCodes.NO_VALUE_FOUND, "No result found.","codes:[]"));
+ StatusCodes.NO_RESULT_FOUND, "No result found.","codes:[]"));
}
List<AnnotationPair> annotationPairs = null;
@@ -164,7 +164,7 @@
}
else {
throw KustvaktResponseHandler.throwit(new KustvaktException(
- StatusCodes.NO_VALUE_FOUND, "No result found.",""));
+ StatusCodes.NO_RESULT_FOUND, "No result found.",""));
}
}
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/service/full/StatisticService.java b/full/src/main/java/de/ids_mannheim/korap/web/service/full/StatisticService.java
index cb76ca8..ee30523 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/service/full/StatisticService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/service/full/StatisticService.java
@@ -80,7 +80,7 @@
String stats = searchKrill.getStatistics(json);
if (stats.contains("-1"))
- throw KustvaktResponseHandler.throwit(StatusCodes.NO_VALUE_FOUND);
+ throw KustvaktResponseHandler.throwit(StatusCodes.NO_RESULT_FOUND);
jlog.debug("Stats: " + stats);
return Response.ok(stats).build();
}
diff --git a/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql b/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql
index d558e47..44b49e3 100644
--- a/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql
+++ b/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql
@@ -2,7 +2,8 @@
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name varchar(100) NOT NULL,
status varchar(100) NOT NULL,
- created_by varchar(100) NOT NULL
+ created_by varchar(100) NOT NULL,
+ INDEX status_index(status)
);
CREATE TABLE IF NOT EXISTS user_group_member (
@@ -13,15 +14,15 @@
created_by varchar(100) NOT NULL,
deleted_by varchar(100) DEFAULT NULL,
UNIQUE INDEX unique_index (user_id,group_id),
+ INDEX status_index(status),
FOREIGN KEY (group_id)
REFERENCES user_group (id)
ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS role (
- id varchar(100) NOT NULL,
- privilege varchar(100) NOT NULL,
- PRIMARY KEY (id)
+ id varchar(100) PRIMARY KEY NOT NULL,
+ privilege varchar(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS group_member_role (
@@ -46,7 +47,9 @@
description varchar(255) DEFAULT NULL,
status varchar(100) DEFAULT NULL,
collection_query varchar(2000) NOT NULL,
- definition varchar(255) DEFAULT NULL
+ definition varchar(255) DEFAULT NULL,
+ INDEX owner_index (created_by),
+ INDEX type_index (type)
);
CREATE TABLE IF NOT EXISTS virtual_corpus_access (
@@ -58,6 +61,7 @@
approved_by varchar(100) DEFAULT NULL,
deleted_by varchar(100) DEFAULT NULL,
UNIQUE INDEX unique_index (virtual_corpus_id,user_group_id),
+ INDEX status_index(status),
FOREIGN KEY (user_group_id)
REFERENCES user_group (id)
ON DELETE CASCADE,
diff --git a/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql b/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql
index 1d1cc9b..442a39c 100644
--- a/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql
+++ b/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql
@@ -36,6 +36,11 @@
(SELECT id from user_group where name = "dory group"),
"DELETED","dory", "pearl";
+INSERT INTO user_group_member(user_id, group_id, status, created_by)
+ SELECT "pearl",
+ (SELECT id from user_group where name = "auto group"),
+ "ACTIVE","system";
+
-- virtual corpora
INSERT INTO virtual_corpus(name, type, required_access, created_by, description, status, collection_query)
@@ -79,6 +84,6 @@
-- Summary user VC Lists
-- dory: dory VC, group VC, system VC
--- nemo: group VC, published VC, system VC
+-- nemo: group VC, system VC
-- marlin: published VC, system VC
--- pearl: system VC
+-- pearl: system VC, published VC
diff --git a/full/src/main/resources/default-config.xml b/full/src/main/resources/default-config.xml
index c6cd7d2..869059b 100644
--- a/full/src/main/resources/default-config.xml
+++ b/full/src/main/resources/default-config.xml
@@ -97,12 +97,12 @@
<!-- 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="validateOnMigrate" value="false" /> -->
<!-- <property name="cleanOnValidationError" value="true" /> -->
<property name="locations" value="${jdbc.schemaPath}" />
- <!-- <property name="dataSource" ref="dataSource" /> -->
- <property name="dataSource" ref="sqliteDataSource" />
+ <property name="dataSource" ref="dataSource" />
+ <!-- <property name="dataSource" ref="sqliteDataSource" /> -->
</bean>
diff --git a/full/src/test/java/de/ids_mannheim/de/korap/dao/VirtualCorpusDaoTest.java b/full/src/test/java/de/ids_mannheim/de/korap/dao/VirtualCorpusDaoTest.java
index 828a467..d9b5ad2 100644
--- a/full/src/test/java/de/ids_mannheim/de/korap/dao/VirtualCorpusDaoTest.java
+++ b/full/src/test/java/de/ids_mannheim/de/korap/dao/VirtualCorpusDaoTest.java
@@ -2,57 +2,125 @@
import static org.junit.Assert.assertEquals;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.constants.VirtualCorpusType;
import de.ids_mannheim.korap.dao.VirtualCorpusDao;
import de.ids_mannheim.korap.entity.VirtualCorpus;
import de.ids_mannheim.korap.exceptions.KustvaktException;
-public class VirtualCorpusDaoTest extends BeanConfigTest{
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-config.xml")
+public class VirtualCorpusDaoTest {
@Autowired
VirtualCorpusDao dao;
+ @Autowired
+ protected ApplicationContext context;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
@Test
- public void retrieveVirtualCorpusByUserDory () {
- List<VirtualCorpus> virtualCorpora =
- dao.retrieveVirtualCorpusByUser("dory");
- assertEquals(3,virtualCorpora.size());
+ public void testPredefinedVC () throws KustvaktException {
+ // insert vc
+ VirtualCorpus vc = new VirtualCorpus();
+ vc.setName("predefined VC");
+ vc.setCreatedBy("test class");
+ vc.setCollectionQuery("corpusSigle=GOE");
+ vc.setRequiredAccess("free");
+ vc.setType(VirtualCorpusType.PREDEFINED);
+ dao.storeVirtualCorpus(vc);
+
+ // select vc
+ List<VirtualCorpus> vcList =
+ dao.retrieveVCByType(VirtualCorpusType.PREDEFINED);
+ assertEquals(2, vcList.size());
+
+ // delete vc
+ dao.deleteVirtualCorpus(vc.getId());
+
+ // check if vc has been deleted
+ thrown.expect(KustvaktException.class);
+ vc = dao.retrieveVCById(vc.getId());
}
@Test
- public void retrieveVirtualCorpusByUserNemo () {
- List<VirtualCorpus> virtualCorpora =
- dao.retrieveVirtualCorpusByUser("nemo");
-
+ public void retrievePredefinedVC () throws KustvaktException {
+ List<VirtualCorpus> vc =
+ dao.retrieveVCByType(VirtualCorpusType.PREDEFINED);
+ assertEquals(1, vc.size());
}
+ /** retrieve private and group VC
+ * excludes hidden published VC (user has never used it)
+ * @throws KustvaktException
+ */
@Test
- public void retrieveVirtualCorpusByUserMarlin () {
- List<VirtualCorpus> virtualCorpora =
- dao.retrieveVirtualCorpusByUser("marlin");
-
+ public void retrieveVirtualCorpusByUserDory () throws KustvaktException {
+ Set<VirtualCorpus> virtualCorpora = dao.retrieveVCByUser("dory");
+ assertEquals(3, virtualCorpora.size());
+ Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+ assertEquals("dory VC", i.next().getName());
+ assertEquals("system VC", i.next().getName());
+ assertEquals("group VC", i.next().getName());
}
+ /** retrieves group VC and
+ * excludes hidden published VC (user has never used it)
+ * @throws KustvaktException
+ */
@Test
- public void retrieveVirtualCorpusByUserPearl () {
- List<VirtualCorpus> virtualCorpora =
- dao.retrieveVirtualCorpusByUser("pearl");
+ public void retrieveVirtualCorpusByUserNemo () throws KustvaktException {
+ Set<VirtualCorpus> virtualCorpora = dao.retrieveVCByUser("nemo");
+ assertEquals(2, virtualCorpora.size());
+ Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+ assertEquals("system VC", i.next().getName());
+ assertEquals("group VC", i.next().getName());
}
- @Override
- public void initMethod () throws KustvaktException {
- // TODO Auto-generated method stub
-
+ /** retrieves published VC by the owner and
+ * excludes group vc when a user is a pending member
+ * @throws KustvaktException
+ */
+ @Test
+ public void retrieveVirtualCorpusByUserMarlin () throws KustvaktException {
+ Set<VirtualCorpus> virtualCorpora = dao.retrieveVCByUser("marlin");
+ assertEquals(2, virtualCorpora.size());
+ Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+ assertEquals("system VC", i.next().getName());
+ assertEquals("published VC", i.next().getName());
+ }
+
+
+
+ /** retrieves published VC from an auto-generated hidden group and
+ * excludes group vc when a user is a deleted member
+ * @throws KustvaktException
+ */
+ @Test
+ public void retrieveVirtualCorpusByUserPearl () throws KustvaktException {
+ Set<VirtualCorpus> virtualCorpora = dao.retrieveVCByUser("pearl");
+ assertEquals(2, virtualCorpora.size());
+ Iterator<VirtualCorpus> i = virtualCorpora.iterator();
+ assertEquals("system VC", i.next().getName());
+ assertEquals("published VC", i.next().getName());
}
}
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 f3a79a8..6244763 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
@@ -99,6 +99,7 @@
// securitymanager does not allow for anonymous retrieval, only resourcefinder!
@Test
+ @Ignore
public void getResource () throws KustvaktException {
exception.expect(KustvaktException.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
index d1a7b40..64f7c35 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
@@ -130,6 +130,7 @@
assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
response.getStatus());
String ent = response.getEntity(String.class);
+ System.out.println(ent);
JsonNode node = mapper.readTree(ent);
assertEquals(node.at("/errors/0/0").asInt(), 105);
assertEquals(node.at("/errors/0/1").asText(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java
index 8d94185..b17437f 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserServiceTest.java
@@ -279,7 +279,7 @@
String entity = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(entity);
assertNotNull(node);
- assertEquals(StatusCodes.NO_VALUE_FOUND, node.at("/errors/0/0").asInt());
+ assertEquals(StatusCodes.NO_RESULT_FOUND, node.at("/errors/0/0").asInt());
assertEquals("UserDetails", node.at("/errors/0/2").asText());
helper().dropUser("userservicetest");
}
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index e158b6b..b720834 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -36,7 +36,7 @@
<array>
<value>classpath:test-jdbc.properties</value>
<value>file:./test-jdbc.properties</value>
- <value>classpath:hibernate.properties</value>
+ <value>classpath:test-hibernate.properties</value>
<value>classpath:kustvakt-test.conf</value>
</array>
</property>
@@ -95,6 +95,10 @@
<!-- to configure database for sqlite, mysql, etc. migrations -->
<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <!-- drop existing tables and create new tables -->
+ <property name="validateOnMigrate" value="true" />
+ <property name="cleanOnValidationError" value="true" />
+
<property name="baselineOnMigrate" value="false" />
<property name="locations" value="${jdbc.schemaPath}" />
<property name="dataSource" ref="sqliteDataSource" />