1 package org.apache.maven.plugin.jxr.stubs;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.artifact.Artifact;
23 import org.apache.maven.model.Model;
24 import org.apache.maven.model.ReportPlugin;
25 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
26 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
27
28 import java.io.File;
29 import java.io.FileReader;
30 import java.util.ArrayList;
31 import java.util.Iterator;
32 import java.util.List;
33
34
35
36
37 public class NoJavadocLinkConfigurationMavenProjectStub
38 extends MavenProjectStub
39 {
40 List reportPlugins = new ArrayList();
41
42 public NoJavadocLinkConfigurationMavenProjectStub()
43 {
44 MavenXpp3Reader pomReader = new MavenXpp3Reader();
45 Model model = null;
46
47 try
48 {
49 model = pomReader.read( new FileReader( new File( getBasedir() +
50 "/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml" ) ) );
51 setModel( model );
52 }
53 catch ( Exception e )
54 {
55
56 }
57
58 setArtifactId( model.getArtifactId() );
59 setGroupId( model.getGroupId() );
60 setVersion( model.getVersion() );
61 setPackaging( model.getPackaging() );
62 setInceptionYear( model.getInceptionYear() );
63
64 String basedir = getBasedir().getAbsolutePath();
65 List compileSourceRoots = new ArrayList();
66 compileSourceRoots.add(
67 basedir + "/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink/configuration" );
68 setCompileSourceRoots( compileSourceRoots );
69
70
71 List reportPlugins = new ArrayList();
72 for ( Iterator iter = model.getReporting().getPlugins().iterator(); iter.hasNext(); )
73 {
74 ReportPlugin plugin = (ReportPlugin) iter.next();
75 reportPlugins.add( plugin );
76 }
77 setReportPlugins( reportPlugins );
78
79 Artifact artifact = new JxrPluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging() );
80 artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
81 setArtifact( artifact );
82
83 }
84
85 public void setReportPlugins( List plugins )
86 {
87 this.reportPlugins = plugins;
88 }
89
90 public List getReportPlugins()
91 {
92 return reportPlugins;
93 }
94 }