1 6 package fr.jayasoft.ivy.ant; 7 8 import java.io.File ; 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 IvyArtifactPropertyTest extends TestCase { 16 private File _cache; 17 private IvyArtifactProperty _prop; 18 private Project _project; 19 20 protected void setUp() throws Exception { 21 createCache(); 22 _project = new Project(); 23 _project.setProperty("ivy.conf.file", "test/repositories/ivyconf.xml"); 24 25 _prop = new IvyArtifactProperty(); 26 _prop.setProject(_project); 27 _prop.setCache(_cache); 28 } 29 30 private void createCache() { 31 _cache = new File ("build/cache"); 32 _cache.mkdirs(); 33 } 34 35 protected void tearDown() throws Exception { 36 cleanCache(); 37 } 38 39 private void cleanCache() { 40 Delete del = new Delete(); 41 del.setProject(new Project()); 42 del.setDir(_cache); 43 del.execute(); 44 } 45 46 public void testSimple() throws Exception { 47 _project.setProperty("ivy.dep.file", "test/java/fr/jayasoft/ivy/ant/ivy-simple.xml"); 48 _prop.setName("[module].[artifact]-[revision]"); 49 _prop.setValue("${cache.dir}/[module]/[artifact]-[revision].[type]"); 50 _prop.execute(); 51 String val = _project.getProperty("mod1.2.mod1.2-2.0"); 52 assertNotNull(val); 53 assertEquals("build/cache/mod1.2/mod1.2-2.0.jar", val); 54 } 55 } 56 | Popular Tags |