KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > conflict > StrictConflictManagerTest


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.conflict;
7
8 import java.util.Date JavaDoc;
9
10 import fr.jayasoft.ivy.ConflictManager;
11 import fr.jayasoft.ivy.Ivy;
12 import junit.framework.TestCase;
13
14 public class StrictConflictManagerTest extends TestCase {
15
16     public void testInitFromConf() throws Exception JavaDoc {
17         Ivy ivy = new Ivy();
18         ivy.configure(StrictConflictManagerTest.class.getResource("ivyconf-strict-test.xml"));
19         ConflictManager cm = ivy.getDefaultConflictManager();
20         assertTrue(cm instanceof StrictConflictManager);
21     }
22
23     public void testNoConflictResolve() throws Exception JavaDoc {
24         Ivy ivy = new Ivy();
25         ivy.configure(StrictConflictManagerTest.class.getResource("ivyconf-strict-test.xml"));
26
27         ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-noconflict.xml"), null, new String JavaDoc[] { "*" }, null, new Date JavaDoc(), false);
28     }
29
30     public void testConflictResolve() throws Exception JavaDoc {
31         Ivy ivy = new Ivy();
32         ivy.configure(StrictConflictManagerTest.class.getResource("ivyconf-strict-test.xml"));
33
34         try {
35             ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-conflict.xml"), null, new String JavaDoc[] { "*" }, null, new Date JavaDoc(), false);
36
37             fail("Resolve should have failed with a conflict");
38         } catch (StrictConflictException e) {
39             // this is expected
40
}
41     }
42
43 }
44
Popular Tags