/** * TODO review functionality and create ticket */ public function workerMonitorAction() { $config = Zend_Registry::get('Zend_Config'); $this->_helper->layout()->disableLayout(); if (isset($config->runjobs->asynchronous) && $config->runjobs->asynchronous) { $this->view->failedJobCount = Opus_Job::getCount(Opus_Job::STATE_FAILED); } else { $this->view->failedJobCount = 0; } }
public function setUp() { parent::setUp(); $config = Zend_Registry::get('Zend_Config'); $this->__configBackup = $config; $config->merge(new Zend_Config(array('runjobs' => array('asynchronous' => true)))); $this->assertEquals(0, Opus_Job::getCount(Opus_Job::STATE_FAILED), 'test data changed.'); for ($i = 0; $i < 10; $i++) { $job = new Opus_Job(); $job->setLabel('testjob' . ($i < 5 ? 1 : 2)); $job->setData(array('documentId' => $i, 'task' => 'get-me-a-coffee')); $job->setState(Opus_Job::STATE_FAILED); $this->jobIds[] = $job->store(); } }
public function testCreateWorkerJobIfAsyncEnabled() { $this->config->merge(new Zend_Config(array('runjobs' => array('asynchronous' => 1)))); $this->assertEquals(0, Opus_Job::getCount(), 'test data changed.'); $doc = $this->createTestDocument(); $doc->setLanguage("eng"); $title = new Opus_Title(); $title->setValue("Test Document"); $title->setLanguage("eng"); $doc->addTitleMain($title); $doc->store(); $this->notification->prepareMail($doc, Application_Util_Notification::SUBMISSION, 'http://localhost/foo/1'); $mailJobs = Opus_Job::getByLabels(array(Opus_Job_Worker_MailNotification::LABEL)); $this->assertEquals(1, count($mailJobs), 'Expected 1 mail job'); $jobs = Opus_Job::getAll(); if (!empty($jobs)) { foreach ($jobs as $job) { $job->delete(); } } }