Пример #1
0
 // ZD-13803
 @Bug(13803)
 @Test
 public void testDeleteJob() throws Exception {
   FreeStyleProject freeStyleProject = jenkins.createProject(FreeStyleProject.class, "test");
   freeStyleProject.save();
   SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
   System.out.println(
       "Before delete: "
           + sdf.format(new File(freeStyleProject.getRootDir(), "config.xml").lastModified()));
   freeStyleProject.delete();
   Thread.sleep(3 * 1000); // Give it a few seconds to create the file
   System.out.println(
       "After delete: "
           + sdf.format(new File(freeStyleProject.getRootDir(), "config.xml").lastModified()));
   assertFalse("Project should have been deleted", freeStyleProject.getRootDir().exists());
   Jenkins.getInstance().restart();
   Jenkins.getInstance().doReload();
   System.out.println(
       "After reload: "
           + sdf.format(new File(freeStyleProject.getRootDir(), "config.xml").lastModified()));
   assertFalse("Project should have been deleted", freeStyleProject.getRootDir().exists());
   assertFalse("Should not be disabled but instead deleted.", !freeStyleProject.isDisabled());
 }