/** * Tears down the fixture * This method is called after a test is executed. * * @access public */ public function tearDown() { Syncroton_Registry::set(Syncroton_Registry::PING_TIMEOUT, 60); Syncroton_Registry::set(Syncroton_Registry::QUIET_TIME, 120); Syncroton_Registry::getTransactionManager()->rollBack(); Syncroton_Registry::getDatabase()->query('delete from syncroton_device'); }
/** * (non-PHPdoc) * @see ActiveSync/ActiveSync_TestCase::setUp() */ protected function setUp() { parent::setUp(); Syncroton_Registry::setDatabase(Tinebase_Core::getDb()); Syncroton_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance()); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set('loggerBackend', Tinebase_Core::getLogger()); Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync'); Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync'); Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync'); Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync'); $this->_device = Syncroton_Registry::getDeviceBackend()->create(ActiveSync_TestCase::getTestDevice()); }
/** * (non-PHPdoc) * @see PHPUnit_Framework_TestCase::setUp() */ protected function setUp() { parent::setUp(); $this->_testUser = Tinebase_Core::getUser(); $this->_specialFolderName = strtolower($this->_applicationName) . '-root'; $this->objects['container'] = array(); $this->objects['devices'] = array(); $this->objects['tasks'] = array(); $this->objects['events'] = array(); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set('loggerBackend', Tinebase_Core::getLogger()); Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync'); Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync'); Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync'); Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync'); }
/** * set up test environment * * @todo move setup to abstract test case */ protected function setUp() { parent::setUp(); $imapConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::IMAP, new Tinebase_Config_Struct())->toArray(); if (empty($imapConfig) || !(isset($imapConfig['useSystemAccount']) || array_key_exists('useSystemAccount', $imapConfig)) || $imapConfig['useSystemAccount'] != true) { $this->markTestSkipped('IMAP backend not configured'); } $this->_testUser = Tinebase_Core::getUser(); $this->_emailTestClass = new Felamimail_Controller_MessageTest(); $this->_emailTestClass->setup(); $this->_createdMessages = new Tinebase_Record_RecordSet('Felamimail_Model_Message'); $this->objects['devices'] = array(); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set('loggerBackend', Tinebase_Core::getLogger()); Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync'); Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync'); Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync'); Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync'); }
if (!defined('WEBROOT_DIR')) { define('WEBROOT_DIR', basename(dirname(__FILE__))); } if (!defined('WWW_ROOT')) { define('WWW_ROOT', dirname(__FILE__) . DS); } if (!defined('CAKE_CORE_INCLUDE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); } if (!(include 'Cake' . DS . 'bootstrap.php')) { $failed = true; } } else { if (!(include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) { $failed = true; } } if (!empty($failed)) { trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); } App::uses('ConnectionManager', 'Model'); Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('default')); Syncroton_Registry::set('loggerBackend', new Syncroton_Log()); Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts'); Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar'); Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks'); Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email'); Syncroton_Registry::setNotesDataClass('Syncroton_Data_Notes'); $server = new Syncroton_Server($_SERVER['PHP_AUTH_USER']); $server->handle();
public static function initSyncrotonRegistry() { Syncroton_Registry::setDatabase(Tinebase_Core::getDb()); Syncroton_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance()); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::LOGGERBACKEND, Tinebase_Core::getLogger()); Syncroton_Registry::set(Syncroton_Registry::SESSION_VALIDATOR, function () { return !Tinebase_Core::inMaintenanceMode(); }); }
/** * addnote method * * @return void */ public function addnote() { App::uses('ConnectionManager', 'Model'); Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('default')); Syncroton_Registry::setNotesDataClass('Syncroton_Data_Notes'); Syncroton_Registry::set('loggerBackend', new Syncroton_Log('lil_active_sync2')); $device = Syncroton_Registry::getDeviceBackend()->getUserDevice('miha', 'ApplC33JKLWDDTWD'); Syncroton_Data_Factory::factory(Syncroton_Data_Factory::CLASS_NOTES, $device, new DateTime(null, new DateTimeZone('utc')))->createEntry('', new Syncroton_Model_Note(array('subject' => 'Second note'))); return new CakeResponse(array('body' => 'success')); }
/** * init registry */ protected function _initializeRegistry() { ActiveSync_Controller::initSyncrotonRegistry(); $applications = is_object(Tinebase_Core::getUser()) ? Tinebase_Core::getUser()->getApplications() : new Tinebase_Record_RecordSet('Tinebase_Model_Application'); if ($applications->find('name', 'Addressbook')) { Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync'); Syncroton_Registry::setGALDataClass('Addressbook_Frontend_ActiveSync'); } if ($applications->find('name', 'Calendar')) { Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync'); } if ($applications->find('name', 'Felamimail')) { Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync'); } if ($applications->find('name', 'Tasks')) { Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync'); } Syncroton_Registry::set(Syncroton_Registry::DEFAULT_POLICY, ActiveSync_Config::getInstance()->get(ActiveSync_Config::DEFAULT_POLICY)); }
* * Example server file * * @package doc * @license http://www.tine20.org/licenses/lgpl.html LGPL Version 3 * @copyright Copyright (c) 2012-2012 Metaways Infosystems GmbH (http://www.metaways.de) * @author Lars Kneschke <*****@*****.**> */ if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Syncroton"'); header('HTTP/1.0 401 Unauthorized'); echo 'Please authenticate!'; exit; } // http://localhost/Microsoft-Server-ActiveSync $paths = array(realpath(dirname(__FILE__) . '/../forbidden/zend1/library/'), realpath(dirname(__FILE__)), realpath(dirname(__FILE__) . '/lib'), get_include_path()); set_include_path(implode(PATH_SEPARATOR, $paths)); require_once 'Zend\\Loader\\Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->setFallbackAutoloader(true); $db = Zend_Db::factory('PDO_MYSQL', array('host' => '127.0.0.1', 'username' => 'root', 'password' => '', 'dbname' => 'syncro')); Syncroton_Registry::setDatabase($db); $writer = new Zend_Log_Writer_Stream(dirname(__FILE__) . '\\syncroton.log'); $writer->addFilter(new Zend_Log_Filter_Priority(Zend_Log::DEBUG)); Syncroton_Registry::set('loggerBackend', new Zend_Log($writer)); Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts'); Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar'); Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks'); #Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email'); $server = new Syncroton_Server($_SERVER['PHP_AUTH_USER']); $server->handle();