JDBCCommitQueries extends JDBCQueriesHelper implements CommitQueries { @Override public String idFromShaQuery(int projectId, String sha) { return idFromShaQuery(projectId, sha, false); } JDBCCommitQueries(DeveloperQueries developerQueries); @Override String commitInsertionStatement(int projectId, Commit commit, GitDiff diff); @Override String idFromShaQuery(int projectId, String sha); @Override String shaFromOrdinalQuery(int projectId, int ordinal); @Override String idFromShaQuery(int projectId, String sha, boolean paprikaOnly); @Override String shaFromOrdinalQuery(int projectId, int ordinal, boolean paprikaOnly); @Override String lastProjectCommitShaQuery(int projectId); @Override String lastProjectCommitShaQuery(int projectId, boolean paprikaOnly); @Override String fileRenameInsertionStatement(int projectId, String commitSha, GitRename rename); @Override String mergedCommitIdQuery(int projectId, Commit commit); @Override String projectIdFromShaQuery(String sha); @Override String updateCommitSizeQuery(int projectId, String tempTable); @Override String fileChangedInsertionStatement(int projectId, String commitSha, GitChangedFile changedFile);  }
@Test public void testIdFromShaQuery() { List<Map<String, Object>> result; result = persistence.query(queries.idFromShaQuery(projectId, "anySha")); assertTrue(result.isEmpty()); Commit commit = generateCommit("sha", 1); Commit anotherSha = generateCommit("anotherSha", commit.ordinal + 1); executeSuccess(queries.commitInsertionStatement(projectId, commit, GitDiff.EMPTY)); executeSuccess(queries.commitInsertionStatement(projectId, anotherSha, GitDiff.EMPTY)); result = persistence.query(queries.idFromShaQuery(projectId, "anySha")); assertTrue(result.isEmpty()); result = persistence.query(queries.idFromShaQuery(projectId, commit.sha)); assertEquals(1, result.get(0).get("id")); result = persistence.query(queries.idFromShaQuery(projectId, anotherSha.sha)); assertEquals(2, result.get(0).get("id")); }