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