@Test public void testCommitNotInPaprika() throws Exception { addCommitInPaprika(A); addCommitInRepository(A); addCommitInPaprika(B); addCommitInRepository(B); addCommitInRepository(C); addCommitInPaprika(D); addCommitInRepository(D); prepareGitLog(A, B, C, D); getCommitsAnalysis().query(); verify(commitQueries, times(4)).commitInsertionStatement(anyInt(), any(Commit.class), any(GitDiff.class)); verify(commitQueries).commitInsertionStatement(projectId, A, dummyDetails.diff); verify(commitQueries).commitInsertionStatement(projectId, B, dummyDetails.diff); verify(commitQueries).commitInsertionStatement(projectId, C, dummyDetails.diff); verify(commitQueries).commitInsertionStatement(projectId, D, dummyDetails.diff); verify(developerQueries, times(4)).developerInsertStatement(anyString()); verify(developerQueries, times(2)).developerInsertStatement(A.authorEmail); verify(developerQueries, times(2)).developerInsertStatement(C.authorEmail); verify(developerQueries, times(4)).projectDeveloperInsertStatement(eq(projectId), anyString()); verify(developerQueries, times(2)).projectDeveloperInsertStatement(projectId, A.authorEmail); verify(developerQueries, times(2)).projectDeveloperInsertStatement(projectId, C.authorEmail); verify(commitQueries, times(0)).fileRenameInsertionStatement(eq(projectId), anyString(), any(GitRename.class)); }
@Override public void query() throws QueryException { List<String> commitStatements = new ArrayList<>(); List<String> authorStatements = new ArrayList<>(); List<String> renameStatements = new ArrayList<>(); int commitCount = 0; CommitDetails details; Commit currentCommit; for (String commit : choseCommitsSource()) { currentCommit = fillCommit(commit); logger.debug("[" + projectId + "] => Analyzing commit: " + currentCommit.sha); details = detailsChecker.fetch(currentCommit.sha); authorStatements.addAll(authorStatements(currentCommit.authorEmail)); commitStatements.add(commitStatement(currentCommit, details)); renameStatements.addAll(fileRenameStatements(currentCommit, details)); if (++commitCount % BATCH_SIZE == 0) { logger.info("[" + projectId + "] Persist commit batch of size: " + BATCH_SIZE); persistBatch(commitStatements, authorStatements, renameStatements); authorStatements.clear(); commitStatements.clear(); renameStatements.clear(); } } persistBatch(commitStatements, authorStatements, renameStatements); }
CommitsAnalysis implements Query { @Override public void query() throws QueryException { List<String> commitStatements = new ArrayList<>(); List<String> authorStatements = new ArrayList<>(); List<String> renameStatements = new ArrayList<>(); int commitCount = 0; CommitDetails details; Commit currentCommit; for (String commit : choseCommitsSource()) { currentCommit = fillCommit(commit); logger.debug("[" + projectId + "] => Analyzing commit: " + currentCommit.sha); details = detailsChecker.fetch(currentCommit.sha); authorStatements.addAll(authorStatements(currentCommit.authorEmail)); commitStatements.add(commitStatement(currentCommit, details)); renameStatements.addAll(fileRenameStatements(currentCommit, details)); if (++commitCount % BATCH_SIZE == 0) { logger.info("[" + projectId + "] Persist commit batch of size: " + BATCH_SIZE); persistBatch(commitStatements, authorStatements, renameStatements); authorStatements.clear(); commitStatements.clear(); renameStatements.clear(); } } persistBatch(commitStatements, authorStatements, renameStatements); } }
CommitsAnalysis implements Query { @Override public void query() throws QueryException { List<String> commitStatements = new ArrayList<>(); List<String> authorStatements = new ArrayList<>(); List<String> renameStatements = new ArrayList<>(); int commitCount = 0; CommitDetails details; Commit currentCommit; for (String commit : choseCommitsSource()) { currentCommit = fillCommit(commit); logger.debug("[" + projectId + "] => Analyzing commit: " + currentCommit.sha); details = detailsChecker.fetch(currentCommit.sha); authorStatements.addAll(authorStatements(currentCommit.authorEmail)); commitStatements.add(commitStatement(currentCommit, details)); renameStatements.addAll(fileRenameStatements(currentCommit, details)); if (++commitCount % BATCH_SIZE == 0) { logger.info("[" + projectId + "] Persist commit batch of size: " + BATCH_SIZE); persistBatch(commitStatements, authorStatements, renameStatements); authorStatements.clear(); commitStatements.clear(); renameStatements.clear(); } } persistBatch(commitStatements, authorStatements, renameStatements); } CommitsAnalysis(int projectId, Persistence persistence, Repository repository,
                    Iterator<Map<String, Object>> commits,
                    CommitDetailsChecker detailsChecker,
                    DeveloperQueries developerQueries, CommitQueries commitQueries);   CommitsAnalysis(int projectId, Persistence persistence, Repository repository,
                    Iterator<Map<String, Object>> commits,
                    CommitDetailsChecker detailsChecker,
                    DeveloperQueries developerQueries, CommitQueries commitQueries,
                    boolean paprikaOnly); }
CommitsAnalysis implements Query { @Override public void query() throws QueryException { List<String> commitStatements = new ArrayList<>(); List<String> authorStatements = new ArrayList<>(); List<String> renameStatements = new ArrayList<>(); int commitCount = 0; CommitDetails details; Commit currentCommit; for (String commit : choseCommitsSource()) { currentCommit = fillCommit(commit); logger.debug("[" + projectId + "] => Analyzing commit: " + currentCommit.sha); details = detailsChecker.fetch(currentCommit.sha); authorStatements.addAll(authorStatements(currentCommit.authorEmail)); commitStatements.add(commitStatement(currentCommit, details)); renameStatements.addAll(fileRenameStatements(currentCommit, details)); if (++commitCount % BATCH_SIZE == 0) { logger.info("[" + projectId + "] Persist commit batch of size: " + BATCH_SIZE); persistBatch(commitStatements, authorStatements, renameStatements); authorStatements.clear(); commitStatements.clear(); renameStatements.clear(); } } persistBatch(commitStatements, authorStatements, renameStatements); } CommitsAnalysis(int projectId, Persistence persistence, Repository repository,
                    Iterator<Map<String, Object>> commits,
                    CommitDetailsChecker detailsChecker,
                    DeveloperQueries developerQueries, CommitQueries commitQueries);   CommitsAnalysis(int projectId, Persistence persistence, Repository repository,
                    Iterator<Map<String, Object>> commits,
                    CommitDetailsChecker detailsChecker,
                    DeveloperQueries developerQueries, CommitQueries commitQueries,
                    boolean paprikaOnly); @Override void query(); }
CommitsAnalysis implements Query { @Override public void query() throws QueryException { List<String> commitStatements = new ArrayList<>(); List<String> authorStatements = new ArrayList<>(); List<String> renameStatements = new ArrayList<>(); int commitCount = 0; CommitDetails details; Commit currentCommit; for (String commit : choseCommitsSource()) { currentCommit = fillCommit(commit); logger.debug("[" + projectId + "] => Analyzing commit: " + currentCommit.sha); details = detailsChecker.fetch(currentCommit.sha); authorStatements.addAll(authorStatements(currentCommit.authorEmail)); commitStatements.add(commitStatement(currentCommit, details)); renameStatements.addAll(fileRenameStatements(currentCommit, details)); if (++commitCount % BATCH_SIZE == 0) { logger.info("[" + projectId + "] Persist commit batch of size: " + BATCH_SIZE); persistBatch(commitStatements, authorStatements, renameStatements); authorStatements.clear(); commitStatements.clear(); renameStatements.clear(); } } persistBatch(commitStatements, authorStatements, renameStatements); } CommitsAnalysis(int projectId, Persistence persistence, Repository repository,
                    Iterator<Map<String, Object>> commits,
                    CommitDetailsChecker detailsChecker,
                    DeveloperQueries developerQueries, CommitQueries commitQueries);   CommitsAnalysis(int projectId, Persistence persistence, Repository repository,
                    Iterator<Map<String, Object>> commits,
                    CommitDetailsChecker detailsChecker,
                    DeveloperQueries developerQueries, CommitQueries commitQueries,
                    boolean paprikaOnly); @Override void query(); static final int BATCH_SIZE; }