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
596
597
598 public DiffScmResult diff( ScmRepository repository, ScmFileSet fileSet, String startRevision, String endRevision )
599 throws ScmException
600 {
601 return getDiffScmResult();
602 }
603
604
605
606
607 public DiffScmResult diff( ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion startVersion,
608 ScmVersion endVersion )
609 throws ScmException
610 {
611 return getDiffScmResult();
612 }
613
614
615
616
617 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate,
618 String datePattern, boolean runChangelog )
619 throws ScmException
620 {
621 return getUpdateScmResult();
622 }
623
624
625
626
627 public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet )
628 throws ScmException
629 {
630 return getEditScmResult();
631 }
632
633
634
635
636 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String tag )
637 throws ScmException
638 {
639 return getExportScmResult();
640 }
641
642
643
644
645 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String tag, String outputDirectory )
646 throws ScmException
647 {
648 return getExportScmResult();
649 }
650
651
652
653
654 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet )
655 throws ScmException
656 {
657 return getExportScmResult();
658 }
659
660
661
662
663 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
664 throws ScmException
665 {
666 return getExportScmResult();
667 }
668
669
670
671
672 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
673 String outputDirectory )
674 throws ScmException
675 {
676 return getExportScmResult();
677 }
678
679
680
681
682 public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, String tag )
683 throws ScmException
684 {
685 return getListScmResult();
686 }
687
688
689
690
691 public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version )
692 throws ScmException
693 {
694 return getListScmResult();
695 }
696
697
698
699
700 public RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, String message )
701 throws ScmException
702 {
703 return getRemoveScmResult();
704 }
705
706
707
708
709 public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet )
710 throws ScmException
711 {
712 return getStatusScmResult();
713 }
714
715
716
717
718 public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tag )
719 throws ScmException
720 {
721 return getTagScmResult();
722 }
723
724
725
726
727 public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tag, String message )
728 throws ScmException
729 {
730 return getTagScmResult();
731 }
732
733 public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName,
734 ScmTagParameters scmTagParameters )
735 throws ScmException
736 {
737 return getTagScmResult();
738 }
739
740
741
742
743 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag )
744 throws ScmException
745 {
746 return getUpdateScmResult();
747 }
748
749
750
751
752 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, boolean runChangelog )
753 throws ScmException
754 {
755 return getUpdateScmResult();
756 }
757
758
759
760
761 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, String datePattern )
762 throws ScmException
763 {
764 return getUpdateScmResult();
765 }
766
767
768
769
770 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate )
771 throws ScmException
772 {
773 return getUpdateScmResult();
774 }
775
776
777
778
779 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate,
780 String datePattern )
781 throws ScmException
782 {
783 return getUpdateScmResult();
784 }
785
786
787
788
789 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet )
790 throws ScmException
791 {
792 return getUpdateScmResult();
793 }
794
795
796
797
798 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
799 throws ScmException
800 {
801 return getUpdateScmResult();
802 }
803
804
805
806
807 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, boolean runChangelog )
808 throws ScmException
809 {
810 return getUpdateScmResult();
811 }
812
813
814
815
816 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
817 boolean runChangelog )
818 throws ScmException
819 {
820 return getUpdateScmResult();
821 }
822
823
824
825
826 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
827 String datePattern )
828 throws ScmException
829 {
830 return getUpdateScmResult();
831 }
832
833
834
835
836 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate )
837 throws ScmException
838 {
839 return getUpdateScmResult();
840 }
841
842
843
844
845 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate,
846 String datePattern )
847 throws ScmException
848 {
849 return getUpdateScmResult();
850 }
851
852
853
854
855 public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet )
856 throws ScmException
857 {
858 return getUnEditScmResult();
859 }
860
861
862
863
864 public BlameScmResult blame( ScmRepository repository, ScmFileSet fileSet, String filename )
865 throws ScmException
866 {
867 return getBlameScmResult();
868 }
869
870 public BlameScmResult blame( BlameScmRequest blameScmRequest )
871 throws ScmException
872 {
873 return getBlameScmResult();
874 }
875
876
877
878
879 public MkdirScmResult mkdir( ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal )
880 throws ScmException
881 {
882 return getMkdirScmResult();
883 }
884
885 public InfoScmResult info( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
886 throws ScmException
887 {
888 return new InfoScmResult( "", "", "", true );
889 }
890
891 public RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
892 CommandParameters parameters )
893 throws ScmException
894 {
895 return new RemoteInfoScmResult( "", null, null );
896 }
897 }