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