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