aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-11-13 23:30:33 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2012-11-13 23:30:33 +0100
commit40dd47a3997fdf830fc45bce9c4a387ef3fb4e94 (patch)
tree726d8c37af1eee3606b852bf3231fa7811eb6871
parenta742500840276ec694a6d25230ee52c05b385661 (diff)
downloadesper-testing-40dd47a3997fdf830fc45bce9c4a387ef3fb4e94.tar.gz
esper-testing-40dd47a3997fdf830fc45bce9c4a387ef3fb4e94.tar.bz2
esper-testing-40dd47a3997fdf830fc45bce9c4a387ef3fb4e94.tar.xz
esper-testing-40dd47a3997fdf830fc45bce9c4a387ef3fb4e94.zip
o Moving the common dao code to the top level package.
-rw-r--r--src/main/java/io/trygvis/esper/testing/AtomDao.java38
-rw-r--r--src/main/java/io/trygvis/esper/testing/Dao.java (renamed from src/main/java/io/trygvis/esper/testing/gitorious/Dao.java)2
-rw-r--r--src/main/java/io/trygvis/esper/testing/Daos.java3
-rw-r--r--src/main/java/io/trygvis/esper/testing/gitorious/GitoriousEventDao.java2
-rw-r--r--src/main/java/io/trygvis/esper/testing/gitorious/GitoriousProjectDao.java2
-rw-r--r--src/main/java/io/trygvis/esper/testing/gitorious/GitoriousRepositoryDao.java1
6 files changed, 6 insertions, 42 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/AtomDao.java b/src/main/java/io/trygvis/esper/testing/AtomDao.java
deleted file mode 100644
index 1441dd5..0000000
--- a/src/main/java/io/trygvis/esper/testing/AtomDao.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.trygvis.esper.testing;
-
-import java.net.*;
-import java.sql.*;
-
-public class AtomDao {
- private final PreparedStatement selectLastUpdate;
- private final PreparedStatement insertAtomFeed;
- private final PreparedStatement updateAtomFeed;
-
- public AtomDao(Connection c) throws SQLException {
- selectLastUpdate = c.prepareStatement("SELECT last_update FROM atom_feed WHERE url=?");
- insertAtomFeed = c.prepareStatement("INSERT INTO atom_feed(url, last_update) VALUES(?, ?)");
- updateAtomFeed = c.prepareStatement("UPDATE atom_feed SET last_update=? WHERE url=?");
- }
-
- public Timestamp getAtomFeed(URI uri) throws SQLException {
- selectLastUpdate.setString(1, uri.toASCIIString());
- ResultSet rs = selectLastUpdate.executeQuery();
- if (!rs.next()) {
- return null;
- }
-
- return rs.getTimestamp(1);
- }
-
- public void insertAtomFeed(URI uri, Timestamp lastUpdate) throws SQLException {
- insertAtomFeed.setString(1, uri.toASCIIString());
- insertAtomFeed.setTimestamp(2, lastUpdate);
- insertAtomFeed.executeUpdate();
- }
-
- public void updateAtomFeed(URI uri, Timestamp lastUpdate) throws SQLException {
- updateAtomFeed.setTimestamp(1, lastUpdate);
- updateAtomFeed.setString(2, uri.toASCIIString());
- updateAtomFeed.executeUpdate();
- }
-}
diff --git a/src/main/java/io/trygvis/esper/testing/gitorious/Dao.java b/src/main/java/io/trygvis/esper/testing/Dao.java
index 05faa9a..25535ee 100644
--- a/src/main/java/io/trygvis/esper/testing/gitorious/Dao.java
+++ b/src/main/java/io/trygvis/esper/testing/Dao.java
@@ -1,4 +1,4 @@
-package io.trygvis.esper.testing.gitorious;
+package io.trygvis.esper.testing;
import fj.*;
diff --git a/src/main/java/io/trygvis/esper/testing/Daos.java b/src/main/java/io/trygvis/esper/testing/Daos.java
index c8a3e4d..27f9df8 100644
--- a/src/main/java/io/trygvis/esper/testing/Daos.java
+++ b/src/main/java/io/trygvis/esper/testing/Daos.java
@@ -8,7 +8,6 @@ import java.sql.*;
public class Daos implements Closeable {
private final Connection connection;
- public final AtomDao atomDao;
public final GitoriousEventDao gitoriousEventDao;
public final GitoriousProjectDao gitoriousProjectDao;
public final GitoriousRepositoryDao gitoriousRepositoryDao;
@@ -18,7 +17,6 @@ public class Daos implements Closeable {
public Daos(Connection connection) throws SQLException {
this.connection = connection;
this.seq = counter++;
- atomDao = new AtomDao(connection);
gitoriousEventDao = new GitoriousEventDao(connection);
gitoriousProjectDao = new GitoriousProjectDao(connection);
gitoriousRepositoryDao = new GitoriousRepositoryDao(connection);
@@ -42,6 +40,5 @@ public class Daos implements Closeable {
public static Daos lookup(BoneCP boneCp) throws SQLException {
return new Daos(boneCp.getConnection());
-// return (Daos) ((ConnectionHandle) boneCp.getConnection()).getDebugHandle();
}
}
diff --git a/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousEventDao.java b/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousEventDao.java
index 93f31a5..79f2ef2 100644
--- a/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousEventDao.java
+++ b/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousEventDao.java
@@ -1,5 +1,7 @@
package io.trygvis.esper.testing.gitorious;
+import io.trygvis.esper.testing.*;
+
import java.sql.*;
public class GitoriousEventDao extends Dao {
diff --git a/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousProjectDao.java b/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousProjectDao.java
index 262d23c..3caf8a1 100644
--- a/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousProjectDao.java
+++ b/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousProjectDao.java
@@ -1,5 +1,7 @@
package io.trygvis.esper.testing.gitorious;
+import io.trygvis.esper.testing.*;
+
import java.sql.*;
import java.util.*;
diff --git a/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousRepositoryDao.java b/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousRepositoryDao.java
index bcb27de..0dcd57a 100644
--- a/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousRepositoryDao.java
+++ b/src/main/java/io/trygvis/esper/testing/gitorious/GitoriousRepositoryDao.java
@@ -1,6 +1,7 @@
package io.trygvis.esper.testing.gitorious;
import fj.data.*;
+import io.trygvis.esper.testing.*;
import java.net.*;
import java.sql.*;