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
489
490
491 public CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, String tag, boolean recursive)
492 throws ScmException {
493 return getCheckOutScmResult();
494 }
495
496
497
498
499 public CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
500 return getCheckOutScmResult();
501 }
502
503
504
505
506 public CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
507 return getCheckOutScmResult();
508 }
509
510
511
512
513 public CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, ScmVersion version)
514 throws ScmException {
515 return getCheckOutScmResult();
516 }
517
518
519
520
521 public CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, boolean recursive)
522 throws ScmException {
523 return getCheckOutScmResult();
524 }
525
526
527
528
529 public CheckOutScmResult checkOut(
530 ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version, boolean recursive)
531 throws ScmException {
532 return getCheckOutScmResult();
533 }
534
535 @Override
536 public CheckOutScmResult checkOut(
537 ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version, CommandParameters commandParameters)
538 throws ScmException {
539 return getCheckOutScmResult();
540 }
541
542
543
544
545 public DiffScmResult diff(ScmRepository repository, ScmFileSet fileSet, String startRevision, String endRevision)
546 throws ScmException {
547 return getDiffScmResult();
548 }
549
550
551
552
553 public DiffScmResult diff(
554 ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion startVersion, ScmVersion endVersion)
555 throws ScmException {
556 return getDiffScmResult();
557 }
558
559
560
561
562 public UpdateScmResult update(
563 ScmRepository repository,
564 ScmFileSet fileSet,
565 String tag,
566 Date lastUpdate,
567 String datePattern,
568 boolean runChangelog)
569 throws ScmException {
570 return getUpdateScmResult();
571 }
572
573
574
575
576 public EditScmResult edit(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
577 return getEditScmResult();
578 }
579
580
581
582
583 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
584 return getExportScmResult();
585 }
586
587
588
589
590 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String tag, String outputDirectory)
591 throws ScmException {
592 return getExportScmResult();
593 }
594
595
596
597
598 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
599 return getExportScmResult();
600 }
601
602
603
604
605 public ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, ScmVersion version)
606 throws ScmException {
607 return getExportScmResult();
608 }
609
610
611
612
613 public ExportScmResult export(
614 ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String outputDirectory)
615 throws ScmException {
616 return getExportScmResult();
617 }
618
619
620
621
622 public ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, String tag)
623 throws ScmException {
624 return getListScmResult();
625 }
626
627
628
629
630 public ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version)
631 throws ScmException {
632 return getListScmResult();
633 }
634
635
636
637
638 public RemoveScmResult remove(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException {
639 return getRemoveScmResult();
640 }
641
642
643
644
645 public StatusScmResult status(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
646 return getStatusScmResult();
647 }
648
649
650
651
652 public TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
653 return getTagScmResult();
654 }
655
656
657
658
659 public TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tag, String message)
660 throws ScmException {
661 return getTagScmResult();
662 }
663
664 public TagScmResult tag(
665 ScmRepository repository, ScmFileSet fileSet, String tagName, ScmTagParameters scmTagParameters)
666 throws ScmException {
667 return getTagScmResult();
668 }
669
670 public UntagScmResult untag(ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters)
671 throws ScmException {
672 return getUntagScmResult();
673 }
674
675
676
677
678 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException {
679 return getUpdateScmResult();
680 }
681
682
683
684
685 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, boolean runChangelog)
686 throws ScmException {
687 return getUpdateScmResult();
688 }
689
690
691
692
693 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, String datePattern)
694 throws ScmException {
695 return getUpdateScmResult();
696 }
697
698
699
700
701 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate)
702 throws ScmException {
703 return getUpdateScmResult();
704 }
705
706
707
708
709 public UpdateScmResult update(
710 ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate, String datePattern)
711 throws ScmException {
712 return getUpdateScmResult();
713 }
714
715
716
717
718 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
719 return getUpdateScmResult();
720 }
721
722
723
724
725 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version)
726 throws ScmException {
727 return getUpdateScmResult();
728 }
729
730
731
732
733 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, boolean runChangelog)
734 throws ScmException {
735 return getUpdateScmResult();
736 }
737
738
739
740
741 public UpdateScmResult update(
742 ScmRepository repository, ScmFileSet fileSet, ScmVersion version, boolean runChangelog)
743 throws ScmException {
744 return getUpdateScmResult();
745 }
746
747
748
749
750 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String datePattern)
751 throws ScmException {
752 return getUpdateScmResult();
753 }
754
755
756
757
758 public UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate)
759 throws ScmException {
760 return getUpdateScmResult();
761 }
762
763
764
765
766 public UpdateScmResult update(
767 ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate, String datePattern)
768 throws ScmException {
769 return getUpdateScmResult();
770 }
771
772
773
774
775 public UnEditScmResult unedit(ScmRepository repository, ScmFileSet fileSet) throws ScmException {
776 return getUnEditScmResult();
777 }
778
779
780
781
782 public BlameScmResult blame(ScmRepository repository, ScmFileSet fileSet, String filename) throws ScmException {
783 return getBlameScmResult();
784 }
785
786 public BlameScmResult blame(BlameScmRequest blameScmRequest) throws ScmException {
787 return getBlameScmResult();
788 }
789
790
791
792
793 public MkdirScmResult mkdir(ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal)
794 throws ScmException {
795 return getMkdirScmResult();
796 }
797
798 public InfoScmResult info(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
799 throws ScmException {
800 return new InfoScmResult("", "", "", true);
801 }
802
803 public RemoteInfoScmResult remoteInfo(
804 ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
805 return new RemoteInfoScmResult("", null, null);
806 }
807 }