1 package org.apache.maven.plugin.resources.remote.stub;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.Collection;
24 import java.util.LinkedList;
25 import java.util.List;
26
27 import org.apache.maven.artifact.Artifact;
28 import org.apache.maven.artifact.handler.ArtifactHandler;
29 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
30 import org.apache.maven.artifact.metadata.ArtifactMetadata;
31 import org.apache.maven.artifact.repository.ArtifactRepository;
32 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
33 import org.apache.maven.artifact.versioning.ArtifactVersion;
34 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
35 import org.apache.maven.artifact.versioning.VersionRange;
36
37
38
39
40
41 public class ArtifactStub
42 implements Artifact
43 {
44
45 boolean hasClassifier;
46
47 boolean resolved;
48
49 boolean optional;
50
51 boolean release;
52
53 ArtifactHandler artifactHandler;
54
55 File file;
56
57 String baseVersion;
58
59 String type;
60
61 String classifier;
62
63 String identifier;
64
65 String dependencyConflictId;
66
67 String downloadUrl;
68
69 String selectedVersion;
70
71 String artifactId;
72
73 String groupId;
74
75 String resolvedVersion;
76
77 String scope;
78
79 String version;
80
81 VersionRange versionRange;
82
83
84 public ArtifactStub()
85 {
86 type = "testtype";
87 scope = "testscope";
88 classifier = "testclassifier";
89 artifactHandler = new DefaultArtifactHandler();
90 }
91
92 public void populate( MavenProjectBasicStub project )
93 {
94 groupId = project.getGroupId();
95 artifactId = project.getArtifactId();
96 version = project.getVersion();
97 versionRange = VersionRange.createFromVersion( version );
98 }
99
100 public boolean hasClassifier()
101 {
102 return true;
103 }
104
105 public String getBaseVersion()
106 {
107 return "Test Version";
108 }
109
110 public void setBaseVersion( String version )
111 {
112 baseVersion = version;
113 }
114
115 public void setFile( File _file )
116 {
117 file = _file;
118 }
119
120 public File getFile()
121 {
122 return new File( "testfile" );
123 }
124
125 public String getGroupId()
126 {
127 return groupId;
128 }
129
130 public String getArtifactId()
131 {
132 return artifactId;
133 }
134
135 public String getVersion()
136 {
137 return version;
138 }
139
140 public void setVersion( String _version )
141 {
142 version = _version;
143 }
144
145 public String getScope()
146 {
147 return scope;
148 }
149
150 public String getType()
151 {
152 return type;
153 }
154
155 public String getClassifier()
156 {
157 return classifier;
158 }
159
160 public String getId()
161 {
162 return identifier;
163 }
164
165 public String getDependencyConflictId()
166 {
167 return dependencyConflictId;
168 }
169
170 public void addMetadata( ArtifactMetadata metadata )
171 {
172
173 }
174
175 public Collection<ArtifactMetadata> getMetadataList()
176 {
177 return new LinkedList<ArtifactMetadata>();
178 }
179
180 public void setRepository( ArtifactRepository remoteRepository )
181 {
182
183 }
184
185 public ArtifactRepository getRepository()
186 {
187 return null;
188 }
189
190 public void updateVersion( String version, ArtifactRepository localRepository )
191 {
192
193 }
194
195 public String getDownloadUrl()
196 {
197 return downloadUrl;
198 }
199
200 public void setDownloadUrl( String _downloadUrl )
201 {
202 downloadUrl = _downloadUrl;
203 }
204
205 public ArtifactFilter getDependencyFilter()
206 {
207 return null;
208 }
209
210 public void setDependencyFilter( ArtifactFilter artifactFilter )
211 {
212
213 }
214
215 public ArtifactHandler getArtifactHandler()
216 {
217 return artifactHandler;
218 }
219
220 public List<String> getDependencyTrail()
221 {
222 return new LinkedList<String>();
223 }
224
225 public void setDependencyTrail(List<String> dependencyTrail)
226 {
227
228 }
229
230 public void setScope( String _scope )
231 {
232 scope = _scope;
233 }
234
235 public VersionRange getVersionRange()
236 {
237 return versionRange;
238 }
239
240 public void setVersionRange( VersionRange newRange )
241 {
242
243 }
244
245 public void selectVersion( String version )
246 {
247 selectedVersion = version;
248 }
249
250 public void setGroupId( String _groupId )
251 {
252 groupId = _groupId;
253 }
254
255 public void setArtifactId( String _artifactId )
256 {
257 artifactId = _artifactId;
258 }
259
260 public boolean isSnapshot()
261 {
262 return true;
263 }
264
265 public void setResolved( boolean _resolved )
266 {
267 resolved = _resolved;
268 }
269
270 public boolean isResolved()
271 {
272 return true;
273 }
274
275 public void setResolvedVersion( String version )
276 {
277 resolvedVersion = version;
278 }
279
280
281 public void setArtifactHandler( ArtifactHandler handler )
282 {
283
284 }
285
286 public boolean isRelease()
287 {
288 return true;
289 }
290
291 public void setRelease( boolean _release )
292 {
293 release = _release;
294 }
295
296 public List<ArtifactVersion> getAvailableVersions()
297 {
298 return new LinkedList<ArtifactVersion>();
299 }
300
301 public void setAvailableVersions(List<ArtifactVersion> versions)
302 {
303
304 }
305
306 public boolean isOptional()
307 {
308 return true;
309 }
310
311 public void setOptional( boolean _optional )
312 {
313 optional = _optional;
314 }
315
316 public ArtifactVersion getSelectedVersion()
317 throws OverConstrainedVersionException
318 {
319 return null;
320 }
321
322 public boolean isSelectedVersionKnown()
323 throws OverConstrainedVersionException
324 {
325 return true;
326 }
327
328 public int compareTo(Artifact o) {
329 return 0;
330 }
331
332 public ArtifactMetadata getMetadata(Class<?> metadataClass) {
333 return null;
334 }
335
336
337 }