PageRenderTime 1015ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/resources/com/onresolve/jira/groovy/test/TestResolveParentAfterSubtasks.groovy

https://bitbucket.org/sorin/jira-plugin-intellij
Groovy | 85 lines | 53 code | 20 blank | 12 comment | 0 complexity | 713f1cb4e349e85d617868533a8962bd MD5 | raw file
  1. package com.onresolve.jira.groovy.test
  2. import com.atlassian.jira.issue.MutableIssue
  3. import org.apache.log4j.Category
  4. import org.junit.After
  5. import org.junit.Before
  6. import org.junit.Test
  7. import static junit.framework.Assert.*
  8. import com.onresolve.jira.groovy.canned.workflow.postfunctions.ResolveParentAfterSubtasks
  9. /**
  10. * User: jechlin2
  11. * Date: 13-Dec-2010
  12. * Time: 17:36:00
  13. */
  14. class TestResolveParentAfterSubtasks extends BaseSubTaskTest {
  15. Category log = Category.getInstance(this.class)
  16. TestResolveParentAfterSubtasks() {
  17. // def gcl = this.class.classLoader.parent
  18. // gcl.clearCache()
  19. }
  20. @Before
  21. public void setUp() {
  22. log.debug("delete all nmw")
  23. tearDown()
  24. log.debug ("setUp")
  25. log.debug ("issueType: ${issueType.getName()}")
  26. log.debug ("project: $project")
  27. assertNotNull(project)
  28. issue = componentManager.getIssueFactory().getIssue()
  29. issue.setProject(project.getGenericValue())
  30. issue.setSummary "my summary"
  31. issue.setReporterId "admin"
  32. issue.setAssigneeId "admin"
  33. issue.setIssueType issueType.getGenericValue()
  34. log.debug (project)
  35. issueManager.createIssue(adminUser, issue);
  36. }
  37. // @After
  38. public void tearDown() {
  39. deleteAllIssues();
  40. }
  41. @Test
  42. public void testResolveParent() {
  43. // test with one sub-task not resolved
  44. MutableIssue subtask = createSubTask(issue) as MutableIssue
  45. MutableIssue subtask2 = createSubTask(issue) as MutableIssue
  46. Map inputParams = [
  47. issue: subtask,
  48. (ResolveParentAfterSubtasks.FIELD_PARENTACTION): '5 Resolve Issue',
  49. (ResolveParentAfterSubtasks.FIELD_RESOLUTION_ID): '1',
  50. ] as Map<String, Object>
  51. log.debug ("issue.statusId: ${issue.statusId}")
  52. assertEquals('1', issueManager.getIssueObject(issue.getKey()).statusId)
  53. new ResolveParentAfterSubtasks().doScript(inputParams)
  54. // Parent should still be open with no subtasks resolved
  55. assertEquals('1', issueManager.getIssueObject(issue.getKey()).statusId)
  56. resolveIssue(subtask)
  57. new ResolveParentAfterSubtasks().doScript(inputParams)
  58. // Parent should still be open after resolving one subtask
  59. assertEquals('1', issueManager.getIssueObject(issue.getKey()).statusId)
  60. resolveIssue(subtask2)
  61. new ResolveParentAfterSubtasks().doScript(inputParams)
  62. // Parent should still be closed after resolving both subtasks
  63. assertEquals('5', issueManager.getIssueObject(issue.getKey()).statusId)
  64. }
  65. }