Ejemplo n.º 1
0
  @Test
  public void shouldSelectPurgeableSnapshots() {
    setupData("shouldSelectPurgeableSnapshots");
    List<PurgeableSnapshotDto> snapshots = dao.selectPurgeableSnapshots(1L);

    assertThat(snapshots, hasItem(new SnapshotMatcher(1L, true, false)));
    assertThat(snapshots, hasItem(new SnapshotMatcher(4L, false, false)));
    assertThat(snapshots, hasItem(new SnapshotMatcher(5L, false, true)));
    assertThat(snapshots.size(), is(3));
  }
Ejemplo n.º 2
0
 @Test
 public void shouldDeleteProject() {
   setupData("shouldDeleteProject");
   dao.deleteResourceTree(1L);
   assertEmptyTables(
       "projects",
       "snapshots",
       "action_plans",
       "action_plans_reviews",
       "reviews",
       "review_comments",
       "issues",
       "issue_changes",
       "action_plans_issues");
 }
Ejemplo n.º 3
0
  @Test
  public void shouldCloseReviewWhenDisablingResource() {
    setupData("shouldCloseReviewWhenDisablingResource");

    SqlSession session = getMyBatis().openSession();
    try {
      dao.disableResource(1L, session.getMapper(PurgeMapper.class));

      // the above method does not commit and close the session
      session.commit();

    } finally {
      MyBatis.closeQuietly(session);
    }
    checkTables(
        "shouldCloseReviewWhenDisablingResource", /* excluded column */
        new String[] {"updated_at"},
        "reviews");
  }
Ejemplo n.º 4
0
 @Test
 public void shouldDeleteSnapshots() {
   setupData("shouldDeleteSnapshots");
   dao.deleteSnapshots(PurgeSnapshotQuery.create().setIslast(false).setResourceId(1L));
   checkTables("shouldDeleteSnapshots", "snapshots");
 }
Ejemplo n.º 5
0
 @Test
 public void shouldDisableResourcesWithoutLastSnapshot() {
   setupData("shouldDisableResourcesWithoutLastSnapshot");
   dao.purge(1, new String[0]);
   checkTables("shouldDisableResourcesWithoutLastSnapshot", "projects", "snapshots");
 }
Ejemplo n.º 6
0
 @Test
 public void shouldDeleteHistoricalDataOfDirectoriesAndFiles() {
   setupData("shouldDeleteHistoricalDataOfDirectoriesAndFiles");
   dao.purge(1, new String[] {Scopes.DIRECTORY, Scopes.FILE});
   checkTables("shouldDeleteHistoricalDataOfDirectoriesAndFiles", "projects", "snapshots");
 }
Ejemplo n.º 7
0
 @Test
 public void shouldPurgeProject() {
   setupData("shouldPurgeProject");
   dao.purge(1, new String[0]);
   checkTables("shouldPurgeProject", "projects", "snapshots");
 }
Ejemplo n.º 8
0
 @Test
 public void shouldDeleteAbortedBuilds() {
   setupData("shouldDeleteAbortedBuilds");
   dao.purge(1L, new String[0]);
   checkTables("shouldDeleteAbortedBuilds", "snapshots");
 }