1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.scm.provider;
20
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.Date;
25 import java.util.List;
26
27 import org.apache.maven.scm.CommandParameters;
28 import org.apache.maven.scm.ScmBranch;
29 import org.apache.maven.scm.ScmBranchParameters;
30 import org.apache.maven.scm.ScmException;
31 import org.apache.maven.scm.ScmFile;
32 import org.apache.maven.scm.ScmFileSet;
33 import org.apache.maven.scm.ScmTagParameters;
34 import org.apache.maven.scm.ScmVersion;
35 import org.apache.maven.scm.command.add.AddScmResult;
36 import org.apache.maven.scm.command.blame.BlameScmRequest;
37 import org.apache.maven.scm.command.blame.BlameScmResult;
38 import org.apache.maven.scm.command.branch.BranchScmResult;
39 import org.apache.maven.scm.command.changelog.ChangeLogScmRequest;
40 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
41 import org.apache.maven.scm.command.checkin.CheckInScmResult;
42 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
43 import org.apache.maven.scm.command.diff.DiffScmResult;
44 import org.apache.maven.scm.command.edit.EditScmResult;
45 import org.apache.maven.scm.command.export.ExportScmResult;
46 import org.apache.maven.scm.command.info.InfoScmResult;
47 import org.apache.maven.scm.command.list.ListScmResult;
48 import org.apache.maven.scm.command.mkdir.MkdirScmResult;
49 import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
50 import org.apache.maven.scm.command.remove.RemoveScmResult;
51 import org.apache.maven.scm.command.status.StatusScmResult;
52 import org.apache.maven.scm.command.tag.TagScmResult;
53 import org.apache.maven.scm.command.unedit.UnEditScmResult;
54 import org.apache.maven.scm.command.untag.UntagScmResult;
55 import org.apache.maven.scm.command.update.UpdateScmResult;
56 import org.apache.maven.scm.repository.ScmRepository;
57 import org.apache.maven.scm.repository.ScmRepositoryException;
58 import org.apache.maven.scm.repository.UnknownRepositoryStructure;
59
60
61
62
63
64
65
66
67
68
69 public class ScmProviderStub implements ScmProvider {
70
71 private String scmType, scmSpecificFilename;
72
73 private boolean requiresEditmode;
74
75 private ScmProviderRepository scmProviderRepository = new ScmProviderRepositoryStub();
76
77 private List<String> errors = new ArrayList<>();
78
79 private AddScmResult addScmResult;
80
81 private BranchScmResult branchScmResult;
82
83 private CheckInScmResult checkInScmResult;
84
85 private CheckOutScmResult checkOutScmResult;
86
87 private ChangeLogScmResult changeLogScmResult;
88
89 private DiffScmResult diffScmResult;
90
91 private RemoveScmResult removeScmResult;
92
93 private StatusScmResult statusScmResult;
94
95 private TagScmResult tagScmResult;
96
97 private UpdateScmResult updateScmResult;
98
99 private EditScmResult editScmResult;
100
101 private UnEditScmResult unEditScmResult;
102
103 private ListScmResult listScmResult;
104
105 private ExportScmResult exportScmResult;
106
107 private BlameScmResult blameScmResult;
108
109 private MkdirScmResult mkdirScmResult;
110
111 private UntagScmResult untagScmResult;
112
113
114
115
116 public ScmProviderStub() {
117 setScmSpecificFilename("");
118 setAddScmResult(new AddScmResult("", Collections.<ScmFile>emptyList()));
119 setBranchScmResult(new BranchScmResult("", Collections.<ScmFile>emptyList()));
120 setChangeLogScmResult(new ChangeLogScmResult("", "", "", true));
121 setCheckInScmResult(new CheckInScmResult("", "", "", true));
122 setCheckOutScmResult(new CheckOutScmResult("", "", "", true));
123 setDiffScmResult(new DiffScmResult("", "", "", true));
124 setEditScmResult(new EditScmResult("", "", "", true));
125 setExportScmResult(new ExportScmResult("", "", "", true));
126 setRemoveScmResult(new RemoveScmResult("", "", "", true));
127 setStatusScmResult(new StatusScmResult("", "", "", true));
128 setTagScmResult(new TagScmResult("", "", "", true));
129 setUnEditScmResult(new UnEditScmResult("", "", "", true));
130 setUntagScmResult(new UntagScmResult("", "", "", true));
131 setUpdateScmResult(new UpdateScmResult("", "", "", true));
132 setBlameScmResult(new BlameScmResult("", "", "", true));
133 setMkdirScmResult(new MkdirScmResult("", "", "", true));
134 }
135
136
137
138
139 public String sanitizeTagName(String tag) {
140 return tag;
141 }
142
143
144
145
146 public boolean validateTagName(String tag) {
147 return true;
148 }
149
150
151
152
153 public String getScmType() {
154 return scmType;
155 }
156
157 public void setScmSpecificFilename(String scmSpecificFilename) {
158 this.scmSpecificFilename = scmSpecificFilename;
159 }
160
161 public boolean requiresEditMode() {
162 return requiresEditmode;
163 }
164
165 public void setAddScmResult(AddScmResult addScmResult) {
166 this.addScmResult = addScmResult;
167 }
168
169 public AddScmResult getAddScmResult() {
170 return addScmResult;
171 }
172
173 public void setBranchScmResult(BranchScmResult branchScmResult) {
174 this.branchScmResult = branchScmResult;
175 }
176
177 public BranchScmResult getBranchScmResult() {
178 return branchScmResult;
179 }
180
181 public void setCheckInScmResult(CheckInScmResult checkInScmResult) {
182 this.checkInScmResult = checkInScmResult;
183 }
184
185 public CheckInScmResult getCheckInScmResult() {
186 return checkInScmResult;
187 }
188
189 public void setCheckOutScmResult(CheckOutScmResult checkOutScmResult) {
190 this.checkOutScmResult = checkOutScmResult;
191 }
192
193 public CheckOutScmResult getCheckOutScmResult() {
194 return checkOutScmResult;
195 }
196
197 public void setChangeLogScmResult(ChangeLogScmResult changeLogScmResult) {
198 this.changeLogScmResult = changeLogScmResult;
199 }
200
201 public ChangeLogScmResult getChangeLogScmResult() {
202 return changeLogScmResult;
203 }
204
205 public void setDiffScmResult(DiffScmResult diffScmResult) {
206 this.diffScmResult = diffScmResult;
207 }
208
209 public DiffScmResult getDiffScmResult() {
210 return diffScmResult;
211 }
212
213 public ExportScmResult getExportScmResult() {
214 return exportScmResult;
215 }
216
217 public void setExportScmResult(ExportScmResult exportScmResult) {
218 this.exportScmResult = exportScmResult;
219 }
220
221 public void setTagScmResult(TagScmResult tagScmResult) {
222 this.tagScmResult = tagScmResult;
223 }
224
225 public TagScmResult getTagScmResult() {
226 return tagScmResult;
227 }
228
229 public void setUntagScmResult(UntagScmResult untagScmResult) {
230 this.untagScmResult = untagScmResult;
231 }
232
233 public UntagScmResult getUntagScmResult() {
234 return untagScmResult;
235 }
236
237 public void setRemoveScmResult(RemoveScmResult removeScmResult) {
238 this.removeScmResult = removeScmResult;
239 }
240
241 public RemoveScmResult getRemoveScmResult() {
242 return removeScmResult;
243 }
244
245 public void setStatusScmResult(StatusScmResult statusScmResult) {
246 this.statusScmResult = statusScmResult;
247 }
248
249 public StatusScmResult getStatusScmResult() {
250 return statusScmResult;
251 }
252
253 public void setUpdateScmResult(UpdateScmResult updateScmResult) {
254 this.updateScmResult = updateScmResult;
255 }
256
257 public UpdateScmResult getUpdateScmResult() {
258 return updateScmResult;
259 }
260
261 public void setEditScmResult(EditScmResult editScmResult) {
262 this.editScmResult = editScmResult;
263 }
264
265 public EditScmResult getEditScmResult() {
266 return editScmResult;
267 }
268
269 public void setUnEditScmResult(UnEditScmResult unEditScmResult) {
270 this.unEditScmResult = unEditScmResult;
271 }
272
273 public UnEditScmResult getUnEditScmResult() {
274 return unEditScmResult;
275 }
276
277 public void setListScmResult(ListScmResult listScmResult) {
278 this.listScmResult = listScmResult;
279 }
280
281 public ListScmResult getListScmResult() {
282 return listScmResult;
283 }
284
285 public void setBlameScmResult(BlameScmResult blameScmResult) {
286 this.blameScmResult = blameScmResult;
287 }
288
289 public BlameScmResult getBlameScmResult() {
290 return blameScmResult;
291 }
292
293 public MkdirScmResult getMkdirScmResult() {
294 return mkdirScmResult;
295 }
296
297 public void setMkdirScmResult(MkdirScmResult mkdirScmResult) {
298 this.mkdirScmResult = mkdirScmResult;
299 }
300
301
302
303
304 public ScmProviderRepository makeProviderScmRepository(String scmSpecificUrl, char delimiter)
305 throws ScmRepositoryException {
306 return scmProviderRepository;
307 }
308
309
310
311
312 public ScmProviderRepository makeProviderScmRepository(File path)
313 throws ScmRepositoryException, UnknownRepositoryStructure {
314 return scmProviderRepository;
315 }
316
317
318
319
320 public List<String> validateScmUrl(String scmSpecificUrl, char delimiter) {
321 return errors;
322 }
323
324
325
326
327 public String getScmSpecificFilename() {
328 return scmSpecificFilename;
329 }
330
331
332
333
334 public AddScmResult add(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
335 return getAddScmResult();
336 }
337
338
339
340
341 public AddScmResult add(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException {
342 return getAddScmResult();
343 }
344
345 public AddScmResult add(ScmRepository repository, ScmFileSet fileSet, CommandParameters commandParameters)
346 throws ScmException {
347 return getAddScmResult();
348 }
349
350
351
352
353 public BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName) throws ScmException {
354 return getBranchScmResult();
355 }
356
357
358
359
360 public BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName, String message)
361 throws ScmException {
362 return getBranchScmResult();
363 }
364
365
366
367
368 public BranchScmResult branch(
369 ScmRepository repository, ScmFileSet fileSet, String branchName, ScmBranchParameters scmBranchParameters)
370 throws ScmException {
371 return getBranchScmResult();
372 }
373
374
375
376
377 public ChangeLogScmResult changeLog(
378 ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, int numDays, String branch)
379 throws ScmException {
380 return getChangeLogScmResult();
381 }
382
383
384
385
386 public ChangeLogScmResult changeLog(
387 ScmRepository repository,
388 ScmFileSet fileSet,
389 Date startDate,
390 Date endDate,
391 int numDays,
392 String branch,
393 String datePattern)
394 throws ScmException {
395 return getChangeLogScmResult();
396 }
397
398
399
400
401 public ChangeLogScmResult changeLog(ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag)
402 throws ScmException {
403 return getChangeLogScmResult();
404 }
405
406
407
408
409 public ChangeLogScmResult changeLog(
410 ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag, String datePattern)
411 throws ScmException {
412 return getChangeLogScmResult();
413 }
414
415
416
417
418 public ChangeLogScmResult changeLog(
419 ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, int numDays, ScmBranch branch)
420 throws ScmException {
421 return getChangeLogScmResult();
422 }
423
424
425
426
427 public ChangeLogScmResult changeLog(
428 ScmRepository repository,
429 ScmFileSet fileSet,
430 Date startDate,
431 Date endDate,
432 int numDays,
433 ScmBranch branch,
434 String datePattern)
435 throws ScmException {
436 return getChangeLogScmResult();
437 }
438
439 public ChangeLogScmResult changeLog(ChangeLogScmRequest scmRequest) throws ScmException {
440 return getChangeLogScmResult();
441 }
442
443
444
445
446 public ChangeLogScmResult changeLog(
447 ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion)
448 throws ScmException {
449 return getChangeLogScmResult();
450 }
451
452
453
454
455 public ChangeLogScmResult changeLog(
456 ScmRepository repository,
457 ScmFileSet fileSet,
458 ScmVersion startRevision,
459 ScmVersion endRevision,
460 String datePattern)
461 throws ScmException {
462 return getChangeLogScmResult();
463 }
464
465
466
467
468 public CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, String tag, String message)
469 throws ScmException {
470 return getCheckInScmResult();
471 }
472
473
474
475
476 public CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException {
477 return getCheckInScmResult();
478 }
479
480
481
482
483 public CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message)
484 throws ScmException {
485 return getCheckInScmResult();
486 }
487
488 @Override
489 public CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters)
490 throws ScmException {
491 return getCheckInScmResult();
492 }
493
494
495
496
497 public CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, String tag, boolean recursive)
498 throws ScmException {
499 return getCheckOutScmResult();
500 }
501
502
503
504
505 public CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
506 return getCheckOutScmResult();
507 }
508
509
510
511
512 public CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
513 return getCheckOutScmResult();
514 }
515
516
517
518
519 public CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, ScmVersion version)
520 throws ScmException {
521 return getCheckOutScmResult();
522 }
523
524
525
526
527 public CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, boolean recursive)
528 throws ScmException {
529 return getCheckOutScmResult();
530 }
531
532
533
534
535 public CheckOutScmResult checkOut(
536 ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version, boolean recursive)
537 throws ScmException {
538 return getCheckOutScmResult();
539 }
540
541 @Override
542 public CheckOutScmResult checkOut(
543 ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version, CommandParameters commandParameters)
544 throws ScmException {
545 return getCheckOutScmResult();
546 }
547
548
549
550
551 public DiffScmResult diff(ScmRepository repository, ScmFileSet fileSet, String startRevision, String endRevision)
552 throws ScmException {
553 return getDiffScmResult();
554 }
555
556
557
558
559 public DiffScmResult diff(
560 ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion startVersion, ScmVersion endVersion)
561 throws ScmException {
562 return getDiffScmResult();
563 }
564
565
566
567
568 public UpdateScmResult update(
569 ScmRepository repository,
570 ScmFileSet fileSet,
571 String tag,
572 Date lastUpdate,
573 String datePattern,
574 boolean runChangelog)
575 throws ScmException {
576 return getUpdateScmResult();
577 }
578
579
580
581
582 public EditScmResult edit(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
583 return getEditScmResult();
584 }
585
586
587
588
589 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
590 return getExportScmResult();
591 }
592
593
594
595
596 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String tag, String outputDirectory)
597 throws ScmException {
598 return getExportScmResult();
599 }
600
601
602
603
604 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
605 return getExportScmResult();
606 }
607
608
609
610
611 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, ScmVersion version)
612 throws ScmException {
613 return getExportScmResult();
614 }
615
616
617
618
619 public ExportScmResult export(
620 ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String outputDirectory)
621 throws ScmException {
622 return getExportScmResult();
623 }
624
625
626
627
628 public ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, String tag)
629 throws ScmException {
630 return getListScmResult();
631 }
632
633
634
635
636 public ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version)
637 throws ScmException {
638 return getListScmResult();
639 }
640
641
642
643
644 public RemoveScmResult remove(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException {
645 return getRemoveScmResult();
646 }
647
648
649
650
651 public StatusScmResult status(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
652 return getStatusScmResult();
653 }
654
655
656
657
658 public TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
659 return getTagScmResult();
660 }
661
662
663
664
665 public TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tag, String message)
666 throws ScmException {
667 return getTagScmResult();
668 }
669
670 public TagScmResult tag(
671 ScmRepository repository, ScmFileSet fileSet, String tagName, ScmTagParameters scmTagParameters)
672 throws ScmException {
673 return getTagScmResult();
674 }
675
676 public UntagScmResult untag(ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters)
677 throws ScmException {
678 return getUntagScmResult();
679 }
680
681
682
683
684 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
685 return getUpdateScmResult();
686 }
687
688
689
690
691 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, boolean runChangelog)
692 throws ScmException {
693 return getUpdateScmResult();
694 }
695
696
697
698
699 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, String datePattern)
700 throws ScmException {
701 return getUpdateScmResult();
702 }
703
704
705
706
707 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate)
708 throws ScmException {
709 return getUpdateScmResult();
710 }
711
712
713
714
715 public UpdateScmResult update(
716 ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate, String datePattern)
717 throws ScmException {
718 return getUpdateScmResult();
719 }
720
721
722
723
724 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
725 return getUpdateScmResult();
726 }
727
728
729
730
731 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version)
732 throws ScmException {
733 return getUpdateScmResult();
734 }
735
736
737
738
739 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, boolean runChangelog)
740 throws ScmException {
741 return getUpdateScmResult();
742 }
743
744
745
746
747 public UpdateScmResult update(
748 ScmRepository repository, ScmFileSet fileSet, ScmVersion version, boolean runChangelog)
749 throws ScmException {
750 return getUpdateScmResult();
751 }
752
753
754
755
756 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String datePattern)
757 throws ScmException {
758 return getUpdateScmResult();
759 }
760
761
762
763
764 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate)
765 throws ScmException {
766 return getUpdateScmResult();
767 }
768
769
770
771
772 public UpdateScmResult update(
773 ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate, String datePattern)
774 throws ScmException {
775 return getUpdateScmResult();
776 }
777
778
779
780
781 public UnEditScmResult unedit(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
782 return getUnEditScmResult();
783 }
784
785
786
787
788 public BlameScmResult blame(ScmRepository repository, ScmFileSet fileSet, String filename) throws ScmException {
789 return getBlameScmResult();
790 }
791
792 public BlameScmResult blame(BlameScmRequest blameScmRequest) throws ScmException {
793 return getBlameScmResult();
794 }
795
796
797
798
799 public MkdirScmResult mkdir(ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal)
800 throws ScmException {
801 return getMkdirScmResult();
802 }
803
804 public InfoScmResult info(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
805 throws ScmException {
806 return new InfoScmResult("", "", "", true);
807 }
808
809 public RemoteInfoScmResult remoteInfo(
810 ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
811 return new RemoteInfoScmResult("", null, null);
812 }
813 }