PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/CampfireListenerTests.groovy

http://github.com/plytro/jira-campfire
Groovy | 48 lines | 35 code | 10 blank | 3 comment | 0 complexity | e6f14a486fa4fef62b0c9f1b67ec109d MD5 | raw file
  1. import groovy.util.GroovyTestCase
  2. import com.atlassian.jira.event.AbstractEvent
  3. import com.atlassian.jira.event.issue.IssueEvent
  4. //import org.ofbiz.core.util.GeneralException
  5. import static com.atlassian.jira.event.type.EventType.*
  6. class CampfireListenerTests extends GroovyTestCase{
  7. def getCampfireListener(){
  8. def cfListener = new CampfireListener();
  9. cfListener.campfireKey=""
  10. cfListener.campfireRoom=000000
  11. cfListener.campfireBaseUrl="https://COMPANY.campfirenow.com/"
  12. cfListener.issueBaseUrl="http://jira.COMPANY.com/"
  13. return cfListener;
  14. }
  15. def getStandardIssueEvent(Long eventType){
  16. def mIssue = new MockIssue()
  17. mIssue.key = "MOCK-001"
  18. mIssue.summary = "Mock Summary"
  19. mIssue.description = "Mock description"
  20. def mUser = new MockUser()
  21. mUser.setDisplayName("Mock User")
  22. def mWorklog = new MockWorklog()
  23. def mComment = new MockComment()
  24. mComment.body = "Mock Comment"
  25. // org.ofbiz.core.entity.GenericValue mChangeGroup = null
  26. // def issueEvent = new IssueEvent(mIssue, mUser, mComment, mWorklog, null, new java.util.HashMap(), eventType)
  27. def issueEvent = new IssueEvent(mIssue, new java.util.HashMap(), mUser, eventType)
  28. return issueEvent
  29. }
  30. void testIssueCommentToCampfire(){
  31. def cfListener = getCampfireListener()
  32. cfListener.processIssueEvent(getStandardIssueEvent(ISSUE_COMMENTED_ID))
  33. }
  34. void testIssueCreatedToCampfire(){
  35. def cfListener = getCampfireListener()
  36. cfListener.processIssueEvent(getStandardIssueEvent(ISSUE_CREATED_ID))
  37. }
  38. }