/** * The class constructor method, to be used by child implementations. */ function __construct() { // Set the bucket processing strategy, based on the type. $dbType = $GLOBALS['_MAX']['CONF']['database']['type']; if ($this->type == 'aggregate') { $this->oProcessingStrategy = OX_Extension_DeliveryLog_BucketProcessingStrategyFactory::getAggregateBucketProcessingStrategy($dbType); } else { $this->oProcessingStrategy = OX_Extension_DeliveryLog_BucketProcessingStrategyFactory::getRawBucketProcessingStrategy($dbType); } }
/** * The method to test the factory's getAggregateBucketProcessingStrategy() * methiod. */ function testGetAggregateBucketProcessingStrategy() { $aConf =& $GLOBALS['_MAX']['CONF']; // Test the creation of an edge/aggregate server MySQL strategy class $aConf['lb']['enabled'] = true; $aConf['database']['type'] = 'mysql'; $oProcessingStrategy = OX_Extension_DeliveryLog_BucketProcessingStrategyFactory::getAggregateBucketProcessingStrategy($aConf['database']['type']); $this->assertTrue(is_a($oProcessingStrategy, 'OX_Extension_DeliveryLog_AggregateBucketProcessingStrategyMysql')); $aConf['database']['type'] = 'pgsql'; $oProcessingStrategy = OX_Extension_DeliveryLog_BucketProcessingStrategyFactory::getAggregateBucketProcessingStrategy($aConf['database']['type']); $this->assertTrue(is_a($oProcessingStrategy, 'OX_Extension_DeliveryLog_AggregateBucketProcessingStrategyPgsql')); // Restore the configuration file TestEnv::restoreConfig(); }