示例#1
0
 def testCreateSonarEventAndPickle(self):
     sonar_event = SonarEvent("OMG, something happened!", EventJudgement.grave, ["jalie"], "PRTR", 80.5, 15)
     self.assertEquals(sonar_event.violations, 15)
     self.assertEquals(sonar_event.coverage, 80.5)
     sonar_json_event = sonar_event.pickle()
     unpickled_sonar_event = Event.unpickle(sonar_json_event)
     self.assertTrue(type(sonar_event) == type(unpickled_sonar_event))
     self.assertEquals(unpickled_sonar_event.violations, 15)
     self.assertEquals(unpickled_sonar_event.coverage, 80.5)
示例#2
0
 def testCreateBambooEventAndPickle(self):
     bamboo_event = BambooEvent("OMG, something happened!", EventJudgement.deteriorating, ["jalie"], "PRTR",
                                BambooBuildState.FAILED, 2000)
     self.assertEquals(bamboo_event.build_state, BambooBuildState.FAILED)
     self.assertEquals(bamboo_event.tests, 2000)
     bamboo_json_event = bamboo_event.pickle()
     unpickled_bamboo_event = Event.unpickle(bamboo_json_event)
     self.assertTrue(type(bamboo_event) == type(unpickled_bamboo_event))
     self.assertEquals(bamboo_event.build_state, BambooBuildState.FAILED)
     self.assertEquals(bamboo_event.tests, 2000)
示例#3
0
 def getEventStream(self):
     try:
         events = []
         event_keys = self.redis.keys(RedisRepo.EVENTS_HASH_KEY_PREFIX + '*')
         event_keys.sort()
         for event_key in event_keys:
             pickled_event = self.redis.get(event_key)
             if pickled_event is not None:
                 events.append(Event.unpickle(pickled_event))
         return events
     except redis.RedisError, e:
         raise RedisException({"message": "Could not retrieve EventStream from Redis!", "cause": e.__str__()})