1 package org.apache.maven.plugin.deploy.stubs;
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.artifact.Artifact;
23 import org.apache.maven.artifact.metadata.ArtifactMetadata;
24 import org.apache.maven.artifact.repository.ArtifactRepository;
25 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
26 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
27 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
28
29 public class ArtifactRepositoryStub
30 implements ArtifactRepository
31 {
32 private boolean blacklisted;
33
34 private ArtifactRepositoryLayout layout;
35
36 private String url;
37
38 private String basedir = System.getProperty( "basedir" );
39
40 public String pathOf( Artifact artifact )
41 {
42 return getLayout().pathOf( artifact );
43 }
44
45 public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
46 {
47 return getLayout().pathOfRemoteRepositoryMetadata( artifactMetadata );
48 }
49
50 public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
51 {
52 return getLayout().pathOfLocalRepositoryMetadata( metadata, repository );
53 }
54
55 public String getUrl()
56 {
57 return url;
58 }
59
60 public void setAppendToUrl( String dir )
61 {
62 this.url = "file://" + basedir + "/target/remote-repo/" + dir;
63 }
64
65 public String getBasedir()
66 {
67 return basedir;
68 }
69
70 public String getProtocol()
71 {
72 return "file";
73 }
74
75 public String getId()
76 {
77 return "deploy-test";
78 }
79
80 public ArtifactRepositoryPolicy getSnapshots()
81 {
82 return new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
83 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
84 }
85
86 public ArtifactRepositoryPolicy getReleases()
87 {
88 return new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
89 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
90 }
91
92 public ArtifactRepositoryLayout getLayout()
93 {
94 if( layout != null )
95 {
96 return layout;
97 }
98 else
99 {
100 return new DefaultRepositoryLayout();
101 }
102 }
103
104 public String getKey()
105 {
106 return getId();
107 }
108
109 public boolean isUniqueVersion()
110 {
111 return false;
112 }
113
114 public void setBlacklisted( boolean blackListed )
115 {
116 this.blacklisted = blackListed;
117 }
118
119 public boolean isBlacklisted()
120 {
121 return blacklisted;
122 }
123 }