1 package org.apache.maven.model.converter.plugins;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.Assert;
23 import org.apache.maven.model.converter.ProjectConverterException;
24 import org.codehaus.plexus.util.xml.Xpp3Dom;
25
26 import java.io.IOException;
27
28
29
30
31
32 public class PCCWarTest
33 extends AbstractPCCTest
34 {
35 protected void setUp()
36 throws Exception
37 {
38 super.setUp();
39
40 pluginConfigurationConverter = new PCCWar();
41 }
42
43 public void testBuildConfiguration1()
44 {
45 try
46 {
47 projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest1.properties" ) );
48
49 pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
50
51 String value = configuration.getChild( "warSourceDirectory" ).getValue();
52 Assert.assertEquals( "check warSourceDirectory value", "myWebappDirectory", value );
53 }
54 catch ( ProjectConverterException e )
55 {
56 Assert.fail( e.getMessage() );
57 }
58 catch ( IOException e )
59 {
60 Assert.fail( "Unable to find the requested resource." );
61 }
62 }
63
64 public void testBuildConfiguration2()
65 {
66 try
67 {
68 projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest2.properties" ) );
69
70 pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
71
72 String value = configuration.getChild( "warSourceDirectory" ).getValue();
73 Assert.assertEquals( "check warSourceDirectory value", "myWebappDirectory", value );
74 }
75 catch ( ProjectConverterException e )
76 {
77 Assert.fail( e.getMessage() );
78 }
79 catch ( IOException e )
80 {
81 Assert.fail( "Unable to find the requested resource." );
82 }
83 }
84
85 public void testBuildConfiguration3()
86 {
87 try
88 {
89 projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest3.properties" ) );
90
91 pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
92
93 Xpp3Dom child = configuration.getChild( "warSourceDirectory" );
94 Assert.assertEquals( "check warSourceDirectory element", null, child );
95 }
96 catch ( ProjectConverterException e )
97 {
98 Assert.fail( e.getMessage() );
99 }
100 catch ( IOException e )
101 {
102 Assert.fail( "Unable to find the requested resource." );
103 }
104 }
105 }