1 package org.apache.maven.scm.provider.accurev;
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.provider.ScmProviderRepository;
23 import org.codehaus.plexus.util.StringUtils;
24 import org.hamcrest.Description;
25 import org.hamcrest.Matcher;
26 import org.hamcrest.TypeSafeMatcher;
27
28 public class AccuRevScmProviderRepositoryMatcher
29 extends TypeSafeMatcher<ScmProviderRepository>
30 {
31
32 public static Matcher<ScmProviderRepository> isRepo( String user, String pass, String host, int port,
33 String stream, String projectPath )
34
35 {
36 return new AccuRevScmProviderRepositoryMatcher( user, pass, host, port, stream, projectPath );
37 }
38
39 private String user;
40
41 private String pass;
42
43 private String host;
44
45 private String projectPath;
46
47 private String stream;
48
49 private int port;
50
51 public AccuRevScmProviderRepositoryMatcher( String user, String pass, String host, int port, String stream,
52 String projectPath )
53 {
54 this.user = user;
55 this.pass = pass;
56 this.host = host;
57 this.port = port;
58 this.stream = stream;
59 this.projectPath = projectPath;
60
61 }
62
63 public void describeTo( Description desc )
64 {
65 desc.appendText( "an AccuRev repo with" );
66 desc.appendText( " user=" );
67 desc.appendValue( user );
68 desc.appendText( " pass=" );
69 desc.appendValue( pass );
70 desc.appendText( " host=" );
71 desc.appendValue( host );
72 desc.appendText( " port=" );
73 desc.appendValue( port );
74 desc.appendText( " stream=" );
75 desc.appendValue( stream );
76 desc.appendText( " projectPath=" );
77 desc.appendValue( projectPath );
78
79 }
80
81 @Override
82 public boolean matchesSafely( ScmProviderRepository repo )
83 {
84 if ( !( repo instanceof AccuRevScmProviderRepository ) )
85 {
86 return false;
87 }
88 AccuRevScmProviderRepository accuRevRepo = (AccuRevScmProviderRepository) repo;
89 return StringUtils.equals( user, accuRevRepo.getUser() )
90 && StringUtils.equals( pass, accuRevRepo.getPassword() )
91 && StringUtils.equals( host, accuRevRepo.getHost() ) && port == accuRevRepo.getPort()
92 && StringUtils.equals( stream, accuRevRepo.getStreamName() )
93 && StringUtils.equals( projectPath, accuRevRepo.getProjectPath() );
94
95 }
96 }