Skip to content
Snippets Groups Projects
Commit 378ff06c authored by Yvan Peter's avatar Yvan Peter
Browse files

Changement du chemin de la base pour éviter les conflits de noms

parent 9f47b58e
No related branches found
No related tags found
No related merge requests found
......@@ -10,12 +10,15 @@ import org.jdbi.v3.sqlobject.SqlObjectPlugin;
public class BDDFactory {
private static Jdbi jdbi = null;
private static String dbPath = "jdbc:sqlite:"
+ System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator")
+ System.getProperty("user.name")
+ "_";
public static Jdbi getJdbi() {
if ( jdbi == null ) {
jdbi = Jdbi.create("jdbc:sqlite:"
+ System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator") + "pizza.db")
jdbi = Jdbi.create(dbPath + "pizza.db")
.installPlugin(new SQLitePlugin())
.installPlugin(new SqlObjectPlugin());
}
......@@ -24,9 +27,7 @@ public class BDDFactory {
public static void setJdbiForTests() {
if ( jdbi == null ) {
jdbi = Jdbi.create("jdbc:sqlite:"
+ System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator") + "pizza_test.db")
jdbi = Jdbi.create(dbPath + "pizza_test.db")
.installPlugin(new SQLitePlugin())
.installPlugin(new SqlObjectPlugin());
}
......@@ -43,4 +44,4 @@ public class BDDFactory {
public static <T> T buildDao(Class<T> daoClass) {
return getJdbi().onDemand(daoClass);
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment