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  class MockArtifact
39      implements Artifact
40  {
41      private String groupId;
42  
43      private String artifactId;
44  
45      private String version;
46  
47      private File file;
48  
49      private String scope;
50  
51      private String type;
52  
53      private String classifier;
54  
55      private String baseVersion;
56  
57      private ArtifactHandler artifactHandler;
58  
59      private boolean snapshot;
60  
61      public String getGroupId()
62      {
63          return groupId;
64      }
65  
66      public String getArtifactId()
67      {
68          return artifactId;
69      }
70  
71      public String getVersion()
72      {
73          return version;
74      }
75  
76      public void setVersion( String string )
77      {
78          this.version = string;
79      }
80  
81      public void setSnapshotVersion( String snapshotVersion, String baseVersion )
82      {
83          snapshot = true;
84          version = snapshotVersion;
85          this.baseVersion = baseVersion;
86      }
87  
88      public String getScope()
89      {
90          return scope;
91      }
92  
93      public String getType()
94      {
95          return type;
96      }
97  
98      public String getClassifier()
99      {
100         return classifier;
101     }
102 
103     public boolean hasClassifier()
104     {
105         return classifier != null;
106     }
107 
108     public File getFile()
109     {
110         return file;
111     }
112 
113     public void setFile( File file )
114     {
115         this.file = file;
116     }
117 
118     public String getBaseVersion()
119     {
120         return baseVersion;
121     }
122 
123     public void setBaseVersion( String string )
124     {
125         this.baseVersion = string;
126     }
127 
128     public String getId()
129     {
130         return null;
131     }
132 
133     public String getDependencyConflictId()
134     {
135         return null;
136     }
137 
138     public void addMetadata( ArtifactMetadata artifactMetadata )
139     {
140     }
141 
142     public ArtifactMetadata getMetadata( Class<?> metadataClass )
143     {
144         return null;
145     }
146 
147     public Collection<ArtifactMetadata> getMetadataList()
148     {
149         return null;  //To change body of implemented methods use File | Settings | File Templates.
150     }
151 
152     public void setRepository( ArtifactRepository artifactRepository )
153     {
154         //To change body of implemented methods use File | Settings | File Templates.
155     }
156 
157     public ArtifactRepository getRepository()
158     {
159         return null;  //To change body of implemented methods use File | Settings | File Templates.
160     }
161 
162     public void updateVersion( String string, ArtifactRepository artifactRepository )
163     {
164         //To change body of implemented methods use File | Settings | File Templates.
165     }
166 
167     public String getDownloadUrl()
168     {
169         return null;  //To change body of implemented methods use File | Settings | File Templates.
170     }
171 
172     public void setDownloadUrl( String string )
173     {
174         //To change body of implemented methods use File | Settings | File Templates.
175     }
176 
177     public ArtifactFilter getDependencyFilter()
178     {
179         return null;  //To change body of implemented methods use File | Settings | File Templates.
180     }
181 
182     public void setDependencyFilter( ArtifactFilter artifactFilter )
183     {
184         //To change body of implemented methods use File | Settings | File Templates.
185     }
186 
187     public ArtifactHandler getArtifactHandler()
188     {
189         return artifactHandler;
190     }
191 
192     public List<String> getDependencyTrail()
193     {
194         return null;  //To change body of implemented methods use File | Settings | File Templates.
195     }
196 
197     public void setDependencyTrail( List<String> list )
198     {
199         //To change body of implemented methods use File | Settings | File Templates.
200     }
201 
202     public VersionRange getVersionRange()
203     {
204         return VersionRange.createFromVersion( version );
205     }
206 
207     public void setVersionRange( VersionRange versionRange )
208     {
209         //To change body of implemented methods use File | Settings | File Templates.
210     }
211 
212     public void selectVersion( String string )
213     {
214         //To change body of implemented methods use File | Settings | File Templates.
215     }
216 
217     public boolean isSnapshot()
218     {
219         return snapshot;
220     }
221 
222     public void setResolved( boolean b )
223     {
224         //To change body of implemented methods use File | Settings | File Templates.
225     }
226 
227     public boolean isResolved()
228     {
229         return false;  //To change body of implemented methods use File | Settings | File Templates.
230     }
231 
232     public void setResolvedVersion( String string )
233     {
234         //To change body of implemented methods use File | Settings | File Templates.
235     }
236 
237     public void setArtifactHandler( ArtifactHandler artifactHandler )
238     {
239         this.artifactHandler = artifactHandler;
240     }
241 
242     public boolean isRelease()
243     {
244         return false;  //To change body of implemented methods use File | Settings | File Templates.
245     }
246 
247     public void setRelease( boolean b )
248     {
249         //To change body of implemented methods use File | Settings | File Templates.
250     }
251 
252     public List<ArtifactVersion> getAvailableVersions()
253     {
254         return null;  //To change body of implemented methods use File | Settings | File Templates.
255     }
256 
257     public void setAvailableVersions( List<ArtifactVersion> list )
258     {
259         //To change body of implemented methods use File | Settings | File Templates.
260     }
261 
262     public boolean isOptional()
263     {
264         return false;  //To change body of implemented methods use File | Settings | File Templates.
265     }
266 
267     public void setOptional( boolean b )
268     {
269         //To change body of implemented methods use File | Settings | File Templates.
270     }
271 
272     public ArtifactVersion getSelectedVersion()
273         throws OverConstrainedVersionException
274     {
275         return VersionRange.createFromVersion( version ).getSelectedVersion( this );
276     }
277 
278     public boolean isSelectedVersionKnown()
279         throws OverConstrainedVersionException
280     {
281         return VersionRange.createFromVersion( version ).isSelectedVersionKnown( this );
282     }
283 
284     public void setGroupId( String groupId )
285     {
286         this.groupId = groupId;
287     }
288 
289     public void setArtifactId( String artifactId )
290     {
291         this.artifactId = artifactId;
292     }
293 
294     public void setType( String type )
295     {
296         this.type = type;
297     }
298 
299     public void setClassifier( String classifier )
300     {
301         this.classifier = classifier;
302     }
303 
304     public void setScope( String string )
305     {
306          this.scope = string;
307     }
308 
309     public int compareTo( Artifact o )
310     {
311         return 0;  //To change body of implemented methods use File | Settings | File Templates.
312     }
313 }