-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCampfireListenerTests.groovy
48 lines (38 loc) · 1.49 KB
/
CampfireListenerTests.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import groovy.util.GroovyTestCase
import com.atlassian.jira.event.AbstractEvent
import com.atlassian.jira.event.issue.IssueEvent
//import org.ofbiz.core.util.GeneralException
import static com.atlassian.jira.event.type.EventType.*
class CampfireListenerTests extends GroovyTestCase{
def getCampfireListener(){
def cfListener = new CampfireListener();
cfListener.campfireKey=""
cfListener.campfireRoom=000000
cfListener.campfireBaseUrl="https://COMPANY.campfirenow.com/"
cfListener.issueBaseUrl="http://jira.COMPANY.com/"
return cfListener;
}
def getStandardIssueEvent(Long eventType){
def mIssue = new MockIssue()
mIssue.key = "MOCK-001"
mIssue.summary = "Mock Summary"
mIssue.description = "Mock description"
def mUser = new MockUser()
mUser.setDisplayName("Mock User")
def mWorklog = new MockWorklog()
def mComment = new MockComment()
mComment.body = "Mock Comment"
// org.ofbiz.core.entity.GenericValue mChangeGroup = null
// def issueEvent = new IssueEvent(mIssue, mUser, mComment, mWorklog, null, new java.util.HashMap(), eventType)
def issueEvent = new IssueEvent(mIssue, new java.util.HashMap(), mUser, eventType)
return issueEvent
}
void testIssueCommentToCampfire(){
def cfListener = getCampfireListener()
cfListener.processIssueEvent(getStandardIssueEvent(ISSUE_COMMENTED_ID))
}
void testIssueCreatedToCampfire(){
def cfListener = getCampfireListener()
cfListener.processIssueEvent(getStandardIssueEvent(ISSUE_CREATED_ID))
}
}