1 package org.apache.maven.usability.plugin;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23
24 import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader;
25 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
26
27 import java.io.IOException;
28 import java.io.InputStream;
29 import java.io.InputStreamReader;
30 import java.util.Map;
31 import java.util.Properties;
32
33 public class Xpp3ParseTest
34 extends TestCase
35 {
36
37 public void testParse() throws IOException, XmlPullParserException
38 {
39 InputStream testDocStream = getClass().getClassLoader().getResourceAsStream( "test.paramdoc.xml" );
40 ParamdocXpp3Reader reader = new ParamdocXpp3Reader();
41
42 ExpressionDocumentation documentation = reader.read(new InputStreamReader( testDocStream ) );
43
44 Map exprs = documentation.getExpressionsBySyntax();
45
46 Expression expr = (Expression) exprs.get( "localRepository" );
47
48 assertNotNull( expr );
49
50 Properties p = expr.getCliOptions();
51
52 assertNotNull( p );
53
54 assertEquals( 1, p.size() );
55
56 assertEquals( "Override the local repository location on a per-build basis.", p.getProperty( "-Dmaven.repo.local=/path/to/local/repo" ) );
57
58 }
59
60 }