View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.archiver;
20  
21  import java.io.File;
22  import java.util.Collection;
23  import java.util.List;
24  
25  import org.apache.maven.artifact.Artifact;
26  import org.apache.maven.artifact.handler.ArtifactHandler;
27  import org.apache.maven.artifact.metadata.ArtifactMetadata;
28  import org.apache.maven.artifact.repository.ArtifactRepository;
29  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
30  import org.apache.maven.artifact.versioning.ArtifactVersion;
31  import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
32  import org.apache.maven.artifact.versioning.VersionRange;
33  
34  /*
35   * TODO move to maven-artifact-test
36   */
37  @SuppressWarnings("deprecation")
38  public class MockArtifact implements Artifact {
39      private String groupId;
40  
41      private String artifactId;
42  
43      private String version;
44  
45      private File file;
46  
47      private String scope;
48  
49      private String type;
50  
51      private String classifier;
52  
53      private String baseVersion;
54  
55      private ArtifactHandler artifactHandler;
56  
57      private boolean snapshot;
58  
59      public String getGroupId() {
60          return groupId;
61      }
62  
63      public String getArtifactId() {
64          return artifactId;
65      }
66  
67      public String getVersion() {
68          return version;
69      }
70  
71      public void setVersion(String string) {
72          this.version = string;
73      }
74  
75      public void setSnapshotVersion(String snapshotVersion, String baseVersion) {
76          snapshot = true;
77          version = snapshotVersion;
78          this.baseVersion = baseVersion;
79      }
80  
81      public String getScope() {
82          return scope;
83      }
84  
85      public String getType() {
86          return type;
87      }
88  
89      public String getClassifier() {
90          return classifier;
91      }
92  
93      public boolean hasClassifier() {
94          return classifier != null;
95      }
96  
97      public File getFile() {
98          return file;
99      }
100 
101     public void setFile(File file) {
102         this.file = file;
103     }
104 
105     public String getBaseVersion() {
106         return baseVersion;
107     }
108 
109     public void setBaseVersion(String string) {
110         this.baseVersion = string;
111     }
112 
113     public String getId() {
114         return null;
115     }
116 
117     public String getDependencyConflictId() {
118         return null;
119     }
120 
121     public void addMetadata(ArtifactMetadata artifactMetadata) {}
122 
123     public ArtifactMetadata getMetadata(Class<?> metadataClass) {
124         return null;
125     }
126 
127     public Collection<ArtifactMetadata> getMetadataList() {
128         return null; // To change body of implemented methods use File | Settings | File Templates.
129     }
130 
131     public void setRepository(ArtifactRepository artifactRepository) {
132         // To change body of implemented methods use File | Settings | File Templates.
133     }
134 
135     public ArtifactRepository getRepository() {
136         return null; // To change body of implemented methods use File | Settings | File Templates.
137     }
138 
139     public void updateVersion(String string, ArtifactRepository artifactRepository) {
140         // To change body of implemented methods use File | Settings | File Templates.
141     }
142 
143     public String getDownloadUrl() {
144         return null; // To change body of implemented methods use File | Settings | File Templates.
145     }
146 
147     public void setDownloadUrl(String string) {
148         // To change body of implemented methods use File | Settings | File Templates.
149     }
150 
151     public ArtifactFilter getDependencyFilter() {
152         return null; // To change body of implemented methods use File | Settings | File Templates.
153     }
154 
155     public void setDependencyFilter(ArtifactFilter artifactFilter) {
156         // To change body of implemented methods use File | Settings | File Templates.
157     }
158 
159     public ArtifactHandler getArtifactHandler() {
160         return artifactHandler;
161     }
162 
163     public List<String> getDependencyTrail() {
164         return null; // To change body of implemented methods use File | Settings | File Templates.
165     }
166 
167     public void setDependencyTrail(List<String> list) {
168         // To change body of implemented methods use File | Settings | File Templates.
169     }
170 
171     public VersionRange getVersionRange() {
172         return VersionRange.createFromVersion(version);
173     }
174 
175     public void setVersionRange(VersionRange versionRange) {
176         // To change body of implemented methods use File | Settings | File Templates.
177     }
178 
179     public void selectVersion(String string) {
180         // To change body of implemented methods use File | Settings | File Templates.
181     }
182 
183     public boolean isSnapshot() {
184         return snapshot;
185     }
186 
187     public void setResolved(boolean b) {
188         // To change body of implemented methods use File | Settings | File Templates.
189     }
190 
191     public boolean isResolved() {
192         return false; // To change body of implemented methods use File | Settings | File Templates.
193     }
194 
195     public void setResolvedVersion(String string) {
196         // To change body of implemented methods use File | Settings | File Templates.
197     }
198 
199     public void setArtifactHandler(ArtifactHandler artifactHandler) {
200         this.artifactHandler = artifactHandler;
201     }
202 
203     public boolean isRelease() {
204         return false; // To change body of implemented methods use File | Settings | File Templates.
205     }
206 
207     public void setRelease(boolean b) {
208         // To change body of implemented methods use File | Settings | File Templates.
209     }
210 
211     public List<ArtifactVersion> getAvailableVersions() {
212         return null; // To change body of implemented methods use File | Settings | File Templates.
213     }
214 
215     public void setAvailableVersions(List<ArtifactVersion> list) {
216         // To change body of implemented methods use File | Settings | File Templates.
217     }
218 
219     public boolean isOptional() {
220         return false; // To change body of implemented methods use File | Settings | File Templates.
221     }
222 
223     public void setOptional(boolean b) {
224         // To change body of implemented methods use File | Settings | File Templates.
225     }
226 
227     public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException {
228         return VersionRange.createFromVersion(version).getSelectedVersion(this);
229     }
230 
231     public boolean isSelectedVersionKnown() throws OverConstrainedVersionException {
232         return VersionRange.createFromVersion(version).isSelectedVersionKnown(this);
233     }
234 
235     public void setGroupId(String groupId) {
236         this.groupId = groupId;
237     }
238 
239     public void setArtifactId(String artifactId) {
240         this.artifactId = artifactId;
241     }
242 
243     public void setType(String type) {
244         this.type = type;
245     }
246 
247     public void setClassifier(String classifier) {
248         this.classifier = classifier;
249     }
250 
251     public void setScope(String string) {
252         this.scope = string;
253     }
254 
255     public int compareTo(Artifact o) {
256         return 0; // To change body of implemented methods use File | Settings | File Templates.
257     }
258 }