KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
9  * @author Anders janmyr
10  */

11
12 import java.util.Date JavaDoc;
13
14 import junit.framework.*;
15 import fr.jayasoft.ivy.Ivy;
16
17
18 public class RegexpConflictManagerTest extends TestCase
19 {
20     private Ivy ivy;
21
22     protected void setUp() throws Exception JavaDoc
23     {
24         ivy = new Ivy();
25         ivy.configure( RegexpConflictManagerTest.class
26                 .getResource( "ivyconf-regexp-test.xml" ) );
27     }
28
29     public void testNoApiConflictResolve() throws Exception JavaDoc
30     {
31         try
32         {
33             ivy.resolve( RegexpConflictManagerTest.class
34                     .getResource( "ivy-no-regexp-conflict.xml" ), null,
35                     new String JavaDoc[] { "*" }, null, new Date JavaDoc(), false );
36         }
37         catch ( StrictConflictException e )
38         {
39             fail( "Unexpected conflict: " + e );
40         }
41     }
42
43     public void testConflictResolve() throws Exception JavaDoc
44     {
45         try
46         {
47             ivy.resolve( RegexpConflictManagerTest.class
48                     .getResource( "ivy-conflict.xml" ), null,
49                     new String JavaDoc[] { "*" }, null, new Date JavaDoc(), false );
50
51             fail( "Resolve should have failed with a conflict" );
52         }
53         catch ( StrictConflictException e )
54         {
55             // this is expected
56
assertTrue(e.getMessage().indexOf("[ org1 | mod1.2 | 2.0.0 ]:2.0 (needed by [ jayasoft | resolve-noconflict | 1.0 ])")!=-1);
57             assertTrue(e.getMessage().indexOf("conflicts with")!=-1);
58             assertTrue(e.getMessage().indexOf("[ org1 | mod1.2 | 2.1.0 ]:2.1 (needed by [ jayasoft | resolve-noconflict | 1.0 ])")!=-1);
59         }
60     }
61 }
Popular Tags