1 package org.apache.maven.plugin.testing.stubs;
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.List;
25
26 import org.apache.maven.artifact.Artifact;
27 import org.apache.maven.artifact.handler.ArtifactHandler;
28 import org.apache.maven.artifact.metadata.ArtifactMetadata;
29 import org.apache.maven.artifact.repository.ArtifactRepository;
30 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
31 import org.apache.maven.artifact.versioning.ArtifactVersion;
32 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
33 import org.apache.maven.artifact.versioning.VersionRange;
34
35
36
37
38
39
40
41 public class ArtifactStub
42 implements Artifact
43 {
44 private String groupId;
45
46 private String artifactId;
47
48 private String version;
49
50 private String scope;
51
52 private String type;
53
54 private String classifier;
55
56 private File file;
57
58 private ArtifactRepository artifactRepository;
59
60
61
62
63
64
65 public int compareTo( Artifact artifact )
66 {
67 return 0;
68 }
69
70
71 public String getGroupId()
72 {
73 return groupId;
74 }
75
76
77 public String getArtifactId()
78 {
79 return artifactId;
80 }
81
82
83 public String getVersion()
84 {
85 return version;
86 }
87
88
89 public void setVersion( String version )
90 {
91 this.version = version;
92 }
93
94
95 public String getScope()
96 {
97 return scope;
98 }
99
100
101 public String getType()
102 {
103 return type;
104 }
105
106
107
108
109
110
111 public void setType( String type )
112 {
113 this.type = type;
114 }
115
116
117 public String getClassifier()
118 {
119 return classifier;
120 }
121
122
123 public boolean hasClassifier()
124 {
125 return classifier != null;
126 }
127
128
129 public File getFile()
130 {
131 return file;
132 }
133
134
135 public void setFile( File file )
136 {
137 this.file = file;
138 }
139
140
141
142
143
144 public String getBaseVersion()
145 {
146 return null;
147 }
148
149
150
151
152
153
154 public void setBaseVersion( String string )
155 {
156
157 }
158
159
160
161
162
163 public String getId()
164 {
165 return null;
166 }
167
168
169
170
171
172 public String getDependencyConflictId()
173 {
174 StringBuffer buffer = new StringBuffer();
175
176 buffer.append( getGroupId() );
177 buffer.append( ":" ).append( getArtifactId() );
178 buffer.append( ":" ).append( getType() );
179 buffer.append( ":" ).append( getClassifier() );
180
181 return buffer.toString();
182 }
183
184
185
186
187
188
189 public void addMetadata( ArtifactMetadata artifactMetadata )
190 {
191
192 }
193
194
195
196
197
198 public Collection<ArtifactMetadata> getMetadataList()
199 {
200 return null;
201 }
202
203
204 public void setRepository( ArtifactRepository artifactRepository )
205 {
206 this.artifactRepository = artifactRepository;
207 }
208
209
210 public ArtifactRepository getRepository()
211 {
212 return artifactRepository;
213 }
214
215
216
217
218
219
220 public void updateVersion( String string, ArtifactRepository artifactRepository )
221 {
222
223 }
224
225
226
227
228
229 public String getDownloadUrl()
230 {
231 return null;
232 }
233
234
235
236
237
238
239 public void setDownloadUrl( String string )
240 {
241
242 }
243
244
245
246
247
248 public ArtifactFilter getDependencyFilter()
249 {
250 return null;
251 }
252
253
254
255
256
257
258 public void setDependencyFilter( ArtifactFilter artifactFilter )
259 {
260
261 }
262
263
264
265
266
267 public ArtifactHandler getArtifactHandler()
268 {
269 return null;
270 }
271
272
273
274
275
276 public List<String> getDependencyTrail()
277 {
278 return null;
279 }
280
281
282
283
284
285
286 public void setDependencyTrail( List<String> list )
287 {
288
289 }
290
291
292 public void setScope( String scope )
293 {
294 this.scope = scope;
295 }
296
297
298
299
300
301 public VersionRange getVersionRange()
302 {
303 return null;
304 }
305
306
307
308
309
310
311 public void setVersionRange( VersionRange versionRange )
312 {
313
314 }
315
316
317
318
319
320
321 public void selectVersion( String string )
322 {
323
324 }
325
326
327 public void setGroupId( String groupId )
328 {
329 this.groupId = groupId;
330 }
331
332
333 public void setArtifactId( String artifactId )
334 {
335 this.artifactId = artifactId;
336 }
337
338
339
340
341
342 public boolean isSnapshot()
343 {
344 return Artifact.VERSION_FILE_PATTERN.matcher( getVersion() ).matches()
345 || getVersion().endsWith( Artifact.SNAPSHOT_VERSION );
346 }
347
348
349
350
351
352
353 public void setResolved( boolean b )
354 {
355
356 }
357
358
359
360
361
362 public boolean isResolved()
363 {
364 return false;
365 }
366
367
368
369
370
371
372 public void setResolvedVersion( String string )
373 {
374
375 }
376
377
378
379
380
381
382 public void setArtifactHandler( ArtifactHandler artifactHandler )
383 {
384
385 }
386
387
388
389
390
391 public boolean isRelease()
392 {
393 return !isSnapshot();
394 }
395
396
397
398
399
400
401 public void setRelease( boolean b )
402 {
403
404 }
405
406
407
408
409
410 public List<ArtifactVersion> getAvailableVersions()
411 {
412 return null;
413 }
414
415
416
417
418
419
420 public void setAvailableVersions( List<ArtifactVersion> list )
421 {
422
423 }
424
425
426
427
428
429 public boolean isOptional()
430 {
431 return false;
432 }
433
434
435
436
437
438
439 public void setOptional( boolean b )
440 {
441
442 }
443
444
445
446
447
448 public ArtifactVersion getSelectedVersion()
449 throws OverConstrainedVersionException
450 {
451 return null;
452 }
453
454
455
456
457
458 public boolean isSelectedVersionKnown()
459 throws OverConstrainedVersionException
460 {
461 return false;
462 }
463
464
465
466
467 public String toString()
468 {
469 StringBuffer sb = new StringBuffer();
470 if ( getGroupId() != null )
471 {
472 sb.append( getGroupId() );
473 sb.append( ":" );
474 }
475 appendArtifactTypeClassifierString( sb );
476 if ( version != null )
477 {
478 sb.append( ":" );
479 sb.append( getVersion() );
480 }
481 if ( scope != null )
482 {
483 sb.append( ":" );
484 sb.append( scope );
485 }
486 return sb.toString();
487 }
488
489 private void appendArtifactTypeClassifierString( StringBuffer sb )
490 {
491 sb.append( getArtifactId() );
492 sb.append( ":" );
493 sb.append( getType() );
494 if ( hasClassifier() )
495 {
496 sb.append( ":" );
497 sb.append( getClassifier() );
498 }
499 }
500
501 public boolean isFromAuthoritativeRepository()
502 {
503 return true;
504 }
505
506 public void setFromAuthoritativeRepository( boolean fromAuthoritativeRepository )
507 {
508
509 }
510 }