/** * Creates a new delivery * * @param core_kernel_classes_Class $deliveryClass * @param core_kernel_classes_Resource $test * @param array $properties Array of properties of delivery * @return common_report_Report */ public static function create(\core_kernel_classes_Class $deliveryClass, \core_kernel_classes_Resource $test, $properties = array()) { \common_Logger::i('Creating delivery with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel()); $storage = new TrackedStorage(); $testCompilerClass = \taoTests_models_classes_TestsService::singleton()->getCompilerClass($test); $compiler = new $testCompilerClass($test, $storage); $report = $compiler->compile(); if ($report->getType() == \common_report_Report::TYPE_SUCCESS) { //$tz = new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone()); $tz = new \DateTimeZone('UTC'); if (!empty($properties[TAO_DELIVERY_START_PROP])) { $dt = new \DateTime($properties[TAO_DELIVERY_START_PROP], $tz); $properties[TAO_DELIVERY_START_PROP] = (string) $dt->getTimestamp(); } if (!empty($properties[TAO_DELIVERY_END_PROP])) { $dt = new \DateTime($properties[TAO_DELIVERY_END_PROP], $tz); $properties[TAO_DELIVERY_END_PROP] = (string) $dt->getTimestamp(); } $serviceCall = $report->getData(); $properties[PROPERTY_COMPILEDDELIVERY_DIRECTORY] = $storage->getSpawnedDirectoryIds(); $compilationInstance = DeliveryAssemblyService::singleton()->createAssemblyFromServiceCall($deliveryClass, $serviceCall, $properties); $report->setData($compilationInstance); } return $report; }
/** * Creates a new simple delivery * * @param core_kernel_classes_Class $deliveryClass * @param core_kernel_classes_Resource $test * @param string $label * @return common_report_Report */ public static function create(core_kernel_classes_Class $deliveryClass, core_kernel_classes_Resource $test, $label) { \common_Logger::i('Creating ' . $label . ' with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel()); $storage = new TrackedStorage(); $testCompilerClass = \taoTests_models_classes_TestsService::singleton()->getCompilerClass($test); $compiler = new $testCompilerClass($test, $storage); $report = $compiler->compile(); if ($report->getType() == \common_report_Report::TYPE_SUCCESS) { $serviceCall = $report->getData(); $properties = array(RDFS_LABEL => $label, PROPERTY_COMPILEDDELIVERY_DIRECTORY => $storage->getSpawnedDirectoryIds(), DeliveryAssemblyService::PROPERTY_ORIGIN => $test); $compilationInstance = DeliveryAssemblyService::singleton()->createAssemblyFromServiceCall($deliveryClass, $serviceCall, $properties); $report->setData($compilationInstance); } return $report; }