diff --git a/core/pom.xml b/core/pom.xml
index a3c2a1a1e9..e34cb44596 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -86,8 +86,23 @@
test
- org.hsqldb
- hsqldb
+ org.testcontainers
+ junit-jupiter
+ test
+
+
+ org.testcontainers
+ mariadb
+ test
+
+
+ org.mariadb.jdbc
+ mariadb-java-client
+ test
+
+
+ org.flywaydb
+ flyway-mysql
test
diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml
index fc5f0a5977..902cc7aeae 100755
--- a/core/src/main/resources/META-INF/persistence.xml
+++ b/core/src/main/resources/META-INF/persistence.xml
@@ -4,9 +4,6 @@
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">
-
-
@@ -17,13 +14,4 @@
-
-
-
-
-
-
-
-
diff --git a/core/src/test/java/se/su/dsv/scipro/finalseminar/FinalSeminarSchedulingTest.java b/core/src/test/java/se/su/dsv/scipro/finalseminar/FinalSeminarSchedulingTest.java
index 23ebd8113c..cca047aed5 100644
--- a/core/src/test/java/se/su/dsv/scipro/finalseminar/FinalSeminarSchedulingTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/finalseminar/FinalSeminarSchedulingTest.java
@@ -197,6 +197,7 @@ public class FinalSeminarSchedulingTest extends IntegrationTest {
NonWorkDayPeriod nonWorkDayPeriod = new NonWorkDayPeriod();
nonWorkDayPeriod.setStartDate(date);
nonWorkDayPeriod.setEndDate(date);
+ nonWorkDayPeriod.setComment("test non work day");
save(nonWorkDayPeriod);
}
diff --git a/core/src/test/java/se/su/dsv/scipro/peer/CommentThreadServiceImplTest.java b/core/src/test/java/se/su/dsv/scipro/peer/CommentThreadServiceImplTest.java
index cd037f3ee5..625162f167 100644
--- a/core/src/test/java/se/su/dsv/scipro/peer/CommentThreadServiceImplTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/peer/CommentThreadServiceImplTest.java
@@ -12,6 +12,7 @@ import se.su.dsv.scipro.file.FileDescription;
import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.system.DegreeType;
+import se.su.dsv.scipro.system.Language;
import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.User;
import se.su.dsv.scipro.test.Dates;
@@ -66,6 +67,7 @@ public class CommentThreadServiceImplTest extends IntegrationTest {
PeerRequest peerRequest = new PeerRequest();
peerRequest.setProject(project);
peerRequest.setRequester(createUser());
+ peerRequest.setLanguage(Language.ENGLISH);
final FileDescription fileDescription = save(new FileDescription());
final FileReference fileReference = new FileReference();
fileReference.setFileDescription(fileDescription);
diff --git a/core/src/test/java/se/su/dsv/scipro/peer/PeerRequestServiceImplTest.java b/core/src/test/java/se/su/dsv/scipro/peer/PeerRequestServiceImplTest.java
index 215e6c5f45..fc98ba6f7b 100644
--- a/core/src/test/java/se/su/dsv/scipro/peer/PeerRequestServiceImplTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/peer/PeerRequestServiceImplTest.java
@@ -13,6 +13,7 @@ import se.su.dsv.scipro.file.FileDescription;
import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.system.DegreeType;
+import se.su.dsv.scipro.system.Language;
import se.su.dsv.scipro.system.PageRequest;
import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.User;
@@ -158,6 +159,7 @@ public class PeerRequestServiceImplTest extends IntegrationTest {
peerRequest.setProject(project);
peerRequest.setRequester(requester);
peerRequest.setStatus(status);
+ peerRequest.setLanguage(Language.ENGLISH);
final FileDescription fileDescription = save(new FileDescription());
final FileReference fileReference = new FileReference();
fileReference.setFileDescription(fileDescription);
diff --git a/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplIntegrationTest.java b/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplIntegrationTest.java
index 15a004fd89..a954f455be 100644
--- a/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplIntegrationTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplIntegrationTest.java
@@ -14,6 +14,7 @@ import se.su.dsv.scipro.file.FileDescription;
import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.system.DegreeType;
+import se.su.dsv.scipro.system.Language;
import se.su.dsv.scipro.system.PageRequest;
import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.User;
@@ -102,6 +103,7 @@ public class PeerReviewServiceImplIntegrationTest extends IntegrationTest {
PeerRequest peerRequest = new PeerRequest();
peerRequest.setProject(createProject());
peerRequest.setRequester(createUser());
+ peerRequest.setLanguage(Language.ENGLISH);
final FileDescription fileDescription = save(new FileDescription());
final FileReference fileReference = new FileReference();
fileReference.setFileDescription(fileDescription);
diff --git a/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplTest.java b/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplTest.java
index 9c6a5dd3da..6495faaf7a 100644
--- a/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/peer/PeerReviewServiceImplTest.java
@@ -14,6 +14,7 @@ import se.su.dsv.scipro.file.FileDescription;
import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.system.DegreeType;
+import se.su.dsv.scipro.system.Language;
import se.su.dsv.scipro.system.PageRequest;
import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.User;
@@ -95,6 +96,7 @@ public class PeerReviewServiceImplTest extends IntegrationTest {
peerRequest.setRequester(
save(User.builder().firstName("Bob").lastName("Sponge").emailAddress("bob@example.com").build())
);
+ peerRequest.setLanguage(Language.ENGLISH);
final FileDescription fileDescription = save(new FileDescription());
final FileReference fileReference = new FileReference();
fileReference.setFileDescription(fileDescription);
diff --git a/core/src/test/java/se/su/dsv/scipro/peer/TestPeerReview.java b/core/src/test/java/se/su/dsv/scipro/peer/TestPeerReview.java
index 34e5e5c7e2..fe5e2be992 100755
--- a/core/src/test/java/se/su/dsv/scipro/peer/TestPeerReview.java
+++ b/core/src/test/java/se/su/dsv/scipro/peer/TestPeerReview.java
@@ -19,6 +19,7 @@ import se.su.dsv.scipro.file.FileDescription;
import se.su.dsv.scipro.file.FileReference;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.project.ProjectStatus;
+import se.su.dsv.scipro.system.Language;
import se.su.dsv.scipro.system.PageRequest;
import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.User;
@@ -196,6 +197,7 @@ public class TestPeerReview extends IntegrationTest {
request.setComment(comment);
request.setRequester(requester);
request.setProject(project);
+ request.setLanguage(Language.ENGLISH);
final FileDescription fileDescription = save(new FileDescription());
final FileReference fileReference = new FileReference();
fileReference.setFileDescription(fileDescription);
diff --git a/core/src/test/java/se/su/dsv/scipro/plagiarism/urkund/UrkundSubmissionRepositoryTest.java b/core/src/test/java/se/su/dsv/scipro/plagiarism/urkund/UrkundSubmissionRepositoryTest.java
index c09f3ea67e..a3b40ed7ae 100644
--- a/core/src/test/java/se/su/dsv/scipro/plagiarism/urkund/UrkundSubmissionRepositoryTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/plagiarism/urkund/UrkundSubmissionRepositoryTest.java
@@ -13,6 +13,7 @@ import org.hamcrest.TypeSafeMatcher;
import org.junit.jupiter.api.Test;
import se.su.dsv.scipro.file.FileDescription;
import se.su.dsv.scipro.file.FileReference;
+import se.su.dsv.scipro.system.User;
import se.su.dsv.scipro.test.SpringTest;
public class UrkundSubmissionRepositoryTest extends SpringTest {
@@ -23,11 +24,14 @@ public class UrkundSubmissionRepositoryTest extends SpringTest {
@Test
public void save() {
final Instant submitted = Instant.now();
+ User bob = User.builder().firstName("Bob").lastName("Sponge").emailAddress("bob@example.com").build();
+ save(bob);
final UrkundSubmission submission = new UrkundSubmission();
submission.setState(UrkundSubmission.State.SUBMITTED);
submission.setMessage("Hi");
submission.setSubmitted(submitted);
submission.setNextPoll(submitted);
+ submission.setReceiver(bob);
final FileDescription file = save(new FileDescription());
final FileReference fileReference = new FileReference();
fileReference.setFileDescription(file);
diff --git a/core/src/test/java/se/su/dsv/scipro/test/SpringTest.java b/core/src/test/java/se/su/dsv/scipro/test/SpringTest.java
index 2b68b55008..04d0f70da7 100644
--- a/core/src/test/java/se/su/dsv/scipro/test/SpringTest.java
+++ b/core/src/test/java/se/su/dsv/scipro/test/SpringTest.java
@@ -4,28 +4,47 @@ import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.EntityTransaction;
import jakarta.persistence.Persistence;
+import java.sql.SQLException;
import java.time.Clock;
+import java.util.Map;
import java.util.Optional;
+import org.flywaydb.core.Flyway;
+import org.hibernate.cfg.Environment;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
+import org.mariadb.jdbc.MariaDbDataSource;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
+import org.testcontainers.containers.MariaDBContainer;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
import se.su.dsv.scipro.CoreConfig;
import se.su.dsv.scipro.RepositoryConfiguration;
import se.su.dsv.scipro.profiles.CurrentProfile;
import se.su.dsv.scipro.sukat.Sukat;
import se.su.dsv.scipro.system.CurrentUser;
+@Testcontainers
public abstract class SpringTest {
private EntityManager entityManager;
private EntityManagerFactory entityManagerFactory;
+ @Container
+ static MariaDBContainer> mariaDBContainer = new MariaDBContainer<>("mariadb:10.11");
+
@BeforeEach
- public final void prepareSpring() {
- entityManagerFactory = Persistence.createEntityManagerFactory("testPersistenceUnit");
+ public final void prepareSpring() throws SQLException {
+ MariaDbDataSource dataSource = new MariaDbDataSource(mariaDBContainer.getJdbcUrl());
+ dataSource.setUser(mariaDBContainer.getUsername());
+ dataSource.setPassword(mariaDBContainer.getPassword());
+
+ Flyway.configure().dataSource(dataSource).load().migrate();
+
+ Map jpaProperties = Map.of(Environment.JAKARTA_JTA_DATASOURCE, dataSource);
+ entityManagerFactory = Persistence.createEntityManagerFactory("defaultPersistenceUnit", jpaProperties);
this.entityManager = entityManagerFactory.createEntityManager();
EntityTransaction transaction = entityManager.getTransaction();
transaction.begin();
diff --git a/pom.xml b/pom.xml
index 8448e670cf..a4b4f57961 100755
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,6 @@
5.0.0
5.0.0
5.9.3
- 2.7.1
5.3.1
9.19.1
3.1.6
@@ -133,14 +132,6 @@
import
-
-
- org.hsqldb
- hsqldb
- ${hsqldb.version}
- test
-
-
org.mariadb.jdbc
mariadb-java-client