Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-30408] Fixed URI composition for REST API calls
Take into account the base path of JIRA site URL when building URIs for REST API calls. Added a test case for checking REST API path construction. Fixes: JENKINS-30408
- Loading branch information
Enrico De Fent
committed
Sep 14, 2015
1 parent
00e439d
commit 89f80ba
Showing
2 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/test/java/hudson/plugins/jira/JiraRestServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hudson.plugins.jira; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import java.net.URI; | ||
|
||
import org.junit.Test; | ||
|
||
public class JiraRestServiceTest { | ||
|
||
@Test | ||
public void testBaseApiPath01() { | ||
URI uri = URI.create("http://example.com:8080/"); | ||
JiraRestService service = new JiraRestService(uri, null, "user", | ||
"password"); | ||
assertEquals("/" + JiraRestService.BASE_API_PATH, | ||
service.getBaseApiPath()); | ||
} | ||
|
||
@Test | ||
public void testBaseApiPath02() { | ||
URI uri = URI.create("https://example.com/path/to/jira"); | ||
JiraRestService service = new JiraRestService(uri, null, "user", | ||
"password"); | ||
assertEquals("/path/to/jira/" + JiraRestService.BASE_API_PATH, | ||
service.getBaseApiPath()); | ||
} | ||
} |