def test_GT_1528(self): importDataDict = {TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl} threadJobObj = ThreadJob( backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict, TEST_serviceName ) # Assert commented due to https://geo2tag.atlassian.net/browse/GT-1832 # self.assertFalse(threadJobObj.done) threadJobObj.internalStart()
def test_GT_1528(self): importDataDict = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl } threadJobObj = ThreadJob(backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict, TEST_serviceName) # Assert commented due to https://geo2tag.atlassian.net/browse/GT-1832 # self.assertFalse(threadJobObj.done) threadJobObj.internalStart()
def test_GT_1506_class_thread_job(self): importDataDict_val = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl } threadJobObj = ThreadJob(backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict_val, TEST_serviceName) threadJobObj.start() self.assertTrue(threadJobObj.thread.is_alive()) threadJobObj.stop() while threadJobObj.thread.is_alive() is True: sleep(0.1) self.assertFalse(threadJobObj.thread.is_alive()) self.assertTrue(threadJobObj.done) statistic = threadJobObj.getTimeStatistics() self.assertEquals(type(statistic), type(datetime.timedelta())) describe = threadJobObj.describe() self.assertEquals(len(describe.get('_id')), 12) self.assertEquals(len(describe.get('time')), 14) self.assertEquals(describe.get('done'), True) self.assertEquals(describe.get('channelName'), TEST_channelName) self.assertEquals(describe.get('openDataUrl'), TEST_openDataUrl) self.assertEquals(describe.get('showImageUrl'), TEST_showImageUrl) self.assertEquals(describe.get('showObjectUrl'), TEST_showObjectUrl) self.assertEquals(describe.get('serviceName'), TEST_serviceName) self.assertEquals(threadJobObj.channelName, TEST_channelName) self.assertEquals(threadJobObj.openDataUrl, TEST_openDataUrl) self.assertEquals(threadJobObj.importDataDict.get('showImageUrl'), TEST_showImageUrl) self.assertEquals(threadJobObj.importDataDict.get('showObjectUrl'), TEST_showObjectUrl) self.assertEquals(threadJobObj.serviceName, TEST_serviceName)
def test_GT_1544(self): importDataDict = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl} threadJobObj = ThreadJob( backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict, TEST_serviceName) threadJobObj.start() while not threadJobObj.done: sleep(0.1) time1 = threadJobObj.describe().get('time') sleep(0.05) time2 = threadJobObj.describe().get('time') self.assertEquals(time1, time2)
def test_GT_1507_class_job_manager(self): importDataDict = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl} threadJobObj = ThreadJob( backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict, TEST_serviceName) threadJobObj.start() manager = JobManager() jobId = manager.startJob(threadJobObj) self.assertEquals(len(jobId), 12) self.assertEquals(type(manager.getJob(jobId)), dict) manager.stopJob(jobId) self.assertEquals(threadJobObj.done, True) self.assertEquals(type(manager.getJobs()), list) threadJobObj.stop()
def test_GT_1544(self): importDataDict = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl } threadJobObj = ThreadJob(backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict, TEST_serviceName) threadJobObj.start() while not threadJobObj.done: sleep(0.1) time1 = threadJobObj.describe().get('time') sleep(0.05) time2 = threadJobObj.describe().get('time') self.assertEquals(time1, time2)
def test_GT_1507_class_job_manager(self): importDataDict = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl } threadJobObj = ThreadJob(backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict, TEST_serviceName) threadJobObj.start() manager = JobManager() jobId = manager.startJob(threadJobObj) self.assertEquals(len(jobId), 12) self.assertEquals(type(manager.getJob(jobId)), dict) manager.stopJob(jobId) self.assertEquals(threadJobObj.done, True) self.assertEquals(type(manager.getJobs()), list) threadJobObj.stop()
def test_GT_1506_class_thread_job(self): importDataDict_val = { TEST_showImageUrl: TEST_showImageUrl, TEST_showObjectUrl: TEST_showObjectUrl} threadJobObj = ThreadJob( backgroundFunction, TEST_channelName, TEST_openDataUrl, importDataDict_val, TEST_serviceName) threadJobObj.start() self.assertTrue(threadJobObj.thread.is_alive()) threadJobObj.stop() while threadJobObj.thread.is_alive() is True: sleep(0.1) self.assertFalse(threadJobObj.thread.is_alive()) self.assertTrue(threadJobObj.done) statistic = threadJobObj.getTimeStatistics() self.assertEquals(type(statistic), type(datetime.timedelta())) describe = threadJobObj.describe() self.assertEquals(len(describe.get('_id')), 12) self.assertEquals(len(describe.get('time')), 14) self.assertEquals(describe.get('done'), True) self.assertEquals(describe.get('channelName'), TEST_channelName) self.assertEquals(describe.get('openDataUrl'), TEST_openDataUrl) self.assertEquals(describe.get('showImageUrl'), TEST_showImageUrl) self.assertEquals(describe.get('showObjectUrl'), TEST_showObjectUrl) self.assertEquals(describe.get('serviceName'), TEST_serviceName) self.assertEquals(threadJobObj.channelName, TEST_channelName) self.assertEquals(threadJobObj.openDataUrl, TEST_openDataUrl) self.assertEquals( threadJobObj.importDataDict.get('showImageUrl'), TEST_showImageUrl) self.assertEquals( threadJobObj.importDataDict.get('showObjectUrl'), TEST_showObjectUrl) self.assertEquals(threadJobObj.serviceName, TEST_serviceName)