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