public static function setUpBeforeClass() { self::$client = new Zend_Http_Client(); self::$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'text/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive')); // create a test concept $randomn = rand(0, 20480); $prefLabel = 'testPrefLable_' . $randomn; $notation = 'test-xxx-' . $randomn; self::$uuid = uniqid(); $uuid = uniqid(); self::$about = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . $notation; $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$about . '">' . '<skos:prefLabel xml:lang="nl">' . $prefLabel . '</skos:prefLabel>' . '<openskos:uuid>' . $uuid . '</openskos:uuid>' . '<skos:inScheme rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<skos:notation>' . $notation . '</skos:notation>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>'; self::$response0 = RequestResponse::CreateConceptRequest(self::$client, $xml, "false"); if (self::$response0->getStatus() !== 201) { Logging::failureMessaging(self::$response0, "creating test concept"); return; } else { // things went well, but when submitting a concept is status is automatically reset to "candidate"; // now update to change the status for "approved", otherwise autocomplete would not react self::$response0 = RequestResponse::UpdateConceptRequest(self::$client, $xml); if (self::$response0->getStatus() !== 201) { Logging::failureMessaging(self::$response0, "updating test concept to set status to 'apprved'"); return; } } $randomnC = rand(0, 20480); $prefLabelC = 'testPrefLable_' . $randomnC; $notationC = 'test-xxx-' . $randomnC; self::$uuidC = uniqid(); self::$aboutC = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . $notationC; $xmlC = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$aboutC . '">' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . $prefLabelC . '</skos:prefLabel>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:uuid>' . self::$uuidC . '</openskos:uuid>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<skos:notation>' . $notationC . '</skos:notation>' . '<skos:inScheme rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>'; self::$response0C = RequestResponse::CreateConceptRequest(self::$client, $xmlC, "false"); }
public static function setUpBeforeClass() { self::$client = new Zend_Http_Client(); self::$client->setConfig(array('maxredirects' => 0, 'timeout' => 30)); self::$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'application/json', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive')); self::$abouts = array(); self::$labelMap = array(PREF_LABEL => PREF_LABEL . "_", ALT_LABEL => ALT_LABEL . "_", HID_LABEL => HID_LABEL . "_", NOTATION => NOTATION . "_"); // create test concepts $letters = range('a', 'z'); self::$prefs[0] = uniqid(); $i = 1; foreach ($letters as $letter) { self::$prefs[$i] = self::$prefs[$i - 1] . $letter; $randomn = rand(0, 10000); $prefLabel = self::$labelMap[PREF_LABEL] . self::$prefs[$i] . $randomn; $altLabel = self::$labelMap[ALT_LABEL] . self::$prefs[$i] . $randomn; $hiddenLabel = self::$labelMap[HID_LABEL] . self::$prefs[$i] . $randomn; $notation = self::$labelMap[NOTATION] . self::$prefs[$i] . $randomn; $uuid = uniqid(); $about = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . $notation; $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . $about . '">' . '<skos:prefLabel xml:lang="nl">' . $prefLabel . '</skos:prefLabel>' . '<skos:altLabel xml:lang="nl">' . $altLabel . '</skos:altLabel>' . '<skos:hiddenLabel xml:lang="nl">' . $hiddenLabel . '</skos:hiddenLabel>' . '<openskos:uuid>' . $uuid . '</openskos:uuid>' . '<skos:inScheme rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<openskos:status>approved</openskos:status>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<skos:notation>' . $notation . '</skos:notation>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>'; $response0 = RequestResponse::CreateConceptRequest(self::$client, $xml, "false"); if ($response0->getStatus() !== 201) { Logging::failureMessaging($response0, "creating test concept"); self::$success = false; return; } else { // things went well, but when submitting a concept is status is automatically reset to "candidate"; // now update to change the status for "approved", otherwise autocomplete would not react $response1 = RequestResponse::UpdateConceptRequest(self::$client, $xml); if ($response1->getStatus() !== 201) { Logging::failureMessaging($response1, "updating test concept to set status to 'apprved'"); self::$success = false; return; } } array_push(self::$abouts, $about); $i++; } self::$success = true; }