File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\test\java\hudson\tools\ToolLocationTest.java.html

1 package hudson.tools;
2
3 import jenkins.model.Jenkins;
4 import org.jvnet.hudson.test.HudsonTestCase;
5 import org.jvnet.hudson.test.recipes.LocalData;
6 import hudson.tasks.Maven;
7 import hudson.tasks.Ant;
8 import hudson.model.JDK;
9
10 import java.util.Arrays;
11
12 /**
13 * @author huybrechts
14 */
15 public class ToolLocationTest extends HudsonTestCase {
16
17 /**
18 * Test xml compatibility since 'extends ToolInstallation'
19 */
20 @LocalData
21 public void testToolCompatibility() {
22 Maven.MavenInstallation[] maven = Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).getInstallations();
23 assertEquals(maven.length, 1);
24 assertEquals(maven[0].getHome(), "bar");
25 assertEquals(maven[0].getName(), "Maven 1");
26
27
28 Ant.AntInstallation[] ant = Jenkins.getInstance().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations();
29 assertEquals(ant.length, 1);
30 assertEquals(ant[0].getHome(), "foo");
31 assertEquals(ant[0].getName(), "Ant 1");
32
33 JDK[] jdk = Jenkins.getInstance().getDescriptorByType(JDK.DescriptorImpl.class).getInstallations();
34 assertEquals(Arrays.asList(jdk), Jenkins.getInstance().getJDKs());
35 assertEquals(2, jdk.length); // HudsonTestCase adds a 'default' JDK
36 assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing
37 assertEquals("FOOBAR", jdk[0].getHome());
38 assertEquals("FOOBAR", jdk[0].getJavaHome());
39 assertEquals("1.6", jdk[0].getName());
40
41 }
42 }
43