1 package org.apache.maven.plugin.ear.stub;
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.artifact.handler.ArtifactHandler;
24 import org.apache.maven.artifact.metadata.ArtifactMetadata;
25 import org.apache.maven.artifact.repository.ArtifactRepository;
26 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
27 import org.apache.maven.artifact.versioning.ArtifactVersion;
28 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
29 import org.apache.maven.artifact.versioning.VersionRange;
30
31 import java.io.File;
32 import java.util.Collection;
33 import java.util.List;
34
35
36
37
38
39
40
41 public class ArtifactTestStub
42 implements Artifact
43
44 {
45 public static final String DEFAULT_VERSION = "1.0";
46
47 private final String groupId;
48
49 private final String artifactId;
50
51 private final String type;
52
53 private final String classifier;
54
55 private String version;
56
57 public ArtifactTestStub( String groupId, String artifactId, String type, String classifier, String version )
58 {
59 this.groupId = groupId;
60 this.artifactId = artifactId;
61 this.type = type;
62 this.classifier = classifier;
63 this.version = version;
64 }
65
66 public ArtifactTestStub( String groupId, String artifactId, String type, String classifier )
67 {
68 this( groupId, artifactId, type, classifier, DEFAULT_VERSION );
69 }
70
71 public String getGroupId()
72 {
73 return groupId;
74 }
75
76 public String getArtifactId()
77 {
78 return artifactId;
79 }
80
81 public String getVersion()
82 {
83 return version;
84 }
85
86 public void setVersion( String version )
87 {
88 this.version = version;
89 }
90
91 public String getScope()
92 {
93 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
94 }
95
96 public String getType()
97 {
98 return type;
99 }
100
101 public String getClassifier()
102 {
103 return classifier;
104 }
105
106 public boolean hasClassifier()
107 {
108 return classifier != null;
109 }
110
111 public File getFile()
112 {
113 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
114 }
115
116 public void setFile( File file )
117 {
118 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
119 }
120
121 public String getBaseVersion()
122 {
123 return version;
124 }
125
126 public void setBaseVersion( String string )
127 {
128 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
129 }
130
131 public String getId()
132 {
133 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
134 }
135
136 public String getDependencyConflictId()
137 {
138 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
139 }
140
141 public void addMetadata( ArtifactMetadata artifactMetadata )
142 {
143 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
144 }
145
146 public Collection getMetadataList()
147 {
148 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
149 }
150
151 public void setRepository( ArtifactRepository artifactRepository )
152 {
153 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
154 }
155
156 public ArtifactRepository getRepository()
157 {
158 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
159 }
160
161 public void updateVersion( String string, ArtifactRepository artifactRepository )
162 {
163 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
164 }
165
166 public String getDownloadUrl()
167 {
168 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
169 }
170
171 public void setDownloadUrl( String string )
172 {
173 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
174 }
175
176 public ArtifactFilter getDependencyFilter()
177 {
178 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
179 }
180
181 public void setDependencyFilter( ArtifactFilter artifactFilter )
182 {
183 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
184 }
185
186 public ArtifactHandler getArtifactHandler()
187 {
188 return new ArtifactHandlerTestStub( "jar" );
189 }
190
191 public List getDependencyTrail()
192 {
193 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
194 }
195
196 public void setDependencyTrail( List list )
197 {
198 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
199 }
200
201 public void setScope( String string )
202 {
203 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
204 }
205
206 public VersionRange getVersionRange()
207 {
208 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
209 }
210
211 public void setVersionRange( VersionRange versionRange )
212 {
213 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
214 }
215
216 public void selectVersion( String string )
217 {
218 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
219 }
220
221 public void setGroupId( String string )
222 {
223 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
224 }
225
226 public void setArtifactId( String string )
227 {
228 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
229 }
230
231 public boolean isSnapshot()
232 {
233 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
234 }
235
236 public void setResolved( boolean b )
237 {
238 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
239 }
240
241 public boolean isResolved()
242 {
243 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
244 }
245
246 public void setResolvedVersion( String string )
247 {
248 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
249 }
250
251 public void setArtifactHandler( ArtifactHandler artifactHandler )
252 {
253 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
254 }
255
256 public boolean isRelease()
257 {
258 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
259 }
260
261 public void setRelease( boolean b )
262 {
263 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
264 }
265
266 public List getAvailableVersions()
267 {
268 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
269 }
270
271 public void setAvailableVersions( List list )
272 {
273 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
274 }
275
276 public boolean isOptional()
277 {
278 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
279 }
280
281 public void setOptional( boolean b )
282 {
283 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
284 }
285
286 public ArtifactVersion getSelectedVersion()
287 throws OverConstrainedVersionException
288 {
289 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
290 }
291
292 public boolean isSelectedVersionKnown()
293 throws OverConstrainedVersionException
294 {
295 throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
296 }
297
298 public boolean equals( Object o )
299 {
300 if ( this == o )
301 {
302 return true;
303 }
304 if ( o == null || getClass() != o.getClass() )
305 {
306 return false;
307 }
308
309 ArtifactTestStub that = (ArtifactTestStub) o;
310
311 if ( artifactId != null ? !artifactId.equals( that.artifactId ) : that.artifactId != null )
312 {
313 return false;
314 }
315 if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
316 {
317 return false;
318 }
319 if ( groupId != null ? !groupId.equals( that.groupId ) : that.groupId != null )
320 {
321 return false;
322 }
323 if ( type != null ? !type.equals( that.type ) : that.type != null )
324 {
325 return false;
326 }
327
328 return true;
329 }
330
331 public int hashCode()
332 {
333 int result;
334 result = ( groupId != null ? groupId.hashCode() : 0 );
335 result = 31 * result + ( artifactId != null ? artifactId.hashCode() : 0 );
336 result = 31 * result + ( type != null ? type.hashCode() : 0 );
337 result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
338 return result;
339 }
340
341 public int compareTo( Artifact o )
342 {
343 if ( this.equals( o ) )
344 {
345 return 0;
346 }
347 else
348 {
349 return 1;
350 }
351 }
352
353 public ArtifactMetadata getMetadata( Class<?> metadataClass )
354 {
355
356 return null;
357 }
358 }