aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/at/ac/tuwien/sepm/assignment/groupphase
diff options
context:
space:
mode:
authorFelix Kehrer <felix.kehrer@gmail.com>2018-05-06 16:01:10 +0200
committerFelix Kehrer <felix.kehrer@gmail.com>2018-05-07 14:42:08 +0200
commit5a6c00ebc1583e0505fb795b3483f8937e7b8eb4 (patch)
tree67bfb0c8023e1f8a37a282d0b5d4bb0e50bd9779 /src/test/java/at/ac/tuwien/sepm/assignment/groupphase
parentf4b5613fd3c6ce8e45fb7b99d10b33bec12ad43c (diff)
downloadsepm-groupproject-5a6c00ebc1583e0505fb795b3483f8937e7b8eb4.tar.gz
sepm-groupproject-5a6c00ebc1583e0505fb795b3483f8937e7b8eb4.tar.xz
sepm-groupproject-5a6c00ebc1583e0505fb795b3483f8937e7b8eb4.zip
Added groundwork for DAO tests
Diffstat (limited to 'src/test/java/at/ac/tuwien/sepm/assignment/groupphase')
-rw-r--r--src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java b/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java
new file mode 100644
index 0000000..03b70b1
--- /dev/null
+++ b/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java
@@ -0,0 +1,65 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao;
+
+import static org.junit.Assert.*;
+
+import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
+import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager;
+import java.nio.charset.Charset;
+import java.sql.SQLException;
+import org.h2.tools.RunScript;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class H2RegistrationDAOTest {
+
+ // Base taken from EmployeePersistenceTest
+
+ private static final String JDBC_DRIVER = org.h2.Driver.class.getName();
+ private static final String JDBC_URL = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1";
+ private static final String USER = "";
+ private static final String PASSWORD = "";
+
+ private RegistrationDAO registrationDAO;
+
+ public H2RegistrationDAOTest() throws PersistenceException {
+ this.registrationDAO = new H2RegistrationDAO(new JDBCConnectionManager(JDBC_URL));
+ }
+
+ @BeforeClass
+ public static void setupDatabase() throws SQLException {
+ RunScript.execute(
+ JDBC_URL,
+ USER,
+ PASSWORD,
+ "classpath:sql/database.sql",
+ Charset.forName("UTF8"),
+ false);
+ }
+
+ @Before
+ public void setUp() throws SQLException {
+ RunScript.execute(
+ JDBC_URL,
+ USER,
+ PASSWORD,
+ "classpath:sql/H2RegistrationDAOTest_populate.sql",
+ Charset.forName("UTF8"),
+ false);
+ }
+
+ @After
+ public void tearDown() throws SQLException {
+ RunScript.execute(
+ JDBC_URL,
+ USER,
+ PASSWORD,
+ "classpath:sql/H2RegistrationDAOTest_depopulate.sql",
+ Charset.forName("UTF8"),
+ false);
+ }
+
+ @Test
+ public void add() {}
+}