@SuppressWarnings("ConstantConditions") private void changeStateAndCheck(String url, String key) throws Exception { myRepository.setUrl(url); Task task = myRepository.findTask(key); try { myRepository.setTaskState(task, TaskState.IN_PROGRESS); task = myRepository.findTask(key); assertEquals(task.getState(), TaskState.IN_PROGRESS); myRepository.setTaskState(task, TaskState.RESOLVED); task = myRepository.findTask(key); assertEquals(task.getState(), TaskState.RESOLVED); myRepository.setTaskState(task, TaskState.REOPENED); assertEquals(myRepository.findTask(key).getState(), TaskState.REOPENED); } catch (Exception e) { // always attempt to restore original state of the issue try { // transition to Resolved state usually is possible from any other myRepository.setTaskState(task, TaskState.RESOLVED); } catch (Exception ignored) { } try { myRepository.setTaskState(task, TaskState.REOPENED); } catch (Exception ignored) { } throw e; } }
@Override public void setUp() throws Exception { super.setUp(); TaskSettings.getInstance().CONNECTION_TIMEOUT = 10000; myRepository = new JiraRepository(new JiraRepositoryType()); myRepository.setUrl(JIRA_5_TEST_SERVER_URL); myRepository.setUsername("buildtest"); myRepository.setPassword("buildtest"); }
public void testVersionDiscovery() throws Exception { myRepository.setUrl(JIRA_5_TEST_SERVER_URL); assertEquals("2.0", myRepository.discoverRestApiVersion().getVersionName()); myRepository.setUrl(JIRA_4_TEST_SERVER_URL); assertEquals("2.0.alpha1", myRepository.discoverRestApiVersion().getVersionName()); }