Beispiel #1
0
  // This is bug #2320 - Cruise doing full checkouts most times
  @Test
  public void shouldNotDeleteWorkingDirIfMaterialsAreCheckedOutToSubfoldersWithTheSameRootBug2320()
      throws Exception {
    SvnMaterial svnMaterial1 = repo.createMaterial("multiple-materials/trunk/part1", "root/part1");
    SvnMaterial svnMaterial2 = repo.createMaterial("multiple-materials/trunk/part2", "root/part2");
    Materials materials = new Materials(svnMaterial1, svnMaterial2);

    Revision revision =
        latestRevision(svnMaterial1, pipelineDir, new TestSubprocessExecutionContext());

    updateMaterials(materials, revision);

    assertThat(new File(pipelineDir, "root/part1").exists(), is(true));
    assertThat(new File(pipelineDir, "root/part2").exists(), is(true));

    File testFile = new File(pipelineDir, "root/part1/test-file");
    testFile.createNewFile();
    assertThat(testFile.exists(), is(true));
    // simulates what a build will do
    TestFileUtil.createTestFolder(pipelineDir, ArtifactLogUtil.CRUISE_OUTPUT_FOLDER);
    assertThat(pipelineDir.listFiles().length, is(2));

    updateMaterials(materials, revision);

    assertThat(new File(pipelineDir, "root/part1").exists(), is(true));
    assertThat(new File(pipelineDir, "root/part2").exists(), is(true));

    assertThat("Should not delete the part1 directory", testFile.exists(), is(true));
  }
Beispiel #2
0
  @Test
  public void shouldNotDeleteDirectoriesWhenThereIsACruiseOutputDirectory() throws Exception {
    SvnMaterial svnMaterial1 = repo.createMaterial("multiple-materials/trunk/part1", "part1");
    SvnMaterial svnMaterial2 = repo.createMaterial("multiple-materials/trunk/part2", "part2");
    Materials materials = new Materials(svnMaterial1, svnMaterial2);

    Revision revision =
        latestRevision(svnMaterial1, pipelineDir, new TestSubprocessExecutionContext());

    updateMaterials(materials, revision);

    assertThat(new File(pipelineDir, "part1").exists(), is(true));
    assertThat(new File(pipelineDir, "part2").exists(), is(true));

    File testFile = new File(pipelineDir, "part1/test-file");
    testFile.createNewFile();
    assertThat(testFile.exists(), is(true));
    // simulates what a build will do
    TestFileUtil.createTestFolder(pipelineDir, ArtifactLogUtil.CRUISE_OUTPUT_FOLDER);
    assertThat(pipelineDir.listFiles().length, is(3));

    updateMaterials(materials, revision);

    assertThat(new File(pipelineDir, "part1").exists(), is(true));
    assertThat(new File(pipelineDir, "part2").exists(), is(true));

    assertThat("Should not delete the part1 directory", testFile.exists(), is(true));
  }