Skip to content

Commit

Permalink
Merge pull request #26 from ixdy/uri-requirement-builder-bugfix
Browse files Browse the repository at this point in the history
Fix a small bug in URIRequirementBuilder.
  • Loading branch information
stephenc committed Jul 2, 2015
2 parents a6c40a1 + f5947cc commit 5adb2a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public URIRequirementBuilder withScheme(@CheckForNull String scheme) {
*/
@NonNull
public URIRequirementBuilder withPath(@CheckForNull String path) {
withoutScheme();
withoutPath();
if (path != null) {
requirements.add(new PathRequirement(path));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ public void smokes() throws Exception {
public void pathRequirements() throws Exception {
Domain instance =
new Domain("test federation", "the instance under test", Arrays.<DomainSpecification>asList(
new SchemeSpecification("http, https, svn, git, pop3, imap, spdy"),
new SchemeSpecification("https"),
new HostnameSpecification("*.jenkins-ci.org", null),
new PathSpecification("/download/**/jenkins.war", null, false)));

assertThat(instance.test(), is(true));
assertThat(instance.test(URIRequirementBuilder.fromUri("https://updates.jenkins-ci.org/download/1.532/jenkins.war").build()), is(true));
assertThat(instance.test(URIRequirementBuilder.fromUri("https://updates.jenkins-ci.org/download/jenkins.war").build()), is(true));
assertThat(instance.test(URIRequirementBuilder.fromUri("https://updates.jenkins-ci.org/download/1/2/3/jenkins.war").build()), is(true));
assertThat(instance.test(URIRequirementBuilder.fromUri("http://updates.jenkins-ci.org/download/1/2/3/jenkins.war").build()), is(false));

}
}

0 comments on commit 5adb2a2

Please sign in to comment.