KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > ant > IvyReportTest


1 /*
2  * This file is subject to the license found in LICENCE.TXT in the root directory of the project.
3  *
4  * #SNAPSHOT#
5  */

6 package fr.jayasoft.ivy.ant;
7
8 import java.io.File JavaDoc;
9
10 import junit.framework.TestCase;
11
12 import org.apache.tools.ant.Project;
13 import org.apache.tools.ant.taskdefs.Delete;
14
15 public class IvyReportTest extends TestCase {
16     private File JavaDoc _cache;
17     private IvyReport _report;
18     private Project _project;
19     
20     protected void setUp() throws Exception JavaDoc {
21         createCache();
22         _project = new Project();
23         _project.setProperty("ivy.conf.file", "test/repositories/ivyconf.xml");
24
25         _report = new IvyReport();
26         _report.setTaskName("report");
27         _report.setProject(_project);
28         _report.setCache(_cache);
29     }
30
31     private void createCache() {
32         _cache = new File JavaDoc("build/cache");
33         _cache.mkdirs();
34     }
35     
36     protected void tearDown() throws Exception JavaDoc {
37         cleanCache();
38     }
39
40     private void cleanCache() {
41         Delete del = new Delete();
42         del.setProject(new Project());
43         del.setDir(_cache);
44         del.execute();
45     }
46
47     public void testRegularCircular() throws Exception JavaDoc {
48         _project.setProperty("ivy.dep.file", "test/repositories/2/mod11.1/ivy-1.0.xml");
49         IvyResolve res = new IvyResolve();
50         res.setProject(_project);
51         res.execute();
52         
53         _report.setTodir(new File JavaDoc(_cache, "report"));
54         _report.setXml(true);
55         
56         // do not test any xsl transformation here, because of problems of build in our continuous integration server
57
_report.setXsl(false);
58         _report.setGraph(false);
59         
60         _report.execute();
61         
62         assertTrue(new File JavaDoc(_cache, "report/org11-mod11.1-compile.xml").exists());
63     }
64 }
65
Popular Tags