1 | |
package org.apache.maven.scm.manager; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.scm.ScmBranch; |
23 | |
import org.apache.maven.scm.ScmException; |
24 | |
import org.apache.maven.scm.ScmFileSet; |
25 | |
import org.apache.maven.scm.ScmVersion; |
26 | |
import org.apache.maven.scm.command.add.AddScmResult; |
27 | |
import org.apache.maven.scm.command.blame.BlameScmResult; |
28 | |
import org.apache.maven.scm.command.branch.BranchScmResult; |
29 | |
import org.apache.maven.scm.command.changelog.ChangeLogScmResult; |
30 | |
import org.apache.maven.scm.command.checkin.CheckInScmResult; |
31 | |
import org.apache.maven.scm.command.checkout.CheckOutScmResult; |
32 | |
import org.apache.maven.scm.command.diff.DiffScmResult; |
33 | |
import org.apache.maven.scm.command.edit.EditScmResult; |
34 | |
import org.apache.maven.scm.command.export.ExportScmResult; |
35 | |
import org.apache.maven.scm.command.list.ListScmResult; |
36 | |
import org.apache.maven.scm.command.mkdir.MkdirScmResult; |
37 | |
import org.apache.maven.scm.command.remove.RemoveScmResult; |
38 | |
import org.apache.maven.scm.command.status.StatusScmResult; |
39 | |
import org.apache.maven.scm.command.tag.TagScmResult; |
40 | |
import org.apache.maven.scm.command.unedit.UnEditScmResult; |
41 | |
import org.apache.maven.scm.command.update.UpdateScmResult; |
42 | |
import org.apache.maven.scm.provider.ScmProvider; |
43 | |
import org.apache.maven.scm.provider.ScmProviderStub; |
44 | |
import org.apache.maven.scm.repository.ScmRepository; |
45 | |
import org.apache.maven.scm.repository.ScmRepositoryException; |
46 | |
import org.apache.maven.scm.repository.ScmRepositoryStub; |
47 | |
import org.apache.maven.scm.repository.UnknownRepositoryStructure; |
48 | |
|
49 | |
import java.io.File; |
50 | |
import java.util.ArrayList; |
51 | |
import java.util.Date; |
52 | |
import java.util.List; |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
public class ScmManagerStub |
63 | |
implements ScmManager |
64 | |
{ |
65 | |
|
66 | |
private ScmRepository scmRepository; |
67 | |
|
68 | |
private ScmProvider scmProvider; |
69 | |
|
70 | |
private List<String> messages; |
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
public ScmManagerStub() |
76 | 6 | { |
77 | 6 | setScmRepository( new ScmRepositoryStub() ); |
78 | 6 | setScmProvider( new ScmProviderStub() ); |
79 | 6 | setMessages( new ArrayList<String>( 0 ) ); |
80 | 6 | } |
81 | |
|
82 | |
public void setScmProvider( ScmProvider scmProvider ) |
83 | |
{ |
84 | 12 | this.scmProvider = scmProvider; |
85 | 12 | } |
86 | |
|
87 | |
public ScmProvider getScmProvider() |
88 | |
{ |
89 | 3 | return scmProvider; |
90 | |
} |
91 | |
|
92 | |
|
93 | |
public void setScmProvider( String providerType, ScmProvider provider ) |
94 | |
{ |
95 | 0 | setScmProvider( provider ); |
96 | 0 | } |
97 | |
|
98 | |
|
99 | |
public void setScmProviderImplementation( String providerType, String providerImplementation ) |
100 | |
{ |
101 | |
|
102 | 0 | } |
103 | |
|
104 | |
public void setScmRepository( ScmRepository scmRepository ) |
105 | |
{ |
106 | 12 | this.scmRepository = scmRepository; |
107 | 12 | } |
108 | |
|
109 | |
public ScmRepository getScmRepository() |
110 | |
{ |
111 | 2 | return scmRepository; |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
public void setMessages( List<String> messages ) |
120 | |
{ |
121 | 12 | this.messages = messages; |
122 | 12 | } |
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
|
129 | |
public List<String> getMessages() |
130 | |
{ |
131 | 1 | return messages; |
132 | |
} |
133 | |
|
134 | |
|
135 | |
public ScmRepository makeScmRepository( String scmUrl ) |
136 | |
throws ScmRepositoryException, NoSuchScmProviderException |
137 | |
{ |
138 | 1 | return getScmRepository(); |
139 | |
} |
140 | |
|
141 | |
|
142 | |
public ScmRepository makeProviderScmRepository( String providerType, File path ) |
143 | |
throws ScmRepositoryException, UnknownRepositoryStructure, NoSuchScmProviderException |
144 | |
{ |
145 | 1 | return getScmRepository(); |
146 | |
} |
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
public List<String> validateScmRepository( String scmUrl ) |
155 | |
{ |
156 | 1 | return getMessages(); |
157 | |
} |
158 | |
|
159 | |
|
160 | |
public ScmProvider getProviderByUrl( String scmUrl ) |
161 | |
throws ScmRepositoryException, NoSuchScmProviderException |
162 | |
{ |
163 | 1 | return getScmProvider(); |
164 | |
} |
165 | |
|
166 | |
|
167 | |
public ScmProvider getProviderByType( String providerType ) |
168 | |
throws NoSuchScmProviderException |
169 | |
{ |
170 | 1 | return getScmProvider(); |
171 | |
} |
172 | |
|
173 | |
|
174 | |
public ScmProvider getProviderByRepository( ScmRepository repository ) |
175 | |
throws NoSuchScmProviderException |
176 | |
{ |
177 | 1 | return getScmProvider(); |
178 | |
} |
179 | |
|
180 | |
|
181 | |
public AddScmResult add( ScmRepository repository, ScmFileSet fileSet ) |
182 | |
throws ScmException |
183 | |
{ |
184 | 0 | return this.getProviderByRepository( repository ).add( repository, fileSet ); |
185 | |
} |
186 | |
|
187 | |
|
188 | |
public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, String message ) |
189 | |
throws ScmException |
190 | |
{ |
191 | 0 | return this.getProviderByRepository( repository ).add( repository, fileSet, message ); |
192 | |
} |
193 | |
|
194 | |
|
195 | |
@SuppressWarnings( "deprecation" ) |
196 | |
public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName ) |
197 | |
throws ScmException |
198 | |
{ |
199 | 0 | return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName ); |
200 | |
} |
201 | |
|
202 | |
|
203 | |
@SuppressWarnings( "deprecation" ) |
204 | |
public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName, String message ) |
205 | |
throws ScmException |
206 | |
{ |
207 | 0 | return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName, message ); |
208 | |
} |
209 | |
|
210 | |
|
211 | |
public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, |
212 | |
int numDays, ScmBranch branch ) |
213 | |
throws ScmException |
214 | |
{ |
215 | 0 | return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startDate, endDate, numDays, |
216 | |
branch ); |
217 | |
} |
218 | |
|
219 | |
|
220 | |
public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, |
221 | |
int numDays, ScmBranch branch, String datePattern ) |
222 | |
throws ScmException |
223 | |
{ |
224 | 0 | return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startDate, endDate, numDays, |
225 | |
branch, datePattern ); |
226 | |
} |
227 | |
|
228 | |
|
229 | |
public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion, |
230 | |
ScmVersion endVersion ) |
231 | |
throws ScmException |
232 | |
{ |
233 | 0 | return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startVersion, endVersion ); |
234 | |
} |
235 | |
|
236 | |
|
237 | |
public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startRevision, |
238 | |
ScmVersion endRevision, String datePattern ) |
239 | |
throws ScmException |
240 | |
{ |
241 | 0 | return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startRevision, endRevision, |
242 | |
datePattern ); |
243 | |
} |
244 | |
|
245 | |
|
246 | |
public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, String message ) |
247 | |
throws ScmException |
248 | |
{ |
249 | 0 | return this.getProviderByRepository( repository ).checkIn( repository, fileSet, message ); |
250 | |
} |
251 | |
|
252 | |
|
253 | |
public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message ) |
254 | |
throws ScmException |
255 | |
{ |
256 | 0 | return this.getProviderByRepository( repository ).checkIn( repository, fileSet, revision, message ); |
257 | |
} |
258 | |
|
259 | |
|
260 | |
public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet ) |
261 | |
throws ScmException |
262 | |
{ |
263 | 0 | return this.getProviderByRepository( repository ).checkOut( repository, fileSet ); |
264 | |
} |
265 | |
|
266 | |
|
267 | |
public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version ) |
268 | |
throws ScmException |
269 | |
{ |
270 | 0 | return this.getProviderByRepository( repository ).checkOut( repository, fileSet, version ); |
271 | |
} |
272 | |
|
273 | |
|
274 | |
public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, boolean recursive ) |
275 | |
throws ScmException |
276 | |
{ |
277 | 0 | return this.getProviderByRepository( repository ).checkOut( repository, fileSet, recursive ); |
278 | |
} |
279 | |
|
280 | |
|
281 | |
public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, |
282 | |
boolean recursive ) |
283 | |
throws ScmException |
284 | |
{ |
285 | 0 | return this.getProviderByRepository( repository ).checkOut( repository, fileSet, version, recursive ); |
286 | |
} |
287 | |
|
288 | |
|
289 | |
public DiffScmResult diff( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion, |
290 | |
ScmVersion endVersion ) |
291 | |
throws ScmException |
292 | |
{ |
293 | 0 | return this.getProviderByRepository( repository ).diff( repository, fileSet, startVersion, endVersion ); |
294 | |
} |
295 | |
|
296 | |
|
297 | |
public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet ) |
298 | |
throws ScmException |
299 | |
{ |
300 | 0 | return this.getProviderByRepository( repository ).edit( repository, fileSet ); |
301 | |
} |
302 | |
|
303 | |
|
304 | |
public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet ) |
305 | |
throws ScmException |
306 | |
{ |
307 | 0 | return this.getProviderByRepository( repository ).export( repository, fileSet ); |
308 | |
} |
309 | |
|
310 | |
|
311 | |
public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version ) |
312 | |
throws ScmException |
313 | |
{ |
314 | 0 | return this.getProviderByRepository( repository ).export( repository, fileSet, version ); |
315 | |
} |
316 | |
|
317 | |
|
318 | |
public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String outputDirectory ) |
319 | |
throws ScmException |
320 | |
{ |
321 | 0 | return this.export( repository, fileSet, outputDirectory ); |
322 | |
} |
323 | |
|
324 | |
|
325 | |
public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, |
326 | |
String outputDirectory ) |
327 | |
throws ScmException |
328 | |
{ |
329 | 0 | return this.getProviderByRepository( repository ).export( repository, fileSet, version, outputDirectory ); |
330 | |
} |
331 | |
|
332 | |
|
333 | |
public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version ) |
334 | |
throws ScmException |
335 | |
{ |
336 | 0 | return this.getProviderByRepository( repository ).list( repository, fileSet, recursive, version ); |
337 | |
} |
338 | |
|
339 | |
|
340 | |
public RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, String message ) |
341 | |
throws ScmException |
342 | |
{ |
343 | 0 | return this.getProviderByRepository( repository ).remove( repository, fileSet, message ); |
344 | |
} |
345 | |
|
346 | |
|
347 | |
public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet ) |
348 | |
throws ScmException |
349 | |
{ |
350 | 0 | return this.getProviderByRepository( repository ).status( repository, fileSet ); |
351 | |
} |
352 | |
|
353 | |
|
354 | |
@SuppressWarnings( "deprecation" ) |
355 | |
public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName ) |
356 | |
throws ScmException |
357 | |
{ |
358 | 0 | return this.getProviderByRepository( repository ).tag( repository, fileSet, tagName ); |
359 | |
} |
360 | |
|
361 | |
|
362 | |
@SuppressWarnings( "deprecation" ) |
363 | |
public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName, String message ) |
364 | |
throws ScmException |
365 | |
{ |
366 | 0 | return this.getProviderByRepository( repository ).tag( repository, fileSet, tagName, message ); |
367 | |
} |
368 | |
|
369 | |
|
370 | |
public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet ) |
371 | |
throws ScmException |
372 | |
{ |
373 | 0 | return this.getProviderByRepository( repository ).unedit( repository, fileSet ); |
374 | |
} |
375 | |
|
376 | |
|
377 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet ) |
378 | |
throws ScmException |
379 | |
{ |
380 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet ); |
381 | |
} |
382 | |
|
383 | |
|
384 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version ) |
385 | |
throws ScmException |
386 | |
{ |
387 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, version ); |
388 | |
} |
389 | |
|
390 | |
|
391 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, boolean runChangelog ) |
392 | |
throws ScmException |
393 | |
{ |
394 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, runChangelog ); |
395 | |
} |
396 | |
|
397 | |
|
398 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, |
399 | |
boolean runChangelog ) |
400 | |
throws ScmException |
401 | |
{ |
402 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, version, runChangelog ); |
403 | |
} |
404 | |
|
405 | |
|
406 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String datePattern ) |
407 | |
throws ScmException |
408 | |
{ |
409 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, datePattern ); |
410 | |
} |
411 | |
|
412 | |
|
413 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, |
414 | |
String datePattern ) |
415 | |
throws ScmException |
416 | |
{ |
417 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, version, datePattern ); |
418 | |
} |
419 | |
|
420 | |
|
421 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, Date lastUpdate ) |
422 | |
throws ScmException |
423 | |
{ |
424 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, lastUpdate ); |
425 | |
} |
426 | |
|
427 | |
|
428 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate ) |
429 | |
throws ScmException |
430 | |
{ |
431 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, version, lastUpdate ); |
432 | |
} |
433 | |
|
434 | |
|
435 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, Date lastUpdate, String datePattern ) |
436 | |
throws ScmException |
437 | |
{ |
438 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, lastUpdate, |
439 | |
datePattern ); |
440 | |
} |
441 | |
|
442 | |
|
443 | |
public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate, |
444 | |
String datePattern ) |
445 | |
throws ScmException |
446 | |
{ |
447 | 0 | return this.getProviderByRepository( repository ).update( repository, fileSet, version, lastUpdate, |
448 | |
datePattern ); |
449 | |
} |
450 | |
|
451 | |
|
452 | |
public BlameScmResult blame( ScmRepository repository, ScmFileSet fileSet, String filename ) |
453 | |
throws ScmException |
454 | |
{ |
455 | 0 | return this.getProviderByRepository( repository ).blame( repository, fileSet, filename ); |
456 | |
} |
457 | |
|
458 | |
|
459 | |
public MkdirScmResult mkdir( ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal ) |
460 | |
throws ScmException |
461 | |
{ |
462 | 0 | return this.getProviderByRepository( repository ).mkdir( repository, fileSet, message, createInLocal ); |
463 | |
} |
464 | |
} |