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