jira-integration: Move path for search operation in JIRA REST API to constant
As this path is used in several classes it has been moved to a constant in JiraRESTClient. FEA: ItEr77S16JiraAndTimConnectorContributionIntegration
This commit is contained in:
parent
9821014c9b
commit
cc2568aca2
5 changed files with 13 additions and 8 deletions
|
|
@ -78,7 +78,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
|
|||
String username = jiraConfiguration.getJiraUserId();
|
||||
String password = jiraConfiguration.getJiraPassword();
|
||||
|
||||
String path = "rest/api/latest/search";
|
||||
String path = JiraRESTClient.PATH_SEARCH;
|
||||
String query = "labels=" + label;
|
||||
|
||||
List<Issue> issues = JiraRESTClient.getIssues(url, username, password,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ import org.libreplan.ws.common.impl.Util;
|
|||
*/
|
||||
public class JiraRESTClient {
|
||||
|
||||
/**
|
||||
* Path for search operation in JIRA REST API
|
||||
*/
|
||||
public static final String PATH_SEARCH = "rest/api/latest/search";
|
||||
|
||||
private static final MediaType[] mediaTypes = new MediaType[] {
|
||||
MediaType.valueOf(MediaType.APPLICATION_JSON),
|
||||
MediaType.valueOf(MediaType.APPLICATION_XML) };
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ public class JiraOrderElementSynchronizerTest {
|
|||
@Autowired
|
||||
private IScenarioManager scenarioManager;
|
||||
|
||||
private static final String PATH = "rest/api/latest/search";
|
||||
private static final String LABEL = "labels=epd_12a_ZorgActiviteiten";
|
||||
|
||||
private List<Issue> issues;
|
||||
|
|
@ -136,7 +135,8 @@ public class JiraOrderElementSynchronizerTest {
|
|||
Properties properties = loadProperties();
|
||||
issues = JiraRESTClient.getIssues(properties.getProperty("url"),
|
||||
properties.getProperty("username"),
|
||||
properties.getProperty("password"), PATH, LABEL);
|
||||
properties.getProperty("password"),
|
||||
JiraRESTClient.PATH_SEARCH, LABEL);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class JiraRESTClientTest {
|
|||
List<Issue> issues = JiraRESTClient.getIssues(
|
||||
properties.getProperty("url"),
|
||||
properties.getProperty("username"),
|
||||
properties.getProperty("password"), "rest/api/latest/search",
|
||||
properties.getProperty("password"), JiraRESTClient.PATH_SEARCH,
|
||||
"labels=Intrasprint");
|
||||
assertTrue(issues.size() > 0);
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ public class JiraRESTClientTest {
|
|||
@Test(expected = RuntimeException.class)
|
||||
public void testGetIssuesForValidLabelButUnAuthorizedUser() {
|
||||
JiraRESTClient.getIssues(properties.getProperty("url"), "", "",
|
||||
"rest/api/latest/search", "labels=Intrasprint");
|
||||
JiraRESTClient.PATH_SEARCH, "labels=Intrasprint");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -86,7 +86,7 @@ public class JiraRESTClientTest {
|
|||
List<Issue> issues = JiraRESTClient.getIssues(
|
||||
properties.getProperty("url"),
|
||||
properties.getProperty("username"),
|
||||
properties.getProperty("password"), "rest/api/latest/search",
|
||||
properties.getProperty("password"), JiraRESTClient.PATH_SEARCH,
|
||||
"");
|
||||
assertTrue(issues.size() > 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ public class JiraTimesheetSynchronizerTest {
|
|||
@Autowired
|
||||
private IScenarioManager scenarioManager;
|
||||
|
||||
private static final String PATH = "rest/api/latest/search";
|
||||
private static final String LABEL = "labels=epd_12a_ZorgActiviteiten";
|
||||
|
||||
private List<Issue> issues;
|
||||
|
|
@ -143,7 +142,8 @@ public class JiraTimesheetSynchronizerTest {
|
|||
Properties properties = loadProperties();
|
||||
issues = JiraRESTClient.getIssues(properties.getProperty("url"),
|
||||
properties.getProperty("username"),
|
||||
properties.getProperty("password"), PATH, LABEL);
|
||||
properties.getProperty("password"),
|
||||
JiraRESTClient.PATH_SEARCH, LABEL);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue