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