1 package org.apache.maven.plugins.dependency.testUtils.stubs;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.io.IOException;
24 import java.io.Writer;
25 import java.util.Collections;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Properties;
29 import java.util.Set;
30
31 import org.apache.maven.artifact.Artifact;
32 import org.apache.maven.artifact.DefaultArtifact;
33 import org.apache.maven.artifact.DependencyResolutionRequiredException;
34 import org.apache.maven.artifact.factory.ArtifactFactory;
35 import org.apache.maven.artifact.handler.ArtifactHandler;
36 import org.apache.maven.artifact.repository.ArtifactRepository;
37 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
38 import org.apache.maven.artifact.versioning.VersionRange;
39 import org.apache.maven.model.Build;
40 import org.apache.maven.model.CiManagement;
41 import org.apache.maven.model.Contributor;
42 import org.apache.maven.model.DependencyManagement;
43 import org.apache.maven.model.Developer;
44 import org.apache.maven.model.DistributionManagement;
45 import org.apache.maven.model.IssueManagement;
46 import org.apache.maven.model.License;
47 import org.apache.maven.model.MailingList;
48 import org.apache.maven.model.Model;
49 import org.apache.maven.model.Organization;
50 import org.apache.maven.model.Plugin;
51 import org.apache.maven.model.PluginManagement;
52 import org.apache.maven.model.Prerequisites;
53 import org.apache.maven.model.Reporting;
54 import org.apache.maven.model.Resource;
55 import org.apache.maven.model.Scm;
56 import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub;
57 import org.apache.maven.project.MavenProject;
58 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
59 import org.codehaus.plexus.PlexusTestCase;
60 import org.codehaus.plexus.util.xml.Xpp3Dom;
61
62
63
64
65 public class DependencyProjectStub
66 extends MavenProject
67 {
68 private String groupId;
69
70 private String artifactId;
71
72 private String name;
73
74 private Model model;
75
76 private MavenProject parent;
77
78 private List dependencies;
79
80 private File file;
81
82 private List collectedProjects;
83
84 private List attachedArtifacts;
85
86 private List compileSourceRoots;
87
88 private List testCompileSourceRoots;
89
90 private List scriptSourceRoots;
91
92 private List pluginArtifactRepositories;
93
94
95
96
97
98 private List activeProfiles;
99
100 private Set dependencyArtifacts;
101
102 private DependencyManagement dependencyManagement;
103
104 private Artifact artifact;
105
106
107
108 private Model originalModel;
109
110
111
112
113
114
115
116
117
118
119
120 private boolean executionRoot;
121
122 private List compileArtifacts;
123
124 private List compileDependencies;
125
126 private List systemDependencies;
127
128 private List testClasspathElements;
129
130 private List testDependencies;
131
132 private List systemClasspathElements;
133
134 private List systemArtifacts;
135
136 private List testArtifacts;
137
138 private List runtimeArtifacts;
139
140 private List runtimeDependencies;
141
142 private List runtimeClasspathElements;
143
144 private String modelVersion;
145
146 private String packaging;
147
148 private String inceptionYear;
149
150 private String url;
151
152 private String description;
153
154 private String version;
155
156 private String defaultGoal;
157
158 private Set artifacts;
159
160 private Properties properties;
161
162 public DependencyProjectStub()
163 {
164 super( (Model) null );
165 }
166
167
168 public DependencyProjectStub( Model model )
169 {
170
171 super( (Model) null );
172 }
173
174
175 public DependencyProjectStub( MavenProject project )
176 {
177
178 super( (Model) null );
179 }
180
181 public String getModulePathAdjustment( MavenProject mavenProject )
182 throws IOException
183 {
184 return "";
185 }
186
187 public Artifact getArtifact()
188 {
189 if ( artifact == null )
190 {
191 ArtifactHandler ah = new DefaultArtifactHandlerStub( "jar", null );
192
193 VersionRange vr = VersionRange.createFromVersion( "1.0" );
194 Artifact art =
195 new DefaultArtifact( "group", "artifact", vr, Artifact.SCOPE_COMPILE, "jar", null, ah, false );
196 setArtifact( art );
197 }
198 return artifact;
199 }
200
201 public void setArtifact( Artifact artifact )
202 {
203 this.artifact = artifact;
204 }
205
206 public Model getModel()
207 {
208 return model;
209 }
210
211 public MavenProject getParent()
212 {
213 return parent;
214 }
215
216 public void setParent( MavenProject mavenProject )
217 {
218 this.parent = mavenProject;
219 }
220
221 public void setRemoteArtifactRepositories( List list )
222 {
223
224 }
225
226 public List getRemoteArtifactRepositories()
227 {
228 return Collections.singletonList( "" );
229 }
230
231 public boolean hasParent()
232 {
233 return ( parent != null );
234 }
235
236 public File getFile()
237 {
238 return file;
239 }
240
241 public void setFile( File file )
242 {
243 this.file = file;
244 }
245
246 public File getBasedir()
247 {
248 return new File( PlexusTestCase.getBasedir() );
249 }
250
251 public void setDependencies( List list )
252 {
253 dependencies = list;
254 }
255
256 public List getDependencies()
257 {
258 if ( dependencies == null )
259 {
260 dependencies = Collections.EMPTY_LIST;
261 }
262 return dependencies;
263 }
264
265 public void setDependencyManagement( DependencyManagement depMgt )
266 {
267 this.dependencyManagement = depMgt;
268 }
269
270 public DependencyManagement getDependencyManagement()
271 {
272 if ( dependencyManagement == null )
273 {
274 dependencyManagement = new DependencyManagement();
275 }
276
277 return dependencyManagement;
278 }
279
280 public void addCompileSourceRoot( String string )
281 {
282 if ( compileSourceRoots == null )
283 {
284 compileSourceRoots = Collections.singletonList( string );
285 }
286 else
287 {
288 compileSourceRoots.add( string );
289 }
290 }
291
292 public void addScriptSourceRoot( String string )
293 {
294 if ( scriptSourceRoots == null )
295 {
296 scriptSourceRoots = Collections.singletonList( string );
297 }
298 else
299 {
300 scriptSourceRoots.add( string );
301 }
302 }
303
304 public void addTestCompileSourceRoot( String string )
305 {
306 if ( testCompileSourceRoots == null )
307 {
308 testCompileSourceRoots = Collections.singletonList( string );
309 }
310 else
311 {
312 testCompileSourceRoots.add( string );
313 }
314 }
315
316 public List getCompileSourceRoots()
317 {
318 return compileSourceRoots;
319 }
320
321 public List getScriptSourceRoots()
322 {
323 return scriptSourceRoots;
324 }
325
326 public List getTestCompileSourceRoots()
327 {
328 return testCompileSourceRoots;
329 }
330
331 public List getCompileClasspathElements()
332 throws DependencyResolutionRequiredException
333 {
334 return compileSourceRoots;
335 }
336
337 public void setCompileArtifacts( List compileArtifacts )
338 {
339 this.compileArtifacts = compileArtifacts;
340 }
341
342 public List getCompileArtifacts()
343 {
344 return compileArtifacts;
345 }
346
347 public List getCompileDependencies()
348 {
349 return compileDependencies;
350 }
351
352 public List getTestClasspathElements()
353 throws DependencyResolutionRequiredException
354 {
355 return testClasspathElements;
356 }
357
358 public List getTestArtifacts()
359 {
360 return testArtifacts;
361 }
362
363 public List getTestDependencies()
364 {
365 return testDependencies;
366 }
367
368 public List getRuntimeClasspathElements()
369 throws DependencyResolutionRequiredException
370 {
371 return runtimeClasspathElements;
372 }
373
374 public List getRuntimeArtifacts()
375 {
376 return runtimeArtifacts;
377 }
378
379 public List getRuntimeDependencies()
380 {
381 return runtimeDependencies;
382 }
383
384 public List getSystemClasspathElements()
385 throws DependencyResolutionRequiredException
386 {
387 return systemClasspathElements;
388 }
389
390 public List getSystemArtifacts()
391 {
392 return systemArtifacts;
393 }
394
395 public void setRuntimeClasspathElements( List runtimeClasspathElements )
396 {
397 this.runtimeClasspathElements = runtimeClasspathElements;
398 }
399
400 public void setAttachedArtifacts( List attachedArtifacts )
401 {
402 this.attachedArtifacts = attachedArtifacts;
403 }
404
405 public void setCompileSourceRoots( List compileSourceRoots )
406 {
407 this.compileSourceRoots = compileSourceRoots;
408 }
409
410 public void setTestCompileSourceRoots( List testCompileSourceRoots )
411 {
412 this.testCompileSourceRoots = testCompileSourceRoots;
413 }
414
415 public void setScriptSourceRoots( List scriptSourceRoots )
416 {
417 this.scriptSourceRoots = scriptSourceRoots;
418 }
419
420 public void setArtifactMap( Map artifactMap )
421 {
422
423 }
424
425 public void setPluginArtifactMap( Map pluginArtifactMap )
426 {
427
428 }
429
430 public void setReportArtifactMap( Map reportArtifactMap )
431 {
432
433 }
434
435 public void setExtensionArtifactMap( Map extensionArtifactMap )
436 {
437
438 }
439
440 public void setProjectReferences( Map projectReferences )
441 {
442
443 }
444
445 public void setBuildOverlay( Build buildOverlay )
446 {
447
448 }
449
450 public void setCompileDependencies( List compileDependencies )
451 {
452 this.compileDependencies = compileDependencies;
453 }
454
455 public void setSystemDependencies( List systemDependencies )
456 {
457 this.systemDependencies = systemDependencies;
458 }
459
460 public void setTestClasspathElements( List testClasspathElements )
461 {
462 this.testClasspathElements = testClasspathElements;
463 }
464
465 public void setTestDependencies( List testDependencies )
466 {
467 this.testDependencies = testDependencies;
468 }
469
470 public void setSystemClasspathElements( List systemClasspathElements )
471 {
472 this.systemClasspathElements = systemClasspathElements;
473 }
474
475 public void setSystemArtifacts( List systemArtifacts )
476 {
477 this.systemArtifacts = systemArtifacts;
478 }
479
480 public void setTestArtifacts( List testArtifacts )
481 {
482 this.testArtifacts = testArtifacts;
483 }
484
485 public void setRuntimeArtifacts( List runtimeArtifacts )
486 {
487 this.runtimeArtifacts = runtimeArtifacts;
488 }
489
490 public void setRuntimeDependencies( List runtimeDependencies )
491 {
492 this.runtimeDependencies = runtimeDependencies;
493 }
494
495 public void setModel( Model model )
496 {
497 this.model = model;
498 }
499
500 public List getSystemDependencies()
501 {
502 return systemDependencies;
503 }
504
505 public void setModelVersion( String string )
506 {
507 this.modelVersion = string;
508 }
509
510 public String getModelVersion()
511 {
512 return modelVersion;
513 }
514
515 public String getId()
516 {
517 return "";
518 }
519
520 public void setGroupId( String string )
521 {
522 this.groupId = string;
523 }
524
525 public String getGroupId()
526 {
527 return groupId;
528 }
529
530 public void setArtifactId( String string )
531 {
532 this.artifactId = string;
533 }
534
535 public String getArtifactId()
536 {
537 return artifactId;
538 }
539
540 public void setName( String string )
541 {
542 this.name = string;
543 }
544
545 public String getName()
546 {
547 return name;
548 }
549
550 public void setVersion( String string )
551 {
552 this.version = string;
553 }
554
555 public String getVersion()
556 {
557 return version;
558 }
559
560 public String getPackaging()
561 {
562 return packaging;
563 }
564
565 public void setPackaging( String string )
566 {
567 this.packaging = string;
568 }
569
570 public void setInceptionYear( String string )
571 {
572 this.inceptionYear = string;
573 }
574
575 public String getInceptionYear()
576 {
577 return inceptionYear;
578 }
579
580 public void setUrl( String string )
581 {
582 this.url = string;
583 }
584
585 public String getUrl()
586 {
587 return url;
588 }
589
590 public Prerequisites getPrerequisites()
591 {
592 return null;
593 }
594
595 public void setIssueManagement( IssueManagement issueManagement )
596 {
597
598 }
599
600 public CiManagement getCiManagement()
601 {
602 return null;
603 }
604
605 public void setCiManagement( CiManagement ciManagement )
606 {
607
608 }
609
610 public IssueManagement getIssueManagement()
611 {
612 return null;
613 }
614
615 public void setDistributionManagement( DistributionManagement distributionManagement )
616 {
617
618 }
619
620 public DistributionManagement getDistributionManagement()
621 {
622 return null;
623 }
624
625 public void setDescription( String string )
626 {
627 this.description = string;
628 }
629
630 public String getDescription()
631 {
632 return description;
633 }
634
635 public void setOrganization( Organization organization )
636 {
637
638 }
639
640 public Organization getOrganization()
641 {
642 return null;
643 }
644
645 public void setScm( Scm scm )
646 {
647
648 }
649
650 public Scm getScm()
651 {
652 return null;
653 }
654
655 public void setMailingLists( List list )
656 {
657
658 }
659
660 public List getMailingLists()
661 {
662 return Collections.singletonList( "" );
663 }
664
665 public void addMailingList( MailingList mailingList )
666 {
667
668 }
669
670 public void setDevelopers( List list )
671 {
672
673 }
674
675 public List getDevelopers()
676 {
677 return Collections.singletonList( "" );
678 }
679
680 public void addDeveloper( Developer developer )
681 {
682
683 }
684
685 public void setContributors( List list )
686 {
687
688 }
689
690 public List getContributors()
691 {
692 return Collections.singletonList( "" );
693 }
694
695 public void addContributor( Contributor contributor )
696 {
697
698 }
699
700 public void setBuild( Build build )
701 {
702
703 }
704
705 public Build getBuild()
706 {
707 return null;
708 }
709
710 public List getResources()
711 {
712 return Collections.singletonList( "" );
713 }
714
715 public List getTestResources()
716 {
717 return Collections.singletonList( "" );
718 }
719
720 public void addResource( Resource resource )
721 {
722
723 }
724
725 public void addTestResource( Resource resource )
726 {
727
728 }
729
730 public void setReporting( Reporting reporting )
731 {
732
733 }
734
735 public Reporting getReporting()
736 {
737 return null;
738 }
739
740 public void setLicenses( List list )
741 {
742
743 }
744
745 public List getLicenses()
746 {
747 return Collections.singletonList( "" );
748 }
749
750 public void addLicense( License license )
751 {
752
753 }
754
755 public void setArtifacts( Set set )
756 {
757 this.artifacts = set;
758 }
759
760 public Set getArtifacts()
761 {
762 if ( artifacts == null )
763 {
764 return Collections.EMPTY_SET;
765 }
766 else
767 {
768 return artifacts;
769 }
770 }
771
772 public Map getArtifactMap()
773 {
774 return Collections.singletonMap( "", "" );
775 }
776
777 public void setPluginArtifacts( Set set )
778 {
779
780 }
781
782 public Set getPluginArtifacts()
783 {
784 return Collections.singleton( "" );
785 }
786
787 public Map getPluginArtifactMap()
788 {
789 return Collections.singletonMap( "", "" );
790 }
791
792 public void setReportArtifacts( Set set )
793 {
794
795 }
796
797 public Set getReportArtifacts()
798 {
799 return Collections.singleton( "" );
800 }
801
802 public Map getReportArtifactMap()
803 {
804 return Collections.singletonMap( "", "" );
805 }
806
807 public void setExtensionArtifacts( Set set )
808 {
809
810 }
811
812 public Set getExtensionArtifacts()
813 {
814 return Collections.singleton( "" );
815 }
816
817 public Map getExtensionArtifactMap()
818 {
819 return Collections.singletonMap( "", "" );
820 }
821
822 public void setParentArtifact( Artifact artifact )
823 {
824
825 }
826
827 public Artifact getParentArtifact()
828 {
829 return null;
830 }
831
832 public List getRepositories()
833 {
834 return Collections.singletonList( "" );
835 }
836
837 public List getReportPlugins()
838 {
839 return Collections.singletonList( "" );
840 }
841
842 public List getBuildPlugins()
843 {
844 return Collections.singletonList( "" );
845 }
846
847 public List getModules()
848 {
849 return Collections.singletonList( "" );
850 }
851
852 public PluginManagement getPluginManagement()
853 {
854 return null;
855 }
856
857 public void addPlugin( Plugin plugin )
858 {
859
860 }
861
862 public void injectPluginManagementInfo( Plugin plugin )
863 {
864
865 }
866
867 public List getCollectedProjects()
868 {
869 return collectedProjects;
870 }
871
872 public void setCollectedProjects( List list )
873 {
874 this.collectedProjects = list;
875 }
876
877 public void setPluginArtifactRepositories( List list )
878 {
879 this.pluginArtifactRepositories = list;
880 }
881
882 public List getPluginArtifactRepositories()
883 {
884 return pluginArtifactRepositories;
885 }
886
887 public ArtifactRepository getDistributionManagementArtifactRepository()
888 {
889 return null;
890 }
891
892 public List getPluginRepositories()
893 {
894 return Collections.singletonList( "" );
895 }
896
897 public void setActiveProfiles( List list )
898 {
899 activeProfiles = list;
900 }
901
902 public List getActiveProfiles()
903 {
904 return activeProfiles;
905 }
906
907 public void addAttachedArtifact( Artifact theArtifact )
908 {
909 if ( attachedArtifacts == null )
910 {
911 this.attachedArtifacts = Collections.singletonList( theArtifact );
912 }
913 else
914 {
915 attachedArtifacts.add( theArtifact );
916 }
917 }
918
919 public List getAttachedArtifacts()
920 {
921 return attachedArtifacts;
922 }
923
924 public Xpp3Dom getGoalConfiguration( String string, String string1, String string2, String string3 )
925 {
926 return null;
927 }
928
929 public Xpp3Dom getReportConfiguration( String string, String string1, String string2 )
930 {
931 return null;
932 }
933
934 public MavenProject getExecutionProject()
935 {
936 return null;
937 }
938
939 public void setExecutionProject( MavenProject mavenProject )
940 {
941
942 }
943
944 public void writeModel( Writer writer )
945 throws IOException
946 {
947
948 }
949
950 public void writeOriginalModel( Writer writer )
951 throws IOException
952 {
953
954 }
955
956 public Set getDependencyArtifacts()
957 {
958 return dependencyArtifacts;
959 }
960
961 public void setDependencyArtifacts( Set set )
962 {
963 this.dependencyArtifacts = set;
964 }
965
966 public void setReleaseArtifactRepository( ArtifactRepository artifactRepository )
967 {
968
969 }
970
971 public void setSnapshotArtifactRepository( ArtifactRepository artifactRepository )
972 {
973
974 }
975
976 public void setOriginalModel( Model model )
977 {
978 this.originalModel = model;
979 }
980
981 public Model getOriginalModel()
982 {
983 return originalModel;
984 }
985
986 public List getBuildExtensions()
987 {
988 return Collections.singletonList( "" );
989 }
990
991 public Set createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter )
992 throws InvalidDependencyVersionException
993 {
994 return Collections.EMPTY_SET;
995 }
996
997 public void addProjectReference( MavenProject mavenProject )
998 {
999
1000 }
1001
1002 public void attachArtifact( String string, String string1, File theFile )
1003 {
1004
1005 }
1006
1007 public Properties getProperties()
1008 {
1009 if ( properties == null )
1010 {
1011 properties = new Properties();
1012 }
1013 return properties;
1014 }
1015
1016 public List getFilters()
1017 {
1018 return Collections.singletonList( "" );
1019 }
1020
1021 public Map getProjectReferences()
1022 {
1023 return Collections.singletonMap( "", "" );
1024 }
1025
1026 public boolean isExecutionRoot()
1027 {
1028 return executionRoot;
1029 }
1030
1031 public void setExecutionRoot( boolean b )
1032 {
1033 this.executionRoot = b;
1034 }
1035
1036 public String getDefaultGoal()
1037 {
1038 return defaultGoal;
1039 }
1040
1041 public Artifact replaceWithActiveArtifact( Artifact theArtifact )
1042 {
1043 return null;
1044 }
1045 }