View Javadoc
1   package org.apache.maven.archiver;
2   
3   import java.io.File;
4   import java.util.Collection;
5   import java.util.List;
6   
7   /*
8    * Licensed to the Apache Software Foundation (ASF) under one
9    * or more contributor license agreements.  See the NOTICE file
10   * distributed with this work for additional information
11   * regarding copyright ownership.  The ASF licenses this file
12   * to you under the Apache License, Version 2.0 (the
13   * "License"); you may not use this file except in compliance
14   * with the License.  You may obtain a copy of the License at
15   *
16   *   http://www.apache.org/licenses/LICENSE-2.0
17   *
18   * Unless required by applicable law or agreed to in writing,
19   * software distributed under the License is distributed on an
20   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21   * KIND, either express or implied.  See the License for the
22   * specific language governing permissions and limitations
23   * under the License.
24   */
25  
26  import org.apache.maven.artifact.Artifact;
27  import org.apache.maven.artifact.handler.ArtifactHandler;
28  import org.apache.maven.artifact.metadata.ArtifactMetadata;
29  import org.apache.maven.artifact.repository.ArtifactRepository;
30  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
31  import org.apache.maven.artifact.versioning.ArtifactVersion;
32  import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
33  import org.apache.maven.artifact.versioning.VersionRange;
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         // TODO
131         return null;
132     }
133 
134     public String getDependencyConflictId()
135     {
136         // TODO
137         return null;
138     }
139 
140     public void addMetadata( ArtifactMetadata artifactMetadata )
141     {
142         // TODO
143     }
144 
145     public ArtifactMetadata getMetadata( Class<?> metadataClass )
146     {
147         // TODO
148         return null;
149     }
150 
151     public Collection<ArtifactMetadata> getMetadataList()
152     {
153         // TODO
154         return null;  //To change body of implemented methods use File | Settings | File Templates.
155     }
156 
157     public void setRepository( ArtifactRepository artifactRepository )
158     {
159         //To change body of implemented methods use File | Settings | File Templates.
160         // TODO
161     }
162 
163     public ArtifactRepository getRepository()
164     {
165         // TODO
166         return null;  //To change body of implemented methods use File | Settings | File Templates.
167     }
168 
169     public void updateVersion( String string, ArtifactRepository artifactRepository )
170     {
171         //To change body of implemented methods use File | Settings | File Templates.
172         // TODO
173     }
174 
175     public String getDownloadUrl()
176     {
177         // TODO
178         return null;  //To change body of implemented methods use File | Settings | File Templates.
179     }
180 
181     public void setDownloadUrl( String string )
182     {
183         //To change body of implemented methods use File | Settings | File Templates.
184         // TODO
185     }
186 
187     public ArtifactFilter getDependencyFilter()
188     {
189         // TODO
190         return null;  //To change body of implemented methods use File | Settings | File Templates.
191     }
192 
193     public void setDependencyFilter( ArtifactFilter artifactFilter )
194     {
195         // TODO
196         //To change body of implemented methods use File | Settings | File Templates.
197     }
198 
199     public ArtifactHandler getArtifactHandler()
200     {
201         return artifactHandler;
202     }
203 
204     public List<String> getDependencyTrail()
205     {
206         // TODO
207         return null;  //To change body of implemented methods use File | Settings | File Templates.
208     }
209 
210     public void setDependencyTrail( List<String> list )
211     {
212         //To change body of implemented methods use File | Settings | File Templates.
213         // TODO
214     }
215 
216     public VersionRange getVersionRange()
217     {
218         return VersionRange.createFromVersion( version );
219     }
220 
221     public void setVersionRange( VersionRange versionRange )
222     {
223         // TODO
224         //To change body of implemented methods use File | Settings | File Templates.
225     }
226 
227     public void selectVersion( String string )
228     {
229         // TODO
230         //To change body of implemented methods use File | Settings | File Templates.
231     }
232 
233     public boolean isSnapshot()
234     {
235         return snapshot;
236     }
237 
238     public void setResolved( boolean b )
239     {
240         // TODO
241         //To change body of implemented methods use File | Settings | File Templates.
242     }
243 
244     public boolean isResolved()
245     {
246         // TODO
247         return false;  //To change body of implemented methods use File | Settings | File Templates.
248     }
249 
250     public void setResolvedVersion( String string )
251     {
252         // TODO
253         //To change body of implemented methods use File | Settings | File Templates.
254     }
255 
256     public void setArtifactHandler( ArtifactHandler artifactHandler )
257     {
258         this.artifactHandler = artifactHandler;
259     }
260 
261     public boolean isRelease()
262     {
263         // TODO
264         return false;  //To change body of implemented methods use File | Settings | File Templates.
265     }
266 
267     public void setRelease( boolean b )
268     {
269         // TODO
270         //To change body of implemented methods use File | Settings | File Templates.
271     }
272 
273     public List<ArtifactVersion> getAvailableVersions()
274     {
275         // TODO
276         return null;  //To change body of implemented methods use File | Settings | File Templates.
277     }
278 
279     public void setAvailableVersions( List<ArtifactVersion> list )
280     {
281         // TODO
282         //To change body of implemented methods use File | Settings | File Templates.
283     }
284 
285     public boolean isOptional()
286     {
287         return false;  //To change body of implemented methods use File | Settings | File Templates.
288         // TODO
289     }
290 
291     public void setOptional( boolean b )
292     {
293         // TODO
294         //To change body of implemented methods use File | Settings | File Templates.
295     }
296 
297     public ArtifactVersion getSelectedVersion()
298         throws OverConstrainedVersionException
299     {
300         // TODO
301         return null;  //To change body of implemented methods use File | Settings | File Templates.
302     }
303 
304     public boolean isSelectedVersionKnown()
305         throws OverConstrainedVersionException
306     {
307         return false;  //To change body of implemented methods use File | Settings | File Templates.
308         // TODO
309     }
310 
311     public void setGroupId( String groupId )
312     {
313         this.groupId = groupId;
314     }
315 
316     public void setArtifactId( String artifactId )
317     {
318         this.artifactId = artifactId;
319     }
320 
321     public void setType( String type )
322     {
323         this.type = type;
324     }
325 
326     public void setClassifier( String classifier )
327     {
328         this.classifier = classifier;
329     }
330 
331     public void setScope( String string )
332     {
333          this.scope = string;
334     }
335 
336     public int compareTo( Artifact o )
337     {
338         // TODO
339         return 0;  //To change body of implemented methods use File | Settings | File Templates.
340     }
341 }