/src/main/resources/com/onresolve/jira/groovy/test/TestResolveParentAfterSubtasks.groovy
Groovy | 85 lines | 53 code | 20 blank | 12 comment | 0 complexity | 713f1cb4e349e85d617868533a8962bd MD5 | raw file
- package com.onresolve.jira.groovy.test
-
- import com.atlassian.jira.issue.MutableIssue
-
- import org.apache.log4j.Category
- import org.junit.After
- import org.junit.Before
- import org.junit.Test
-
- import static junit.framework.Assert.*
- import com.onresolve.jira.groovy.canned.workflow.postfunctions.ResolveParentAfterSubtasks
-
- /**
- * User: jechlin2
- * Date: 13-Dec-2010
- * Time: 17:36:00
- */
- class TestResolveParentAfterSubtasks extends BaseSubTaskTest {
-
- Category log = Category.getInstance(this.class)
-
- TestResolveParentAfterSubtasks() {
- // def gcl = this.class.classLoader.parent
- // gcl.clearCache()
- }
-
- @Before
- public void setUp() {
- log.debug("delete all nmw")
- tearDown()
-
- log.debug ("setUp")
-
- log.debug ("issueType: ${issueType.getName()}")
- log.debug ("project: $project")
- assertNotNull(project)
-
- issue = componentManager.getIssueFactory().getIssue()
- issue.setProject(project.getGenericValue())
- issue.setSummary "my summary"
- issue.setReporterId "admin"
- issue.setAssigneeId "admin"
- issue.setIssueType issueType.getGenericValue()
- log.debug (project)
- issueManager.createIssue(adminUser, issue);
- }
-
-
- // @After
- public void tearDown() {
- deleteAllIssues();
- }
-
- @Test
- public void testResolveParent() {
- // test with one sub-task not resolved
-
- MutableIssue subtask = createSubTask(issue) as MutableIssue
- MutableIssue subtask2 = createSubTask(issue) as MutableIssue
-
- Map inputParams = [
- issue: subtask,
- (ResolveParentAfterSubtasks.FIELD_PARENTACTION): '5 Resolve Issue',
- (ResolveParentAfterSubtasks.FIELD_RESOLUTION_ID): '1',
- ] as Map<String, Object>
-
- log.debug ("issue.statusId: ${issue.statusId}")
- assertEquals('1', issueManager.getIssueObject(issue.getKey()).statusId)
-
- new ResolveParentAfterSubtasks().doScript(inputParams)
- // Parent should still be open with no subtasks resolved
- assertEquals('1', issueManager.getIssueObject(issue.getKey()).statusId)
-
- resolveIssue(subtask)
- new ResolveParentAfterSubtasks().doScript(inputParams)
- // Parent should still be open after resolving one subtask
- assertEquals('1', issueManager.getIssueObject(issue.getKey()).statusId)
-
- resolveIssue(subtask2)
- new ResolveParentAfterSubtasks().doScript(inputParams)
- // Parent should still be closed after resolving both subtasks
- assertEquals('5', issueManager.getIssueObject(issue.getKey()).statusId)
-
- }
- }