@Test public void testSuccessiveBranches() throws QueryException, IOException { Commit A = new Commit("a", 1); Commit B = new Commit("b", 2, Collections.singletonList(A)); Commit C = new Commit("c", 3, Collections.singletonList(B)); Commit D = new Commit("d", 5, Collections.singletonList(A)); Commit E = new Commit("e", 4, Collections.singletonList(D)); Commit F = new Commit("f", 6, Arrays.asList(C, E)); Commit G = new Commit("g", 7, Collections.singletonList(F)); Commit H = new Commit("h", 8, Collections.singletonList(F)); Commit I = new Commit("i", 9, Arrays.asList(H, G)); initializeHead(I); initializeMocks(A, B, C, D, E, F, G, H, I); getQuery().query(); debugBranchCommitInsertions(); verify(persistence, times(12)).addStatements(any()); verify(branchQueries).branchInsertionStatement(projectId, 0, null, null); verify(branchQueries).branchCommitInsertionQuery(projectId, 0, A.sha, 0); verify(branchQueries).branchCommitInsertionQuery(projectId, 0, B.sha, 1); verify(branchQueries).branchCommitInsertionQuery(projectId, 0, C.sha, 2); verify(branchQueries).branchCommitInsertionQuery(projectId, 0, F.sha, 3); verify(branchQueries).branchCommitInsertionQuery(projectId, 0, H.sha, 4); verify(branchQueries).branchCommitInsertionQuery(projectId, 0, I.sha, 5); verify(branchQueries).branchInsertionStatement(projectId, 1, F, I); verify(branchQueries).branchCommitInsertionQuery(projectId, 1, G.sha, 0); verify(branchQueries).branchInsertionStatement(projectId, 2, A, F); verify(branchQueries).branchCommitInsertionQuery(projectId, 2, D.sha, 0); verify(branchQueries).branchCommitInsertionQuery(projectId, 2, E.sha, 1); }
@Override public void query() throws QueryException { logger.info("[" + projectId + "] Starting Branches insertion"); Commit commit = retrieveHeadCommit(); List<Branch> branches = buildBranchTree(null, commit); for (Branch branch : branches) { persistBranch(branch); } persistence.commit(); }
BranchQuery extends PersistenceAnalyzer implements Query { @Override public void query() throws QueryException { logger.info("[" + projectId + "] Starting Branches insertion"); Commit commit = retrieveHeadCommit(); List<Branch> branches = buildBranchTree(null, commit); for (Branch branch : branches) { persistBranch(branch); } persistence.commit(); } }
BranchQuery extends PersistenceAnalyzer implements Query { @Override public void query() throws QueryException { logger.info("[" + projectId + "] Starting Branches insertion"); Commit commit = retrieveHeadCommit(); List<Branch> branches = buildBranchTree(null, commit); for (Branch branch : branches) { persistBranch(branch); } persistence.commit(); } BranchQuery(int projectId, Repository repository,
                       Persistence persistence, CommitQueries commitQueries, BranchQueries branchQueries); }
BranchQuery extends PersistenceAnalyzer implements Query { @Override public void query() throws QueryException { logger.info("[" + projectId + "] Starting Branches insertion"); Commit commit = retrieveHeadCommit(); List<Branch> branches = buildBranchTree(null, commit); for (Branch branch : branches) { persistBranch(branch); } persistence.commit(); } BranchQuery(int projectId, Repository repository,
                       Persistence persistence, CommitQueries commitQueries, BranchQueries branchQueries); @Override void query(); }
BranchQuery extends PersistenceAnalyzer implements Query { @Override public void query() throws QueryException { logger.info("[" + projectId + "] Starting Branches insertion"); Commit commit = retrieveHeadCommit(); List<Branch> branches = buildBranchTree(null, commit); for (Branch branch : branches) { persistBranch(branch); } persistence.commit(); } BranchQuery(int projectId, Repository repository,
                       Persistence persistence, CommitQueries commitQueries, BranchQueries branchQueries); @Override void query();  }