public function testStoreTestVariable() { $deliveryResultIdentifier = "MyDeliveryResultIdentifier#1"; $test = "MyGreatTest#3"; $callId = "MyCallId#3"; $testVariable = new \taoResultServer_models_classes_OutcomeVariable(); $testVariable->setBaseType('float'); $testVariable->setCardinality('multiple'); $testVariable->setEpoch(microtime()); $testVariable->setIdentifier('TestIdentifier'); $testVariable->setValue('MyValue'); $this->instance->storeTestVariable($deliveryResultIdentifier, $test, $testVariable, $callId); $tmp = $this->instance->getVariable($callId, 'TestIdentifier'); $object = array_shift($tmp)[0]; $this->assertEquals($test, $object->test); $this->assertNull($object->item); $this->assertEquals('float', $object->variable->getBaseType()); $this->assertEquals('multiple', $object->variable->getCardinality()); $this->assertEquals('TestIdentifier', $object->variable->getIdentifier()); $this->assertEquals('MyValue', $object->variable->getValue()); $this->assertInstanceOf('taoResultServer_models_classes_OutcomeVariable', $object->variable); $this->assertEquals('float', $this->instance->getVariableProperty($object->uri, 'baseType')); $this->assertEquals('multiple', $this->instance->getVariableProperty($object->uri, 'cardinality')); $this->assertEquals('TestIdentifier', $this->instance->getVariableProperty($object->uri, 'identifier')); $this->assertEquals('MyValue', $this->instance->getVariableProperty($object->uri, 'value')); }
protected function removeResults() { $report = new \common_report_Report(\common_report_Report::TYPE_SUCCESS); try { // results rds $rdsStorage = new RdsResultStorage(); $deliveryIds = $rdsStorage->getAllDeliveryIds(); $count = 0; foreach ($deliveryIds as $deliveryId) { if ($rdsStorage->deleteResult($deliveryId['deliveryResultIdentifier'])) { $count++; } else { $report->setType(\common_report_Report::TYPE_ERROR); $report->setMessage('Cannot cleanup results for ' . $deliveryId['deliveryResultIdentifier']); } } $report->setMessage('Removed ' . $count . ' on ' . count($deliveryIds) . ' RDS results'); // results redis try { $keyValuePersistence = \common_persistence_KeyValuePersistence::getPersistence('keyValueResult'); } catch (\common_Exception $e) { $keyValuePersistence = null; } if (!is_null($keyValuePersistence)) { $kvStorage = new \taoAltResultStorage_models_classes_KeyValueResultStorage(); $deliveryIds = $kvStorage->getAllDeliveryIds(); $count = 0; foreach ($deliveryIds as $deliveryId) { if ($kvStorage->deleteResult($deliveryId['deliveryResultIdentifier'])) { $count++; } else { $report->setType(\common_report_Report::TYPE_ERROR); $report->setMessage('Cannot cleanup results for ' . $deliveryId['deliveryResultIdentifier']); } } $report->setMessage('Removed ' . $count . ' on ' . count($deliveryIds) . ' Key Value results'); } } catch (\common_Exception $e) { $report->setType(\common_report_Report::TYPE_ERROR); $report->setMessage('Cannot cleanup Results: ' . $e->getMessage()); } $this->finalReport->add($report); }