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