1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.testing.stubs;
20
21 import org.apache.maven.artifact.handler.ArtifactHandler;
22
23
24
25
26
27
28 public class DefaultArtifactHandlerStub implements ArtifactHandler {
29 private String extension;
30
31 private String type;
32
33 private String classifier;
34
35 private String directory;
36
37 private String packaging;
38
39 private boolean includesDependencies;
40
41 private String language;
42
43 private boolean addedToClasspath;
44
45
46
47
48
49 public DefaultArtifactHandlerStub(String t, String c) {
50 type = t;
51 classifier = c;
52 if (t.equals("test-jar")) {
53 extension = "jar";
54 }
55 }
56
57
58
59
60 public DefaultArtifactHandlerStub(String type) {
61 this.type = type;
62 }
63
64
65 @Override
66 public String getExtension() {
67 if (extension == null) {
68 extension = type;
69 }
70 return extension;
71 }
72
73
74
75
76 public String getType() {
77 return type;
78 }
79
80
81 @Override
82 public String getClassifier() {
83 return classifier;
84 }
85
86
87 @Override
88 public String getDirectory() {
89 if (directory == null) {
90 directory = getPackaging() + "s";
91 }
92 return directory;
93 }
94
95
96 @Override
97 public String getPackaging() {
98 if (packaging == null) {
99 packaging = getType();
100 }
101 return packaging;
102 }
103
104
105 @Override
106 public boolean isIncludesDependencies() {
107 return includesDependencies;
108 }
109
110
111 @Override
112 public String getLanguage() {
113 if (language == null) {
114 language = "none";
115 }
116
117 return language;
118 }
119
120
121 @Override
122 public boolean isAddedToClasspath() {
123 return addedToClasspath;
124 }
125
126
127
128
129 public void setAddedToClasspath(boolean theAddedToClasspath) {
130 this.addedToClasspath = theAddedToClasspath;
131 }
132
133
134
135
136 public void setClassifier(String theClassifier) {
137 this.classifier = theClassifier;
138 }
139
140
141
142
143 public void setDirectory(String theDirectory) {
144 this.directory = theDirectory;
145 }
146
147
148
149
150 public void setExtension(String theExtension) {
151 this.extension = theExtension;
152 }
153
154
155
156
157 public void setIncludesDependencies(boolean theIncludesDependencies) {
158 this.includesDependencies = theIncludesDependencies;
159 }
160
161
162
163
164 public void setLanguage(String theLanguage) {
165 this.language = theLanguage;
166 }
167
168
169
170
171 public void setPackaging(String thePackaging) {
172 this.packaging = thePackaging;
173 }
174
175
176
177
178 public void setType(String theType) {
179 this.type = theType;
180 }
181 }