public function testParseValidXml() { $response = new ResponseCore(array(), $this->validXml, 200); $result = new ListMultipartUploadResult($response); $listMultipartUploadInfo = $result->getData(); $this->assertEquals("oss-example", $listMultipartUploadInfo->getBucket()); $this->assertEquals("xx", $listMultipartUploadInfo->getKeyMarker()); $this->assertEquals(3, $listMultipartUploadInfo->getUploadIdMarker()); $this->assertEquals("oss.avi", $listMultipartUploadInfo->getNextKeyMarker()); $this->assertEquals("0004B99B8E707874FC2D692FA5D77D3F", $listMultipartUploadInfo->getNextUploadIdMarker()); $this->assertEquals("x", $listMultipartUploadInfo->getDelimiter()); $this->assertEquals("xx", $listMultipartUploadInfo->getPrefix()); $this->assertEquals(1000, $listMultipartUploadInfo->getMaxUploads()); $this->assertEquals("false", $listMultipartUploadInfo->getIsTruncated()); $this->assertEquals("multipart.data", $listMultipartUploadInfo->getUploads()[0]->getKey()); $this->assertEquals("0004B999EF518A1FE585B0C9360DC4C8", $listMultipartUploadInfo->getUploads()[0]->getUploadId()); $this->assertEquals("2012-02-23T04:18:23.000Z", $listMultipartUploadInfo->getUploads()[0]->getInitiated()); }
/** * 罗列出所有执行中的Multipart Upload事件,即已经被初始化的Multipart Upload但是未被 * Complete或者Abort的Multipart Upload事件 * * @param string $bucket bucket * @param array $options 关联数组 * @throws OssException * @return ListMultipartUploadInfo */ public function listMultipartUploads($bucket, $options = null) { $this->precheckCommon($bucket, NULL, $options, false); $options[self::OSS_METHOD] = self::OSS_HTTP_GET; $options[self::OSS_BUCKET] = $bucket; $options[self::OSS_OBJECT] = '/'; $options[self::OSS_SUB_RESOURCE] = 'uploads'; foreach (array('delimiter', 'key-marker', 'max-uploads', 'prefix', 'upload-id-marker') as $param) { if (isset($options[$param])) { $options[self::OSS_QUERY_STRING][$param] = $options[$param]; unset($options[$param]); } } $query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array(); $options[self::OSS_QUERY_STRING] = array_merge($query, array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL)); $response = $this->auth($options); $result = new ListMultipartUploadResult($response); return $result->getData(); }
public function testParseValidXmlWithEncodedKey() { $response = new ResponseCore(array(), $this->validXmlWithEncodedKey, 200); $result = new ListMultipartUploadResult($response); $listMultipartUploadInfo = $result->getData(); $this->assertEquals("oss-example", $listMultipartUploadInfo->getBucket()); $this->assertEquals("php+key-marker", $listMultipartUploadInfo->getKeyMarker()); $this->assertEquals("php+next-key-marker", $listMultipartUploadInfo->getNextKeyMarker()); $this->assertEquals(3, $listMultipartUploadInfo->getUploadIdMarker()); $this->assertEquals("0004B99B8E707874FC2D692FA5D77D3F", $listMultipartUploadInfo->getNextUploadIdMarker()); $this->assertEquals("/", $listMultipartUploadInfo->getDelimiter()); $this->assertEquals("php+prefix", $listMultipartUploadInfo->getPrefix()); $this->assertEquals(1000, $listMultipartUploadInfo->getMaxUploads()); $this->assertEquals("true", $listMultipartUploadInfo->getIsTruncated()); $uploads = $listMultipartUploadInfo->getUploads(); $this->assertEquals("php+key-1", $uploads[0]->getKey()); $this->assertEquals("0004B999EF518A1FE585B0C9360DC4C8", $uploads[0]->getUploadId()); $this->assertEquals("2012-02-23T04:18:23.000Z", $uploads[0]->getInitiated()); }