Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-20113] - Unable to delete metadata job.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/java/com/sonyericsson/hudson/plugins/metadata/DeleteTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.sonyericsson.hudson.plugins.metadata; | ||
|
||
import jenkins.model.Jenkins; | ||
import hudson.model.FreeStyleProject; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Bug; | ||
import org.jvnet.hudson.test.HudsonTestCase; | ||
|
||
import java.io.File; | ||
import java.text.SimpleDateFormat; | ||
|
||
/** | ||
* @author christ66 | ||
* Date: 10/14/13 | ||
* Time: 7:16 PM | ||
*/ | ||
public class DeleteTest extends HudsonTestCase { | ||
// 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()); | ||
} | ||
} |