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.plugins.pmd.stubs;
20  
21  import org.apache.maven.artifact.handler.ArtifactHandler;
22  import org.apache.maven.artifact.versioning.VersionRange;
23  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
24  
25  /**
26   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
27   * @version $Id$
28   */
29  public class PmdPluginArtifactStub extends ArtifactStub {
30      private String groupId;
31  
32      private String artifactId;
33  
34      private String version;
35  
36      private String packaging;
37  
38      private VersionRange versionRange;
39  
40      private ArtifactHandler handler;
41  
42      public PmdPluginArtifactStub(String groupId, String artifactId, String version, String packaging) {
43          this.groupId = groupId;
44          this.artifactId = artifactId;
45          this.version = version;
46          this.packaging = packaging;
47          versionRange = VersionRange.createFromVersion(version);
48      }
49  
50      /** {@inheritDoc} */
51      @Override
52      public void setGroupId(String groupId) {
53          this.groupId = groupId;
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      public String getGroupId() {
59          return groupId;
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      public void setArtifactId(String artifactId) {
65          this.artifactId = artifactId;
66      }
67  
68      /** {@inheritDoc} */
69      @Override
70      public String getArtifactId() {
71          return artifactId;
72      }
73  
74      /** {@inheritDoc} */
75      @Override
76      public void setVersion(String version) {
77          this.version = version;
78      }
79  
80      /** {@inheritDoc} */
81      @Override
82      public String getVersion() {
83          return version;
84      }
85  
86      public void setPackaging(String packaging) {
87          this.packaging = packaging;
88      }
89  
90      public String getPackaging() {
91          return packaging;
92      }
93  
94      /** {@inheritDoc} */
95      @Override
96      public VersionRange getVersionRange() {
97          return versionRange;
98      }
99  
100     /** {@inheritDoc} */
101     @Override
102     public void setVersionRange(VersionRange versionRange) {
103         this.versionRange = versionRange;
104     }
105 
106     /** {@inheritDoc} */
107     @Override
108     public ArtifactHandler getArtifactHandler() {
109         return handler;
110     }
111 
112     /** {@inheritDoc} */
113     @Override
114     public void setArtifactHandler(ArtifactHandler handler) {
115         this.handler = handler;
116     }
117 }