Skip to content

Commit

Permalink
Added some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patbos committed Sep 11, 2014
1 parent e9eb60d commit fb6f37a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Expand Up @@ -499,7 +499,6 @@ public void triggerExceptionMessageShouldSuggestRemovingFolderPrefixIfPresent()
assertTrue(exceptionMessage.contains("Did you mean to specify " + projectName + "?"));
}

@Ignore("Ignored due to JenkinsRule 404 for the URL /plugin/jquery-ui/js/jquery-ui-1.8.9.custom.min.js")
@Test
public void testDoCreateItem() throws Exception {
testDoCreateItem("testDoCreateItem", "");
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/se/diabol/jenkins/pipeline/domain/TaskTest.java
Expand Up @@ -17,6 +17,7 @@
*/
package se.diabol.jenkins.pipeline.domain;

import au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger;
import hudson.Launcher;
import hudson.matrix.Axis;
import hudson.matrix.AxisList;
Expand Down Expand Up @@ -70,6 +71,18 @@ public void testGetAg() throws Exception {

}

@Test
public void testManualTask() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("a");
FreeStyleProject b = jenkins.createFreeStyleProject("b");
a.getPublishersList().add(new BuildPipelineTrigger("b", null));
jenkins.getInstance().rebuildDependencyGraph();

Task task = Task.getPrototypeTask(b);
assertTrue(task.isManual());

}

@Test
public void testGetLatestRunning() throws Exception {
final OneShotEvent buildStarted = new OneShotEvent();
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/se/diabol/jenkins/pipeline/util/ProjectUtilTest.java
Expand Up @@ -17,16 +17,19 @@
*/
package se.diabol.jenkins.pipeline.util;

import hudson.EnvVars;
import hudson.model.AbstractProject;
import hudson.model.FreeStyleProject;
import hudson.util.ListBoxModel;
import jenkins.model.Jenkins;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.MockFolder;
import org.jvnet.hudson.test.WithoutJenkins;
import se.diabol.jenkins.pipeline.test.TestUtil;

import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;
Expand Down Expand Up @@ -91,4 +94,23 @@ public void testGetProject() throws Exception {

}

@Test
public void testGetProjectList() throws Exception {
jenkins.createFreeStyleProject("p1");
jenkins.createFreeStyleProject("p2");

List<AbstractProject> projects = ProjectUtil.getProjectList("p1,p2", jenkins.getInstance(), null);
assertEquals(2, projects.size());

projects = ProjectUtil.getProjectList("p1,p2,p3", jenkins.getInstance(), null);
assertEquals(2, projects.size());

projects = ProjectUtil.getProjectList("p1,p2,p3", jenkins.getInstance(), new EnvVars());
assertEquals(2, projects.size());

projects = ProjectUtil.getProjectList(",,", jenkins.getInstance(), new EnvVars());
assertEquals(0, projects.size());

}

}

0 comments on commit fb6f37a

Please sign in to comment.