public function setUp() { TaoPhpUnitTestRunner::initTest(); $this->disableCache(); // creates a user using remote script from joel $testUserData = array(PROPERTY_USER_LOGIN => 'tjdoe', PROPERTY_USER_PASSWORD => 'test123', PROPERTY_USER_LASTNAME => 'Doe', PROPERTY_USER_FIRSTNAME => 'John', PROPERTY_USER_MAIL => '*****@*****.**', PROPERTY_USER_DEFLG => \tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri(), PROPERTY_USER_UILG => \tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri(), PROPERTY_USER_ROLES => array(INSTANCE_ROLE_GLOBALMANAGER)); $testUserData[PROPERTY_USER_PASSWORD] = 'test' . rand(); $data = $testUserData; $data[PROPERTY_USER_PASSWORD] = \core_kernel_users_Service::getPasswordHash()->encrypt($data[PROPERTY_USER_PASSWORD]); $tmclass = new \core_kernel_classes_Class(CLASS_TAO_USER); $user = $tmclass->createInstanceWithProperties($data); \common_Logger::i('Created user ' . $user->getUri()); // prepare a lookup table of languages and values $usage = new \core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_GUI); $propValue = new \core_kernel_classes_Property(RDF_VALUE); $langService = \tao_models_classes_LanguageService::singleton(); $lookup = array(); foreach ($langService->getAvailableLanguagesByUsage($usage) as $lang) { $lookup[$lang->getUri()] = (string) $lang->getUniquePropertyValue($propValue); } $data = array('rootUrl' => ROOT_URL, 'userUri' => $user->getUri(), 'userData' => $testUserData, 'lang' => $lookup); $this->login = $data['userData'][PROPERTY_USER_LOGIN]; $this->password = $data['userData'][PROPERTY_USER_PASSWORD]; $this->userUri = $data['userUri']; }
/** * tests initialization */ public function setUp() { TaoPhpUnitTestRunner::initTest(); $oauthClass = new core_kernel_classes_Class(CLASS_OAUTH_CONSUMER); $resource = $oauthClass->createInstanceWithProperties(array(PROPERTY_OAUTH_KEY => 'test_key', PROPERTY_OAUTH_SECRET => md5(rand()))); $this->oauthCustomer = new tao_models_classes_oauth_Credentials($resource); }
/** * Get repeated delivery by parent delivery instance and number of repetition. * @param \core_kernel_classes_Resource $delivery * @param integer $numberOfRepetition * @param boolean $createNew If repeated delivery is not exists then new instance will be created. * @return \core_kernel_classes_Resource|false */ public function getDelivery(\core_kernel_classes_Resource $delivery, $numberOfRepetition, $createNew = false) { $rrule = $delivery->getOnePropertyValue(new \core_kernel_classes_Property(DeliveryScheduleService::TAO_DELIVERY_RRULE_PROP)); if ($rrule === null) { throw new \InvalidArgumentException('Delivery has no recurrence rule'); } else { $rrule = (string) $rrule; } $rule = new \Recurr\Rule($rrule); $transformer = new \Recurr\Transformer\ArrayTransformer(); $rEvents = $transformer->transform($rule); if (!isset($rEvents[$numberOfRepetition])) { throw new \InvalidArgumentException('Delivery has no recurrence number ' . $numberOfRepetition); } $repeatedDeliveryClass = new \core_kernel_classes_Class(self::CLASS_URI); $resources = $repeatedDeliveryClass->searchInstances(array(self::PROPERTY_REPETITION_OF => $delivery->getUri(), self::PROPERTY_NUMBER_OF_REPETITION => $numberOfRepetition), array('like' => false)); if (empty($resources) && $createNew) { $repeatedDeliveryClass = new \core_kernel_classes_Class(self::CLASS_URI); $repeatedDeliveryProperties = array(self::PROPERTY_REPETITION_OF => $delivery->getUri(), self::PROPERTY_NUMBER_OF_REPETITION => $numberOfRepetition); $repeatedDelivery = $repeatedDeliveryClass->createInstanceWithProperties($repeatedDeliveryProperties); } else { $repeatedDelivery = current($resources); } return $repeatedDelivery; }
public static function importDelivery(core_kernel_classes_Class $deliveryClass, $archiveFile) { $folder = tao_helpers_File::createTempDir(); $zip = new ZipArchive(); if ($zip->open($archiveFile) === true) { if ($zip->extractTo($folder)) { $returnValue = $folder; } $zip->close(); } $manifestPath = $folder . self::MANIFEST_FILE; if (!file_exists($manifestPath)) { return common_report_Report::createFailure(__('Manifest not found in assembly')); } $manifest = json_decode(file_get_contents($manifestPath), true); $label = $manifest['label']; $serviceCall = tao_models_classes_service_ServiceCall::fromString(base64_decode($manifest['runtime'])); $dirs = $manifest['dir']; $resultServer = taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer(); try { foreach ($dirs as $id => $relPath) { tao_models_classes_service_FileStorage::singleton()->import($id, $folder . $relPath); } $delivery = $deliveryClass->createInstanceWithProperties(array(RDFS_LABEL => $label, PROPERTY_COMPILEDDELIVERY_DIRECTORY => array_keys($dirs), PROPERTY_COMPILEDDELIVERY_TIME => time(), PROPERTY_COMPILEDDELIVERY_RUNTIME => $serviceCall->toOntology(), TAO_DELIVERY_RESULTSERVER_PROP => $resultServer)); $report = common_report_Report::createSuccess(__('Delivery "%s" successfully imported', $label), $delivery); } catch (Exception $e) { if (isset($delivery) && $delivery instanceof core_kernel_classes_Resource) { $delivery->delete(); } $report = common_report_Report::createFailure(__('Unkown error during impoort')); } return $report; }
public function setUp() { parent::setUp(); TaoPhpUnitTestRunner::initTest(); $class = new core_kernel_classes_Class(CLASS_OAUTH_CONSUMER); $this->credentials = $class->createInstanceWithProperties(array(RDFS_LABEL => 'test_credentials', PROPERTY_OAUTH_KEY => 'testcase_12345', PROPERTY_OAUTH_SECRET => 'secret_12345')); }
protected function importDeliveryResource(core_kernel_classes_Class $deliveryClass, $manifest) { $label = $manifest['label']; $dirs = $manifest['dir']; $serviceCall = tao_models_classes_service_ServiceCall::fromString(base64_decode($manifest['runtime'])); $resultServer = taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer(); $delivery = $deliveryClass->createInstanceWithProperties(array(RDFS_LABEL => $label, PROPERTY_COMPILEDDELIVERY_DIRECTORY => array_keys($dirs), PROPERTY_COMPILEDDELIVERY_TIME => time(), PROPERTY_COMPILEDDELIVERY_RUNTIME => $serviceCall->toOntology(), TAO_DELIVERY_RESULTSERVER_PROP => $resultServer)); return $delivery; }
/** * 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 function create(core_kernel_classes_Class $deliveryClass, core_kernel_classes_Resource $test, $label) { common_Logger::i('Creating ' . $label . ' with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel()); $contentClass = new core_kernel_classes_Class(CLASS_SIMPLE_DELIVERYCONTENT); $content = $contentClass->createInstanceWithProperties(array(PROPERTY_DELIVERYCONTENT_TEST => $test->getUri())); $report = TemplateAssemblyService::singleton()->createAssemblyByContent($deliveryClass, $content, array(RDFS_LABEL => $label)); $content->delete(); return $report; }
public static function generateTesttakers($count = 1000) { $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoGroups'); $topClass = new \core_kernel_classes_Class(TAO_SUBJECT_CLASS); $role = new \core_kernel_classes_Resource(INSTANCE_ROLE_DELIVERY); $class = self::generateUsers($count, $topClass, $role, 'Test-Taker ', 'tt'); $groupClass = new \core_kernel_classes_Class(TAO_GROUP_CLASS); $group = $groupClass->createInstanceWithProperties(array(RDFS_LABEL => $class->getLabel(), TAO_GROUP_MEMBERS_PROP => $class->getInstances())); return $class; }
public function createAssemblyFromServiceCall(core_kernel_classes_Class $deliveryClass, tao_models_classes_service_ServiceCall $serviceCall, $properties = array()) { $properties[PROPERTY_COMPILEDDELIVERY_TIME] = time(); $properties[PROPERTY_COMPILEDDELIVERY_RUNTIME] = $serviceCall->toOntology(); if (!isset($properties[TAO_DELIVERY_RESULTSERVER_PROP])) { $properties[TAO_DELIVERY_RESULTSERVER_PROP] = taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer(); } $compilationInstance = $deliveryClass->createInstanceWithProperties($properties); return $compilationInstance; }
private function buildCompiledDelivery(core_kernel_classes_Resource $delivery, core_kernel_classes_Resource $workflow) { $directory = $this->getCompilationDirectory($delivery); $this->replaceItemRunner($workflow, $directory); $serviceCall = new tao_models_classes_service_ServiceCall(new core_kernel_classes_Resource(INSTANCE_SERVICE_PROCESSRUNNER)); $param = new tao_models_classes_service_ConstantParameter(new core_kernel_classes_Resource(INSTANCE_FORMALPARAM_PROCESSDEFINITION), $workflow); $serviceCall->addInParameter($param); $compilationClass = new core_kernel_classes_Class(CLASS_COMPILEDDELIVERY); $compilationInstance = $compilationClass->createInstanceWithProperties(array(RDFS_LABEL => $delivery->getLabel(), PROPERTY_COMPILEDDELIVERY_DELIVERY => $delivery, PROPERTY_COMPILEDDELIVERY_FOLDER => $directory, PROPERTY_COMPILEDDELIVERY_TIME => time(), PROPERTY_COMPILEDDELIVERY_RUNTIME => $serviceCall->toOntology())); return $compilationInstance; }
/** * Short description of method create * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param Class type * @param string label * @param string comment * @return core_kernel_classes_Resource */ public static function create(core_kernel_classes_Class $type, $label = '', $comment = '') { $returnValue = null; $propertiesValues = array(); if (!empty($label)) { $propertiesValues[RDFS_LABEL] = $label; } if (!empty($comment)) { $propertiesValues[RDFS_COMMENT] = $comment; } $returnValue = $type->createInstanceWithProperties($propertiesValues); return $returnValue; }
/** * initialize a test method */ public function setUp() { parent::setUp(); $login = '******'; $userData = array(PROPERTY_USER_LOGIN => $login, PROPERTY_USER_PASSWORD => core_kernel_users_Service::getPasswordHash()->encrypt($this->userPassword), PROPERTY_USER_DEFLG => 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . DEFAULT_LANG, PROPERTY_USER_UILG => 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . DEFAULT_LANG, PROPERTY_USER_ROLES => INSTANCE_ROLE_WORKFLOW); if (!$this->userService->loginAvailable($login)) { $this->fail('test login already taken'); } $userClass = new core_kernel_classes_Class(CLASS_WORKFLOWUSER); $this->currentUser = $userClass->createInstanceWithProperties($userData); $this->currentUser0 = $this->currentUser; $this->service = wfEngine_models_classes_ActivityExecutionService::singleton(); }
/** * creates a new FileSystem * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param Resource type * @param string url * @param string login * @param string password * @param string path * @param string label * @param boolean enabled * @return core_kernel_versioning_Repository */ public static function createFileSystem(core_kernel_classes_Resource $type, $url, $login, $password, $path, $label, $enabled = false) { $path = rtrim($path, "\\/") . DIRECTORY_SEPARATOR; if (!file_exists($path)) { if (!mkdir($path, 0700, true)) { throw new common_exception_Error("Could not create path '" . $path . "' for filesystem '" . $label . "'"); } } $versioningRepositoryClass = new core_kernel_classes_Class(CLASS_GENERIS_VERSIONEDREPOSITORY); $resource = $versioningRepositoryClass->createInstanceWithProperties(array(RDFS_LABEL => $label, PROPERTY_GENERIS_VERSIONEDREPOSITORY_URL => $url, PROPERTY_GENERIS_VERSIONEDREPOSITORY_PATH => $path, PROPERTY_GENERIS_VERSIONEDREPOSITORY_TYPE => $type, PROPERTY_GENERIS_VERSIONEDREPOSITORY_LOGIN => $login, PROPERTY_GENERIS_VERSIONEDREPOSITORY_PASSWORD => $password, PROPERTY_GENERIS_VERSIONEDREPOSITORY_ENABLED => $enabled ? GENERIS_TRUE : GENERIS_FALSE)); core_kernel_fileSystem_Cache::flushCache(); return new core_kernel_fileSystem_FileSystem($resource); }
public function setUp() { TaoPhpUnitTestRunner::initTest(); $this->disableCache(); // creates a user using remote script from joel $userdata = $this->getUserData(); $password = $userdata[PROPERTY_USER_PASSWORD]; $userdata[PROPERTY_USER_PASSWORD] = \core_kernel_users_Service::getPasswordHash()->encrypt($userdata[PROPERTY_USER_PASSWORD]); $tmclass = new \core_kernel_classes_Class(CLASS_TAO_USER); $user = $tmclass->createInstanceWithProperties($userdata); \common_Logger::i('Created user ' . $user->getUri()); $this->login = $userdata[PROPERTY_USER_LOGIN]; $this->password = $password; $this->userUri = $user->getUri(); }
/** * creates a new cardinality resource that links to "step" * * @access public * @author Joel Bout, <*****@*****.**> * @param Resource step * @param int cardinality * @return core_kernel_classes_Resource */ public function createCardinality(core_kernel_classes_Resource $step, $cardinality = 1) { $returnValue = null; $cardinalityValue = null; if (is_numeric($cardinality)) { $cardinalityValue = intval($cardinality); } else { if ($cardinality instanceof core_kernel_classes_Resource || common_Utils::isUri($cardinality)) { $cardinalityValue = $cardinality; } } if (!is_null($cardinalityValue)) { $class = new core_kernel_classes_Class(CLASS_ACTIVITYCARDINALITY); $returnValue = $class->createInstanceWithProperties(array(PROPERTY_STEP_NEXT => $step, PROPERTY_ACTIVITYCARDINALITY_CARDINALITY => $cardinalityValue)); } return $returnValue; }
/** * initialize a test method */ public function setUp() { TaoPhpUnitTestRunner::initTest(); error_reporting(E_ALL); if (is_null($this->userService)) { $this->userService = wfEngine_models_classes_UserService::singleton(); } $login = '******'; $pass = '******'; $langResource = tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG); $userData = array(PROPERTY_USER_LOGIN => $login, PROPERTY_USER_PASSWORD => core_kernel_users_Service::getPasswordHash()->encrypt($pass), PROPERTY_USER_DEFLG => $langResource, PROPERTY_USER_MAIL => '*****@*****.**', PROPERTY_USER_FIRSTNAME => 'Sammy', PROPERTY_USER_LASTNAME => 'Norville Rogers', PROPERTY_USER_ROLES => INSTANCE_ROLE_WORKFLOW); if (!$this->userService->loginAvailable($login)) { $this->fail('test login already taken'); } $userClass = new core_kernel_classes_Class(CLASS_WORKFLOWUSER); $this->currentUser = $userClass->createInstanceWithProperties($userData); $this->assertTrue($this->userService->loginUser($login, $pass)); $this->service = wfEngine_models_classes_NotificationService::singleton(); }
/** * Create a media instance from a file, and define its class and language * * @param string $fileSource path to the file to create instance from * @param string $classUri parent to add the instance to * @param string $language language of the content * @param string $label label of the instance * @param string $mimeType mimeType of the file * @return string | bool $instanceUri or false on error */ public function createMediaInstance($fileSource, $classUri, $language, $label = null, $mimeType = null) { $clazz = new \core_kernel_classes_Class($classUri); //get the file MD5 $md5 = md5_file($fileSource); //create media instance $label = is_null($label) ? basename($fileSource) : $label; $fileManager = FileManager::getFileManagementModel(); $link = $fileManager->storeFile($fileSource, $label); if ($link !== false) { $mimeType = is_null($mimeType) ? \tao_helpers_File::getMimeType($fileSource) : $mimeType; $instance = $clazz->createInstanceWithProperties(array(RDFS_LABEL => $label, MEDIA_LINK => $link, MEDIA_LANGUAGE => $language, MEDIA_MD5 => $md5, MEDIA_MIME_TYPE => $mimeType, MEDIA_ALT_TEXT => $label)); if (common_ext_ExtensionsManager::singleton()->isEnabled('taoRevision')) { \common_Logger::i('Auto generating initial revision'); RevisionService::commit($instance, __('Initial import')); } return $instance->getUri(); } return false; }
/** * * @param core_kernel_classes_Resource $deliveryResult * @param unknown $callId * @param unknown $test * @param unknown $item * @throws common_exception_Error * @return Ambigous <mixed, core_kernel_classes_Resource> */ public function getItemResult(core_kernel_classes_Resource $deliveryResult, $callId, $test, $item) { //check first from the local cache if (isset($this->cacheItemResult[$callId])) { return $this->cacheItemResult[$callId]; } $itemResultsClass = new core_kernel_classes_Class(ITEM_RESULT); $itemResults = $itemResultsClass->searchInstances(array(PROPERTY_IDENTIFIER => $callId), array("like" => false)); if (count($itemResults) > 1) { throw new common_exception_Error('More then 1 itemResult for the corresponding Id ' . $deliveryResultIdentifier); } elseif (count($itemResults) == 1) { $returnValue = array_shift($itemResults); common_Logger::d('found Item Result after search for ' . $callId); } else { $returnValue = $itemResultsClass->createInstanceWithProperties(array(RDFS_LABEL => $callId, PROPERTY_IDENTIFIER => $callId, PROPERTY_RELATED_ITEM => $item, PROPERTY_RELATED_TEST => $test, PROPERTY_RELATED_DELIVERY_RESULT => $deliveryResult->getUri())); } $this->cacheItemResult[$callId] = $returnValue; return $returnValue; }
/** * Returns an resource representing the incoming link * * @throws common_exception_Error * @return core_kernel_classes_Resource */ public function getLtiLinkResource() { if (is_null($this->ltiLink)) { $class = new core_kernel_classes_Class(CLASS_LTI_INCOMINGLINK); $consumer = taoLti_models_classes_LtiService::singleton()->getLtiConsumerResource($this->getLaunchData()); // search for existing resource $instances = $class->searchInstances(array(PROPERTY_LTI_LINK_ID => $this->getLaunchData()->getResourceLinkID(), PROPERTY_LTI_LINK_CONSUMER => $consumer), array('like' => false, 'recursive' => false)); if (count($instances) > 1) { throw new common_exception_Error('Multiple resources for link ' . $this->getLaunchData()->getResourceLinkID()); } if (count($instances) == 1) { // use existing link $this->ltiLink = current($instances); } else { // spawn new link $this->ltiLink = $class->createInstanceWithProperties(array(PROPERTY_LTI_LINK_ID => $this->getLaunchData()->getResourceLinkID(), PROPERTY_LTI_LINK_CONSUMER => $consumer)); } } return $this->ltiLink; }
/** * Stores a service call in the ontology * * @return core_kernel_classes_Resource */ public function toOntology() { $inResources = array(); $outResources = is_null($this->outParameter) ? array() : $this->outParameter->toOntology(); foreach ($this->inParameters as $param) { $inResources[] = $param->toOntology(); } $serviceCallClass = new core_kernel_classes_Class(CLASS_CALLOFSERVICES); $resource = $serviceCallClass->createInstanceWithProperties(array(RDFS_LABEL => 'serviceCall', PROPERTY_CALLOFSERVICES_SERVICEDEFINITION => $this->serviceDefinition, PROPERTY_CALLOFSERVICES_ACTUALPARAMETERIN => $inResources, PROPERTY_CALLOFSERVICES_ACTUALPARAMETEROUT => $outResources, PROPERTY_CALLOFSERVICES_WIDTH => '100', PROPERTY_CALLOFSERVICES_HEIGHT => '100')); return $resource; }
$lang = empty($parms) ? null : array_shift($parms); $groupUri = empty($parms) ? null : array_shift($parms); $rawStart = $root . 'tao' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'raw_start.php'; if (!file_exists($rawStart)) { echo 'Tao not found at "' . $rawStart . '"' . PHP_EOL; die(1); } require_once $rawStart; if (!file_exists($csvfile)) { echo 'Csv file not found at "' . $csvfile . '"' . PHP_EOL; die(1); } if (is_null($groupUri)) { $label = 'Group ' . uniqid(); $groupClass = new \core_kernel_classes_Class(TAO_GROUP_CLASS); $group = $groupClass->createInstanceWithProperties(array(RDFS_LABEL => $label)); echo 'Group "' . $label . '" created.' . PHP_EOL; $groupUri = $group->getUri(); } else { $group = new core_kernel_classes_Resource($groupUri); if (!$group->exists()) { echo 'Group "' . $groupUri . '" not found.' . PHP_EOL; die(1); } } $persistence = \common_persistence_Manager::getPersistence('default'); try { $schemaManager = $persistence->getDriver()->getSchemaManager(); $schema = $schemaManager->createSchema(); if (!$schema->hastable('redis')) { $fromSchema = clone $schema;
/** * (non-PHPdoc) * @see taoDelivery_models_classes_execution_Service::initDeliveryExecution() */ public function initDeliveryExecution(core_kernel_classes_Resource $assembly, $userUri) { $executionClass = new core_kernel_classes_Class(CLASS_DELVIERYEXECUTION); $execution = $executionClass->createInstanceWithProperties(array(RDFS_LABEL => $assembly->getLabel(), PROPERTY_DELVIERYEXECUTION_DELIVERY => $assembly, PROPERTY_DELVIERYEXECUTION_SUBJECT => $userUri, PROPERTY_DELVIERYEXECUTION_START => time(), PROPERTY_DELVIERYEXECUTION_STATUS => INSTANCE_DELIVERYEXEC_ACTIVE)); return $this->getDeliveryExecution($execution); }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * */ include_once dirname(__FILE__) . '/../../includes/raw_start.php'; $testUserData = array(PROPERTY_USER_LOGIN => 'tjdoe', PROPERTY_USER_PASSWORD => 'test123', PROPERTY_USER_LASTNAME => 'Doe', PROPERTY_USER_FIRSTNAME => 'John', PROPERTY_USER_MAIL => '*****@*****.**', PROPERTY_USER_DEFLG => tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri(), PROPERTY_USER_UILG => tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri(), PROPERTY_USER_ROLES => array(INSTANCE_ROLE_GLOBALMANAGER)); $testUserData[PROPERTY_USER_PASSWORD] = 'test' . rand(); $data = $testUserData; $data[PROPERTY_USER_PASSWORD] = core_kernel_users_Service::getPasswordHash()->encrypt($data[PROPERTY_USER_PASSWORD]); $tmclass = new core_kernel_classes_Class(CLASS_TAO_USER); $user = $tmclass->createInstanceWithProperties($data); common_Logger::i('Created user ' . $user->getUri()); // prepare a lookup table of languages and values $usage = new core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_GUI); $propValue = new core_kernel_classes_Property(RDF_VALUE); $langService = tao_models_classes_LanguageService::singleton(); $lookup = array(); foreach ($langService->getAvailableLanguagesByUsage($usage) as $lang) { $lookup[$lang->getUri()] = (string) $lang->getUniquePropertyValue($propValue); } echo json_encode(array('rootUrl' => ROOT_URL, 'userUri' => $user->getUri(), 'userData' => $testUserData, 'lang' => $lookup));
/** * Test the tokens into a parallel process */ public function testVirtualParallelJoinProcess() { error_reporting(E_ALL); $t_start = microtime(true); //init services $activityService = wfEngine_models_classes_ActivityService::singleton(); $processVariableService = wfEngine_models_classes_VariableService::singleton(); $authoringService = wfAuthoring_models_classes_ProcessService::singleton(); $activityExecutionService = wfEngine_models_classes_ActivityExecutionService::singleton(); $activityExecutionService->cache = (bool) self::SERVICE_CACHE; //process definition $processDefinitionClass = new core_kernel_classes_Class(CLASS_PROCESS); $processDefinition = $processDefinitionClass->createInstance('PJ processForUnitTest_' . date(DATE_ISO8601), 'created for the unit test of process execution'); $this->assertNotNull($processDefinition); /* +---------------+ | activity 0 | +-------+-------+ | +---v---+ | c 0 | split +--+-+--+ | | 3 +---------+ +---------+ unit_var_12345678 | | +-------v--------+ +-------v------+ | activity 1 | | activity 2 | +-------+--------+ +--------+-----+ | | +--------+ +--------+ +--v----v--+ | c 2 | join +----+-----+ | +-------v--------+ | activity 3 | +----------------+ */ //activities definitions $activity0 = $authoringService->createActivity($processDefinition, 'activity0'); $this->assertNotNull($activity0); $connector0 = null; $authoringService->setFirstActivity($processDefinition, $activity0); $connector0 = $authoringService->createConnector($activity0); $connectorParallele = new core_kernel_classes_Resource(INSTANCE_TYPEOFCONNECTORS_PARALLEL); $authoringService->setConnectorType($connector0, $connectorParallele); $this->assertNotNull($connector0); $parallelActivity1 = $authoringService->createActivity($processDefinition, 'activity1'); $this->assertNotNull($parallelActivity1); $roleRestrictedUser = new core_kernel_classes_Resource(INSTANCE_ACL_ROLE_RESTRICTED_USER); $activityService->setAcl($parallelActivity1, $roleRestrictedUser, $this->testUserRole); //!!! it is mendatory to set the role restricted user ACL mode to make this parallel process test case work $connector1 = null; $connector1 = $authoringService->createConnector($parallelActivity1); $this->assertNotNull($connector1); $parallelActivity2 = $authoringService->createActivity($processDefinition, 'activity2'); $this->assertNotNull($parallelActivity2); $activityService->setAcl($parallelActivity2, $roleRestrictedUser, $this->testUserRole); //!!! it is mendatory to set the role restricted user ACL mode to make this parallel process test case work $connector2 = null; $connector2 = $authoringService->createConnector($parallelActivity2); $this->assertNotNull($connector2); //define parallel activities, first branch with constant cardinality value, while the second listens to a process variable: $parallelCount1 = 3; $parallelCount2 = 5; $parallelCount2_processVar_key = 'unit_var_' . time(); $parallelCount2_processVar = $processVariableService->createProcessVariable('Var for unit test', $parallelCount2_processVar_key); $prallelActivitiesArray = array($parallelActivity1->getUri() => $parallelCount1, $parallelActivity2->getUri() => $parallelCount2_processVar); $result = $authoringService->setParallelActivities($connector0, $prallelActivitiesArray); $this->assertTrue($result); //set several split variables: $splitVariable1_key = 'unit_split_var1_' . time(); $splitVariable1 = $processVariableService->createProcessVariable('Split Var1 for unit test', $splitVariable1_key); $splitVariable2_key = 'unit_split_var2_' . time(); $splitVariable2 = $processVariableService->createProcessVariable('Split Var2 for unit test', $splitVariable2_key); $splitVariablesArray = array($parallelActivity1->getUri() => array($splitVariable1), $parallelActivity2->getUri() => array($splitVariable1, $splitVariable2)); $connectorService = wfAuthoring_models_classes_ConnectorService::singleton(); $connectorService->setSplitVariables($connector0, $splitVariablesArray); $prallelActivitiesArray[$parallelActivity2->getUri()] = $parallelCount2; $joinActivity = $authoringService->createActivity($processDefinition, 'activity3'); //join parallel Activity 1 and 2 to "joinActivity" $connector1 = wfAuthoring_models_classes_ConnectorService::singleton()->createJoin(array($parallelActivity1, $parallelActivity2), $joinActivity); /* $authoringService->createJoinActivity($connector1, $joinActivity, '', $parallelActivity1); $authoringService->createJoinActivity($connector2, $joinActivity, '', $parallelActivity2); */ //run the process $processExecName = 'Test Parallel Process Execution'; $processExecComment = 'created for processExecustionService test case by ' . __METHOD__; $processInstance = $this->service->createProcessExecution($processDefinition, $processExecName, $processExecComment); $this->assertTrue($this->service->checkStatus($processInstance, 'started')); $this->out(__METHOD__, true); $this->out("<strong>Forward transitions:</strong>", true); $previousActivityExecution = null; $numberActivities = 2 + $parallelCount1 + $parallelCount2; $createdUsers = array(); $loginProperty = new core_kernel_classes_Property(PROPERTY_USER_LOGIN); for ($i = 1; $i <= $numberActivities; $i++) { $activitieExecs = $this->service->getCurrentActivityExecutions($processInstance); $countActivities = count($activitieExecs); $activity = null; $activityExecution = null; if ($countActivities > 1) { //select one of the available activities in the parallel branch: foreach ($activitieExecs as $activityExecUri => $activityExec) { if (!$activityExecutionService->isFinished($activityExec)) { $activityDefinition = $activityExecutionService->getExecutionOf($activityExec); $activityUri = $activityDefinition->getUri(); if (isset($prallelActivitiesArray[$activityUri])) { if ($prallelActivitiesArray[$activityUri] > 0) { $prallelActivitiesArray[$activityUri]--; $activityExecution = $activityExec; $activity = $activityDefinition; break; } } } } } else { if ($countActivities == 1) { $activityExecution = reset($activitieExecs); $activity = $activityExecutionService->getExecutionOf($activityExecution); } else { $this->fail('no current activity definition found for the iteration ' . $i); } } $this->out("<strong> Iteration {$i} :</strong>", true); $this->out("<strong>" . (is_null($activity) ? 'null' : $activity->getLabel()) . "</strong> (among {$countActivities})"); //issue : no activity found for the last iteration... //init execution $activityExecution = $this->service->initCurrentActivityExecution($processInstance, $activityExecution, $this->currentUser); $this->assertNotNull($activityExecution); if ($i == 1) { //set value of the parallel thread: $processVariableService->push($parallelCount2_processVar_key, $parallelCount2); //set some values to the split variables: $values1 = array(); for ($j = 1; $j <= $parallelCount1; $j++) { $values1[] = 'A' . $j; } $values2 = array(); for ($j = 1; $j <= $parallelCount2; $j++) { $values2[] = 'B' . $j; } $processVariableService->push($splitVariable1_key, serialize($values1)); $processVariableService->push($splitVariable2_key, serialize($values2)); } else { //check dispatched value: // $value1 = $processVariableService->get($splitVariable1_key); // $value2 = $processVariableService->get($splitVariable2_key); // var_dump($value1, $value2); } $activityExecStatus = $activityExecutionService->getStatus($activityExecution); $this->assertNotNull($activityExecStatus); $this->assertEquals($activityExecStatus->getUri(), INSTANCE_PROCESSSTATUS_STARTED); //transition to next activity $this->out("current user: "******"' . $this->currentUser->getUri() . '"'); $this->out("performing transition ..."); //transition to next activity $performed = $this->service->performTransition($processInstance, $activityExecution); if (!$performed) { $this->out('transition failed.'); } $this->out("activity status: " . $activityExecutionService->getStatus($activityExecution)->getLabel()); $this->out("process status: " . $this->service->getStatus($processInstance)->getLabel()); //try undoing the transition: switch ($i) { case 1: $this->assertTrue($this->service->undoForwardTransition($processInstance, $activityExecution)); $activitieExecs = $this->service->getCurrentActivityExecutions($processInstance); $this->assertEquals(count($activitieExecs), 1); $activityBis = $activityExecutionService->getExecutionOf(reset($activitieExecs)); $this->assertTrue($activity->getUri() == $activityBis->getUri()); $transitionResult = $this->service->performTransition($processInstance, $activityExecution); break; case 1 + $parallelCount1: $this->assertFalse($this->service->undoForwardTransition($processInstance, $activityExecution)); $history = $this->service->getExecutionHistory($processInstance); $this->assertEquals(count($history), 2 * ($parallelCount1 + $parallelCount2) + 1); //activity 1, 2(closed), 2, 3 and 4 $this->assertFalse($this->service->undoForwardTransition($processInstance, new core_kernel_classes_Resource(reset($history)))); $this->assertNotNull($previousActivityExecution); $this->assertFalse($this->service->undoForwardTransition($processInstance, $previousActivityExecution)); break; case 1 + $parallelCount1 + $parallelCount2: $this->assertTrue($this->service->undoForwardTransition($processInstance, $activityExecution)); $activitieExecs = $this->service->getCurrentActivityExecutions($processInstance); $this->assertEquals(count($activitieExecs), $parallelCount1 + $parallelCount2); $transitionResult = $this->service->performTransition($processInstance, $activityExecution); break; } $previousActivityExecution = $activityExecution; if ($this->service->isPaused($processInstance)) { //Login another user to execute parallel branch $this->userService->logout(); $this->out("logout " . $this->currentUser->getOnePropertyValue($loginProperty) . ' "' . $this->currentUser->getUri() . '"', true); list($usec, $sec) = explode(" ", microtime()); $login = '******' . $i . '-' . $usec; $pass = '******'; $userData = array(PROPERTY_USER_LOGIN => $login, PROPERTY_USER_PASSWORD => core_kernel_users_Service::getPasswordHash()->encrypt($pass), PROPERTY_USER_DEFLG => 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . DEFAULT_LANG, PROPERTY_USER_UILG => 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . DEFAULT_LANG, PROPERTY_USER_ROLES => INSTANCE_ROLE_WORKFLOW, RDFS_LABEL => $login); if (!$this->userService->loginAvailable($login)) { $this->fail('test login already taken'); } $otherUser = $this->testUserClass->createInstanceWithProperties($userData); $createdUsers[$otherUser->getUri()] = $otherUser; if ($this->userService->loginUser($login, $pass)) { $this->currentUser = $this->userService->getCurrentUser(); $this->out("new user logged in: " . $this->currentUser->getOnePropertyValue($loginProperty) . ' "' . $this->currentUser->getUri() . '"'); } else { $this->fail("unable to login user {$login}"); } } } $this->assertTrue($this->service->isFinished($processInstance)); $this->assertTrue($this->service->resume($processInstance)); $this->out("<strong>Backward transitions:</strong>", true); // var_dump($this->service->getAllActivityExecutions($processInstance)); $j = 0; $iterationNumber = 2; while ($j < $iterationNumber) { $activitieExecs = $this->service->getCurrentActivityExecutions($processInstance); $activityExecution = null; $activity = null; switch ($j) { case 0: $this->assertEquals(count($activitieExecs), 1); //check $activityExecution = reset($activitieExecs); $activity = $activityExecutionService->getExecutionOf($activityExecution); break; case 1: $this->assertEquals(count($activitieExecs), $parallelCount1 + $parallelCount2); //check $activity = $parallelActivity2; foreach ($this->service->getCurrentActivityExecutions($processInstance, $activity) as $activityExec) { if ($activityExecutionService->getActivityExecutionUser($activityExec)->getUri() == $this->currentUser->getUri()) { $activityExecution = $activityExec; } } if (is_null($activityExecution)) { $activity = $parallelActivity1; foreach ($this->service->getCurrentActivityExecutions($processInstance, $activity) as $activityExec) { if ($activityExecutionService->getActivityExecutionUser($activityExec)->getUri() == $this->currentUser->getUri()) { $activityExecution = $activityExec; } } } $this->assertNotNull($activityExecution); break; } $this->out("<strong>" . $activity->getLabel() . "</strong>", true); //init execution $activityExecution = $this->service->initCurrentActivityExecution($processInstance, $activityExecution, $this->currentUser); $this->assertNotNull($activityExecution); $activityExecStatus = $activityExecutionService->getStatus($activityExecution); $this->assertNotNull($activityExecStatus); $this->assertEquals($activityExecStatus->getUri(), INSTANCE_PROCESSSTATUS_RESUMED); $this->out("current user: "******"' . $this->currentUser->getUri() . '"'); $this->out("performing transition ..."); //transition to next activity $transitionResult = $this->service->performBackwardTransition($processInstance, $activityExecution); if ($j == 0) { $this->assertTrue(count($transitionResult) > 0); } else { if ($j == $iterationNumber - 1) { //var_dump($transitionResult); $this->assertFalse($transitionResult); } } $processStatus = $this->service->getStatus($processInstance); $this->assertNotNull($processStatus); $this->out("activity status: " . $activityExecutionService->getStatus($activityExecution)->getLabel()); $this->out("process status: " . $processStatus->getLabel()); $this->assertEquals($processStatus->getUri(), INSTANCE_PROCESSSTATUS_PAUSED); $j++; } $this->out("<strong>Forward transitions again:</strong>", true); $currentActivityExecutions = $this->service->getCurrentActivityExecutions($processInstance); $currentActivityExecutionsCount = count($currentActivityExecutions); $this->assertEquals($currentActivityExecutionsCount, $parallelCount1 + $parallelCount2); for ($i = 0; $i < $currentActivityExecutionsCount; $i++) { $currentActivityExecution = array_pop($currentActivityExecutions); $user = $activityExecutionService->getActivityExecutionUser($currentActivityExecution); $activityDefinition = $activityExecutionService->getExecutionOf($currentActivityExecution); $this->assertNotNull($user); $this->assertNotNull($activityDefinition); if (!is_null($user) && !is_null($activityDefinition)) { $this->userService->logout(); $this->out("logout " . $this->currentUser->getOnePropertyValue($loginProperty) . ' "' . $this->currentUser->getUri() . '"', true); $login = (string) $user->getUniquePropertyValue($loginProperty); $pass = '******'; if ($this->userService->loginUser($login, $pass)) { $this->currentUser = $this->userService->getCurrentUser(); $this->out("new user logged in: " . $this->currentUser->getOnePropertyValue($loginProperty) . ' "' . $this->currentUser->getUri() . '"'); } else { $this->fail("unable to login user {$login}<br>"); } $iterationNo = $i + 1; $this->out("<strong>Iteration {$iterationNo}: " . $activityDefinition->getLabel() . "</strong>", true); //execute activity: $activityExecution = $this->service->initCurrentActivityExecution($processInstance, $currentActivityExecution, $this->currentUser); $this->assertNotNull($activityExecution); $activityExecStatus = $activityExecutionService->getStatus($activityExecution); $this->assertNotNull($activityExecStatus); $this->assertEquals($activityExecStatus->getUri(), INSTANCE_PROCESSSTATUS_RESUMED); //transition to next activity $this->out("current user: "******"' . $this->currentUser->getUri() . '"'); $this->out("performing transition ..."); //transition to next activity $this->service->performTransition($processInstance, $activityExecution); $this->out("activity status: " . $activityExecutionService->getStatus($activityExecution)->getLabel()); $this->out("process status: " . $this->service->getStatus($processInstance)->getLabel()); //try undoing the transition: if ($i < $currentActivityExecutionsCount - 1) { $this->assertFalse($this->service->undoForwardTransition($processInstance, $activityExecution)); } } } //try undoing the transition: $this->assertTrue($this->service->undoForwardTransition($processInstance, $activityExecution)); $activitieExecs = $this->service->getCurrentActivityExecutions($processInstance); $this->assertEquals(count($activitieExecs), $parallelCount1 + $parallelCount2); $transitionResult = $this->service->performTransition($processInstance, $activityExecution); $this->assertEquals(count($transitionResult), 1); $activitieExecs = $this->service->getCurrentActivityExecutions($processInstance); $this->assertEquals(count($activitieExecs), 1); $activityExecution = reset($activitieExecs); $activity = $activityExecutionService->getExecutionOf($activityExecution); $this->assertEquals($activity->getUri(), $joinActivity->getUri()); $this->out("<strong>Executing last activity: " . $activity->getLabel() . "</strong>", true); //init execution $activityExecution = $this->service->initCurrentActivityExecution($processInstance, $activityExecution, $this->currentUser); $this->assertNotNull($activityExecution); $activityExecStatus = $activityExecutionService->getStatus($activityExecution); $this->assertNotNull($activityExecStatus); $this->assertEquals($activityExecStatus->getUri(), INSTANCE_PROCESSSTATUS_STARTED); //transition to next activity $this->out("current user: "******"' . $this->currentUser->getUri() . '"'); $this->out("performing transition ..."); //transition to next activity $this->service->performTransition($processInstance, $activityExecution); $this->out("activity status: " . $activityExecutionService->getStatus($activityExecution)->getLabel()); $this->out("process status: " . $this->service->getStatus($processInstance)->getLabel()); $this->assertTrue($this->service->isFinished($processInstance)); $t_end = microtime(true); $duration = $t_end - $t_start; $this->out('Elapsed time: ' . $duration . 's', true); $this->out('deleting created resources:', true); //delete process exec: $this->assertTrue($this->service->deleteProcessExecution($processInstance)); //delete processdef: $this->assertTrue($authoringService->deleteProcess($processDefinition)); $parallelCount2_processVar->delete(); //delete created users: foreach ($createdUsers as $createdUser) { $this->out('deleting ' . $createdUser->getLabel() . ' "' . $createdUser->getUri() . '"'); $this->assertTrue($this->userService->removeUser($createdUser)); } if (!is_null($this->currentUser)) { $this->userService->logout(); $this->userService->removeUser($this->currentUser); } }
protected function createUser() { $class = new core_kernel_classes_Class(CLASS_GENERIS_USER); return $class->createInstanceWithProperties(array(PROPERTY_USER_LOGIN => 'john.doe', PROPERTY_USER_PASSWORD => core_kernel_users_Service::getPasswordHash()->encrypt('secure'), PROPERTY_USER_LASTNAME => 'Doe', PROPERTY_USER_FIRSTNAME => 'John', PROPERTY_USER_MAIL => '*****@*****.**', PROPERTY_USER_DEFLG => 'http://www.tao.lu/Ontologies/TAO.rdf#Langen-US', PROPERTY_USER_UILG => 'http://www.tao.lu/Ontologies/TAO.rdf#Langen-US', PROPERTY_USER_ROLES => INSTANCE_ROLE_BACKOFFICE)); }
/** * Render the add index sub form. * @throws Exception * @return void */ public function addPropertyIndex() { if (!tao_helpers_Request::isAjax()) { throw new Exception("wrong request mode"); } if (!$this->hasRequestParameter('uri')) { throw new Exception("wrong request Parameter"); } $uri = $this->getRequestParameter('uri'); $clazz = $this->getCurrentClass(); $index = 1; if ($this->hasRequestParameter('index')) { $index = $this->getRequestParameter('index'); } $propertyIndex = 1; if ($this->hasRequestParameter('propertyIndex')) { $propertyIndex = $this->getRequestParameter('propertyIndex'); } //create and attach the new index property to the property $property = new core_kernel_classes_Property(tao_helpers_Uri::decode($uri)); $class = new \core_kernel_classes_Class("http://www.tao.lu/Ontologies/TAO.rdf#Index"); //get property range to select a default tokenizer /** @var core_kernel_classes_Class $range */ $range = $property->getRange(); //range is empty select item content $tokenizer = null; if (is_null($range)) { $tokenizer = new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer'); } else { $tokenizer = $range->getUri() === RDFS_LITERAL ? new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer') : new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAO.rdf#LabelTokenizer'); } $indexClass = new core_kernel_classes_Class('http://www.tao.lu/Ontologies/TAO.rdf#Index'); $i = 0; $indexIdentifierBackup = preg_replace('/[^a-z_0-9]/', '_', strtolower($property->getLabel())); $indexIdentifierBackup = ltrim(trim($indexIdentifierBackup, '_'), '0..9'); $indexIdentifier = $indexIdentifierBackup; do { if ($i !== 0) { $indexIdentifier = $indexIdentifierBackup . '_' . $i; } $resources = $indexClass->searchInstances(array(INDEX_PROPERTY_IDENTIFIER => $indexIdentifier), array('like' => false)); $count = count($resources); $i++; } while ($count !== 0); $indexProperty = $class->createInstanceWithProperties(array(RDFS_LABEL => preg_replace('/_/', ' ', ucfirst($indexIdentifier)), INDEX_PROPERTY_IDENTIFIER => $indexIdentifier, INDEX_PROPERTY_TOKENIZER => $tokenizer, INDEX_PROPERTY_FUZZY_MATCHING => GENERIS_TRUE, INDEX_PROPERTY_DEFAULT_SEARCH => GENERIS_FALSE)); $property->setPropertyValue(new core_kernel_classes_Property(INDEX_PROPERTY), $indexProperty); //generate form $indexFormContainer = new tao_actions_form_IndexProperty($clazz, $indexProperty, array('index' => $index, 'propertyindex' => $propertyIndex)); $myForm = $indexFormContainer->getForm(); $form = trim(preg_replace('/\\s+/', ' ', $myForm->renderElements())); echo json_encode(array('form' => $form)); }
/** * Creates a new LTI User with the absolute minimum of required informations * * @param taoLti_models_classes_LtiLaunchData $ltiContext * @return core_kernel_classes_Resource */ public function spawnUser(taoLti_models_classes_LtiLaunchData $ltiContext) { $class = new core_kernel_classes_Class(CLASS_LTI_USER); //$lang = tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG); $props = array(PROPERTY_USER_LTIKEY => $ltiContext->getUserID(), PROPERTY_USER_LTICONSUMER => $this->getLtiConsumerResource($ltiContext)); if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_FULL)) { $props[RDFS_LABEL] = $ltiContext->getUserFullName(); } if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_GIVEN)) { $props[PROPERTY_USER_FIRSTNAME] = $ltiContext->getUserGivenName(); } if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_FAMILY)) { $props[PROPERTY_USER_LASTNAME] = $ltiContext->getUserFamilyName(); } if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_CONTACT_EMAIL_PRIMARY)) { $props[PROPERTY_USER_MAIL] = $ltiContext->getUserEmail(); } $user = $class->createInstanceWithProperties($props); common_Logger::i('added User ' . $user->getLabel()); return $user; }
/** * Mark rule as executed and save time of completed. * @return \core_kernel_classes_Resource */ public function completed() { $resource = $this->getActionExecution(); if ($resource === null) { $requiredActionClass = new \core_kernel_classes_Class(self::CLASS_URI); $resource = $requiredActionClass->createInstanceWithProperties(array(self::PROPERTY_SUBJECT => $this->getUser()->getIdentifier(), self::PROPERTY_NAME => $this->requiredAction->getName(), self::PROPERTY_EXECUTION_TIME => time())); } $timeProperty = new \core_kernel_classes_Property(self::PROPERTY_EXECUTION_TIME); $resource->editPropertyValues($timeProperty, time()); return $resource; }
protected function createUser($login) { $userData = array(PROPERTY_USER_LOGIN => $login, PROPERTY_USER_PASSWORD => core_kernel_users_Service::getPasswordHash()->encrypt($this->userPassword), PROPERTY_USER_DEFLG => 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . DEFAULT_LANG, PROPERTY_USER_UILG => 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . DEFAULT_LANG, PROPERTY_USER_ROLES => INSTANCE_ROLE_WORKFLOW); if (!$this->userService->loginAvailable($login)) { $this->fail('test login already taken'); } $userClass = new core_kernel_classes_Class(CLASS_WORKFLOWUSER); $user = $userClass->createInstanceWithProperties($userData); if (is_null($user)) { throw new Exception('cannot get the user with login ' . $login); } return $user; }
/** * (non-PHPdoc) * @see tao_models_classes_service_Parameter::serialize() */ public function toOntology() { $serviceCallClass = new core_kernel_classes_Class(CLASS_ACTUALPARAMETER); $resource = $serviceCallClass->createInstanceWithProperties(array(PROPERTY_ACTUALPARAMETER_FORMALPARAMETER => $this->getDefinition(), PROPERTY_ACTUALPARAMETER_PROCESSVARIABLE => $this->variable)); return $resource; }