Merge pull request #91 from katmsft/jul

GA-Preview release(1.0.0-beta.1) pull request
This commit is contained in:
Vincent Jiang (LEI) 2017-08-03 01:32:51 -07:00 коммит произвёл GitHub
Родитель dffb7d7a18 c62dfa3824
Коммит b4d6009c1b
71 изменённых файлов: 1971 добавлений и 1628 удалений

Просмотреть файл

@ -1,3 +1,20 @@
Tracking Breaking changes in 1.0.0-beta.1
All
* Refined code logic for continuation token. Now continuation token will be null if there are no more instance to be queried/listed.
Blob
* Removed `MicrosoftAzure\Storage\Tests\unit\Blob\Models\BlobContinuationToken`, now use `MicrosoftAzure\Storage\Common\MarkerContinuationToken` instead for better code structure and reuse.
Table
* Deprecated ATOM support for Table service.
Queue
* Removed `MicrosoftAzure\Storage\Tests\unit\Queue\Models\QueueContinuationToken`, now use `MicrosoftAzure\Storage\Common\MarkerContinuationToken` instead for better code structure and reuse.
File
* Removed `MicrosoftAzure\Storage\Tests\unit\File\Models\FileContinuationToken`, now use `MicrosoftAzure\Storage\Common\MarkerContinuationToken` instead for better code structure and reuse.
Tracking Breaking changes in 0.16.0
All

Просмотреть файл

@ -1,3 +1,23 @@
2017.07 - version 1.0.0-beta.1
All
* REST API version upgraded to 2016-05-31.
* Added support for anonymous read access to containers. User can now call `MicrosoftAzure\Storage\Common\ServiceBuilder::createContainerAnonymousAccess` to create service proxy to access containers/blobs without credential.
* Refined code logic for continuation token. Now continuation token will be null if there are no more instance to be queried/listed.
Blob
* Removed `MicrosoftAzure\Storage\Tests\unit\Blob\Models\BlobContinuationToken`, now use `MicrosoftAzure\Storage\Common\MarkerContinuationToken` instead for better code structure and reuse.
* Added `MicrosoftAzure\Storage\Tests\unit\Blob\BlobRestProxy::blockSize` for user to control block size.
Table
* Deprecated ATOM support for Table service.
Queue
* Removed `MicrosoftAzure\Storage\Tests\unit\Queue\Models\QueueContinuationToken`, now use `MicrosoftAzure\Storage\Common\MarkerContinuationToken` instead for better code structure and reuse.
File
* Removed `MicrosoftAzure\Storage\Tests\unit\File\Models\FileContinuationToken`, now use `MicrosoftAzure\Storage\Common\MarkerContinuationToken` instead for better code structure and reuse.
2017.06 - version 0.16.0
All

Просмотреть файл

@ -96,7 +96,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
{
use ServiceRestTrait;
private $_SingleBlobUploadThresholdInBytes = Resources::MB_IN_BYTES_32;
private $singleBlobUploadThresholdInBytes = Resources::MB_IN_BYTES_32;
private $blockSize = Resources::MB_IN_BYTES_4;
/**
* Get the value for SingleBlobUploadThresholdInBytes
@ -105,11 +106,21 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*/
public function getSingleBlobUploadThresholdInBytes()
{
return $this->_SingleBlobUploadThresholdInBytes;
return $this->singleBlobUploadThresholdInBytes;
}
/**
* Set the value for SingleBlobUploadThresholdInBytes, Max 64MB
* Get the value for blockSize
*
* @return int
*/
public function getBlockSize()
{
return $this->blockSize;
}
/**
* Set the value for SingleBlobUploadThresholdInBytes, Max 256MB
*
* @param int $val The max size to send as a single blob block
*
@ -117,14 +128,81 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*/
public function setSingleBlobUploadThresholdInBytes($val)
{
if ($val > Resources::MB_IN_BYTES_64) {
if ($val > Resources::MB_IN_BYTES_256) {
// What should the proper action here be?
$val = Resources::MB_IN_BYTES_64;
$val = Resources::MB_IN_BYTES_256;
} elseif ($val < 1) {
// another spot that could use looking at
$val = Resources::MB_IN_BYTES_32;
}
$this->_SingleBlobUploadThresholdInBytes = $val;
$this->singleBlobUploadThresholdInBytes = $val;
//If block size is larger than singleBlobUploadThresholdInBytes, honor
//threshold.
$this->blockSize = $val > $this->blockSize ? $this->blockSize : $val;
}
/**
* Set the value for block size, Max 100MB
*
* @param int $val The max size for each block to be sent.
*
* @return void
*/
public function setBlockSize($val)
{
if ($val > Resources::MB_IN_BYTES_100) {
// What should the proper action here be?
$val = Resources::MB_IN_BYTES_100;
} elseif ($val < 1) {
// another spot that could use looking at
$val = Resources::MB_IN_BYTES_4;
}
//If block size is larger than singleBlobUploadThresholdInBytes, honor
//threshold.
$val = $val > $this->singleBlobUploadThresholdInBytes ?
$this->singleBlobUploadThresholdInBytes : $val;
$this->blockSize = $val;
}
/**
* Get the block size of multiple upload block size using the provided
* content
*
* @param StreamInterface $content The content of the blocks.
*
* @return int
*/
private function getMultipleUploadBlockSizeUsingContent($content)
{
//Default value is 100 MB.
$result = Resources::MB_IN_BYTES_100;
//PHP must be ran in 64bit environment so content->getSize() could
//return a guaranteed accurate size.
if (Utilities::is64BitPHP()) {
//Content must be seekable to determine the size.
if ($content->isSeekable()) {
$size = $content->getSize();
//When threshold is lower than 100MB, assume maximum number of
//block is used for the block blob, if the blockSize is still
//smaller than the assumed size, it means assumed size should
//be hornored, otherwise the blocks count will exceed maximum
//value allowed.
if ($this->blockSize < $result) {
$assumedSize = ceil((float)$size /
(float)(Resources::MAX_BLOB_BLOCKS));
if ($this->blockSize <= $assumedSize) {
$result = $assumedSize;
} else {
$result = $this->blockSize;
}
}
}
} else {
// If not, we could only honor user's setting to determine
// chunk size.
$result = $this->blockSize;
}
return $result;
}
/**
@ -136,12 +214,12 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return string
*/
private function _getCopyBlobSourceName(
private function getCopyBlobSourceName(
$containerName,
$blobName,
Models\CopyBlobOptions $options
) {
$sourceName = $this->_getBlobUrl($containerName, $blobName);
$sourceName = $this->getBlobUrl($containerName, $blobName);
if (!is_null($options->getSourceSnapshot())) {
$sourceName .= '?snapshot=' . $options->getSourceSnapshot();
@ -158,7 +236,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return string
*/
private function _createPath($container, $blob = '')
private function createPath($container, $blob = '')
{
if (empty($blob)) {
if (!empty($container)) {
@ -191,9 +269,9 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return string
*/
private function _getBlobUrl($container, $blob)
private function getBlobUrl($container, $blob)
{
$encodedBlob = $this->_createPath($container, $blob);
$encodedBlob = $this->createPath($container, $blob);
return (string)($this->getPsrPrimaryUri()->withPath($encodedBlob));
}
@ -208,18 +286,18 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
private function _getContainerPropertiesAsyncImpl(
private function getContainerPropertiesAsyncImpl(
$container,
Models\BlobServiceOptions $options = null,
$operation = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
$method = Resources::HTTP_GET;
$headers = array();
$queryParams = array();
$postParams = array();
$path = $this->_createPath($container);
$path = $this->createPath($container);
if (is_null($options)) {
$options = new BlobServiceOptions();
@ -269,7 +347,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return array
*/
private function _addCreateBlobOptionalHeaders(
private function addCreateBlobOptionalHeaders(
CreateBlobOptions $options,
array $headers
) {
@ -342,7 +420,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return array
*/
private function _addOptionalRangeHeader(array $headers, $start, $end)
private function ddOptionalRangeHeader(array $headers, $start, $end)
{
if (!is_null($start) || !is_null($end)) {
$range = $start . '-' . $end;
@ -396,7 +474,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
private function _putLeaseAsyncImpl(
private function putLeaseAsyncImpl(
$leaseAction,
$container,
$blob,
@ -408,8 +486,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
Models\BlobServiceOptions $options,
Models\AccessCondition $accessCondition = null
) {
Validate::isString($blob, 'blob');
Validate::isString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($container, 'container');
$method = Resources::HTTP_PUT;
@ -419,14 +497,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$path;
if (empty($blob)) {
$path = $this->_createPath($container);
$path = $this->createPath($container);
$this->addOptionalQueryParam(
$queryParams,
Resources::QP_REST_TYPE,
'container'
);
} else {
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
}
$this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'lease');
$this->addOptionalQueryParam(
@ -482,13 +560,13 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
* @param string $action Either clear or create.
* @param string $container The container name.
* @param string $blob The blob name.
* @param Range $range The page ranges.
* @param Range $range The page ranges.
* @param string $content The content string.
* @param CreateBlobPagesOptions $options The optional parameters.
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
private function _updatePageBlobPagesAsyncImpl(
private function updatePageBlobPagesAsyncImpl(
$action,
$container,
$blob,
@ -496,10 +574,10 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$content,
CreateBlobPagesOptions $options = null
) {
Validate::isString($blob, 'blob');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
Validate::isString($container, 'container');
Validate::isString($content, 'content');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($content, 'content');
Validate::isTrue(
$range instanceof Range,
sprintf(
@ -514,13 +592,13 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$queryParams = array();
$postParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new CreateBlobPagesOptions();
}
$headers = $this->_addOptionalRangeHeader(
$headers = $this->ddOptionalRangeHeader(
$headers,
$range->getStart(),
$range->getEnd()
@ -685,14 +763,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$container,
Models\CreateContainerOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($container, 'container');
$method = Resources::HTTP_PUT;
$headers = array();
$postParams = array();
$queryParams = array(Resources::QP_REST_TYPE => 'container');
$path = $this->_createPath($container);
$path = $this->createPath($container);
if (is_null($options)) {
$options = new CreateContainerOptions();
@ -749,14 +827,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$container,
Models\BlobServiceOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($container, 'container');
$method = Resources::HTTP_DELETE;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container);
$path = $this->createPath($container);
if (is_null($options)) {
$options = new BlobServiceOptions();
@ -823,7 +901,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$container,
Models\BlobServiceOptions $options = null
) {
return $this->_getContainerPropertiesAsyncImpl($container, $options);
return $this->getContainerPropertiesAsyncImpl($container, $options);
}
/**
@ -858,7 +936,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$container,
Models\BlobServiceOptions $options = null
) {
return $this->_getContainerPropertiesAsyncImpl($container, $options, 'metadata');
return $this->getContainerPropertiesAsyncImpl($container, $options, 'metadata');
}
/**
@ -894,13 +972,13 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$container,
Models\BlobServiceOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
$method = Resources::HTTP_GET;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container);
$path = $this->createPath($container);
$statusCode = Resources::STATUS_OK;
if (is_null($options)) {
@ -1001,14 +1079,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
Models\ContainerACL $acl,
Models\BlobServiceOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($acl, 'acl');
$method = Resources::HTTP_PUT;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container);
$path = $this->createPath($container);
$body = $acl->toXml($this->dataSerializer);
if (is_null($options)) {
@ -1094,14 +1172,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
array $metadata,
Models\BlobServiceOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Utilities::validateMetadata($metadata);
$method = Resources::HTTP_PUT;
$headers = $this->generateMetadataHeaders($metadata);
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container);
$path = $this->createPath($container);
if (is_null($options)) {
$options = new BlobServiceOptions();
@ -1172,13 +1250,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$container,
Models\ListBlobsOptions $options = null
) {
Validate::isString($container, 'container');
Validate::notNull($container, 'container');
Validate::canCastAsString($container, 'container');
$method = Resources::HTTP_GET;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container);
$path = $this->createPath($container);
if (is_null($options)) {
$options = new ListBlobsOptions();
@ -1311,8 +1390,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$length,
Models\CreateBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
Validate::isInteger($length, 'length');
Validate::notNull($length, 'length');
@ -1321,7 +1400,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$statusCode = Resources::STATUS_CREATED;
if (is_null($options)) {
@ -1343,7 +1422,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
Resources::X_MS_BLOB_SEQUENCE_NUMBER,
$options->getSequenceNumber()
);
$headers = $this->_addCreateBlobOptionalHeaders($options, $headers);
$headers = $this->addCreateBlobOptionalHeaders($options, $headers);
$options->setLocationMode(LocationMode::PRIMARY_ONLY);
@ -1404,16 +1483,16 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\CreateBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_PUT;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$statusCode = Resources::STATUS_CREATED;
if (is_null($options)) {
@ -1425,7 +1504,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
Resources::X_MS_BLOB_TYPE,
BlobType::APPEND_BLOB
);
$headers = $this->_addCreateBlobOptionalHeaders($options, $headers);
$headers = $this->addCreateBlobOptionalHeaders($options, $headers);
$options->setLocationMode(LocationMode::PRIMARY_ONLY);
@ -1510,7 +1589,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$promise = null;
if (!Utilities::isStreamLargerThanSizeOrNotSeekable(
$body,
$this->_SingleBlobUploadThresholdInBytes
$this->singleBlobUploadThresholdInBytes
)) {
$promise = $this->createBlockBlobBySingleUploadAsync(
$container,
@ -1654,8 +1733,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$content,
Models\CreateBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
Validate::isTrue(
$options == null ||
@ -1671,14 +1750,13 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new CreateBlobOptions();
}
$headers = $this->_addCreateBlobOptionalHeaders($options, $headers);
$headers = $this->addCreateBlobOptionalHeaders($options, $headers);
$this->addOptionalHeader(
$headers,
@ -1725,8 +1803,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$content,
Models\CreateBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
if ($content->isSeekable() && Utilities::is64BitPHP()) {
Validate::isTrue(
$content->getSize() <= Resources::MAX_BLOCK_BLOB_SIZE,
Resources::CONTENT_SIZE_TOO_LARGE
);
}
if (is_null($options)) {
$options = new CreateBlobOptions();
@ -1738,14 +1823,11 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$method = Resources::HTTP_PUT;
$headers = $this->createBlobBlockHeader($createBlobBlockOptions);
$postParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$blockIds = array();
// if threshold is lower than 4mb, honor threshold, else use 4mb
$blockSize = (
$this->_SingleBlobUploadThresholdInBytes
< Resources::MB_IN_BYTES_4) ?
$this->_SingleBlobUploadThresholdInBytes : Resources::MB_IN_BYTES_4;
//Determine the block size according to the content and threshold.
$blockSize = $this->getMultipleUploadBlockSizeUsingContent($content);
$counter = 0;
//create the generator for requests.
//this generator also constructs the blockId array on the fly.
@ -1840,10 +1922,10 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$content,
Models\CreateBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
if (is_null($options)) {
@ -1853,7 +1935,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$method = Resources::HTTP_PUT;
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'page');
$this->addOptionalQueryParam(
@ -1897,7 +1979,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
} while (Utilities::allZero($pageContent));
$headers = array();
$headers = $this->_addOptionalRangeHeader(
$headers = $this->ddOptionalRangeHeader(
$headers,
$start,
$end
@ -1991,7 +2073,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
Range $range,
Models\CreateBlobPagesOptions $options = null
) {
return $this->_updatePageBlobPagesAsyncImpl(
return $this->updatePageBlobPagesAsyncImpl(
PageWriteOption::CLEAR_OPTION,
$container,
$blob,
@ -2067,7 +2149,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
throw new \RuntimeException(Resources::ERROR_RANGE_NOT_ALIGN_TO_512);
}
return $this->_updatePageBlobPagesAsyncImpl(
return $this->updatePageBlobPagesAsyncImpl(
PageWriteOption::UPDATE_OPTION,
$container,
$blob,
@ -2140,10 +2222,10 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$content,
Models\CreateBlobBlockOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
Validate::isString($blockId, 'blockId');
Validate::canCastAsString($blockId, 'blockId');
Validate::notNullOrEmpty($blockId, 'blockId');
if (is_null($options)) {
@ -2154,7 +2236,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = $this->createBlobBlockHeader($options);
$postParams = array();
$queryParams = $this->createBlobBlockQueryParams($options, $blockId);
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$statusCode = Resources::STATUS_CREATED;
$contentStream = Psr7\stream_for($content);
$body = $contentStream->getContents();
@ -2222,9 +2304,9 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$content,
Models\AppendBlockOptions $options = null
) {
Validate::isString($container, 'container');
Validate::canCastAsString($container, 'container');
Validate::notNullOrEmpty($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
if (is_null($options)) {
@ -2235,7 +2317,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$statusCode = Resources::STATUS_CREATED;
$contentStream = Psr7\stream_for($content);
@ -2377,7 +2459,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @param string $container The container name.
* @param string $blob The blob name.
* @param Models\BlockList|array $blockList The block entries.
* @param Models\BlockList|Block[] $blockList The block entries.
* @param Models\CommitBlobBlocksOptions $options The optional parameters.
*
* @return Models\PutBlobResult
@ -2411,7 +2493,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
*
* @param string $container The container name.
* @param string $blob The blob name.
* @param Models\BlockList|array $blockList The block entries.
* @param Models\BlockList|Block[] $blockList The block entries.
* @param Models\CommitBlobBlocksOptions $options The optional parameters.
*
* @return \GuzzleHttp\Promise\PromiseInterface
@ -2424,8 +2506,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blockList,
Models\CommitBlobBlocksOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
Validate::isTrue(
$blockList instanceof BlockList || is_array($blockList),
@ -2440,7 +2522,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
$isArray = is_array($blockList);
$blockList = $isArray ? BlockList::create($blockList) : $blockList;
$body = $blockList->toXml($this->dataSerializer);
@ -2582,15 +2664,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\ListBlobBlocksOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_GET;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new ListBlobBlocksOptions();
@ -2676,15 +2758,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\GetBlobPropertiesOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_HEAD;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new GetBlobPropertiesOptions();
@ -2756,15 +2838,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\GetBlobMetadataOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_HEAD;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new GetBlobMetadataOptions();
@ -2848,15 +2930,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\ListPageBlobRangesOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_GET;
$headers = array();
$queryParams = array();
$postParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new ListPageBlobRangesOptions();
@ -2867,7 +2949,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$options->getAccessConditions()
);
$headers = $this->_addOptionalRangeHeader(
$headers = $this->ddOptionalRangeHeader(
$headers,
$options->getRangeStart(),
$options->getRangeEnd()
@ -2948,15 +3030,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\SetBlobPropertiesOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_PUT;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new SetBlobPropertiesOptions();
@ -3093,8 +3175,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
array $metadata,
Models\BlobServiceOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
Utilities::validateMetadata($metadata);
@ -3102,7 +3184,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new BlobServiceOptions();
@ -3251,14 +3333,14 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\GetBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
$method = Resources::HTTP_GET;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new GetBlobOptions();
@ -3269,7 +3351,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers,
$options->getAccessConditions()
);
$headers = $this->_addOptionalRangeHeader(
$headers = $this->ddOptionalRangeHeader(
$headers,
$options->getRangeStart(),
$options->getRangeEnd()
@ -3358,15 +3440,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\DeleteBlobOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_DELETE;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new DeleteBlobOptions();
@ -3451,15 +3533,15 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$blob,
Models\CreateBlobSnapshotOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::notNullOrEmpty($blob, 'blob');
$method = Resources::HTTP_PUT;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $this->_createPath($container, $blob);
$path = $this->createPath($container, $blob);
if (is_null($options)) {
$options = new CreateBlobSnapshotOptions();
@ -3558,7 +3640,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$destinationBlobPath = $this->_createPath(
$destinationBlobPath = $this->createPath(
$destinationContainer,
$destinationBlob
);
@ -3567,7 +3649,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$options = new CopyBlobOptions();
}
$sourceBlobPath = $this->_getCopyBlobSourceName(
$sourceBlobPath = $this->getCopyBlobSourceName(
$sourceContainer,
$sourceBlob,
$options
@ -3665,9 +3747,9 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$copyId,
Models\BlobServiceOptions $options = null
) {
Validate::isString($container, 'container');
Validate::isString($blob, 'blob');
Validate::isString($copyId, 'copyId');
Validate::canCastAsString($container, 'container');
Validate::canCastAsString($blob, 'blob');
Validate::canCastAsString($copyId, 'copyId');
Validate::notNullOrEmpty($container, 'container');
Validate::notNullOrEmpty($blob, 'blob');
Validate::notNullOrEmpty($copyId, 'copyId');
@ -3676,7 +3758,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$headers = array();
$postParams = array();
$queryParams = array();
$destinationBlobPath = $this->_createPath(
$destinationBlobPath = $this->createPath(
$container,
$blob
);
@ -3734,9 +3816,12 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
* @param string $container name of the container
* @param string $blob name of the blob
* @param string $proposedLeaseId lease id when acquiring
* @param int $leaseDuration the lease duration. A non-infinite
* lease can be between 15 and 60 seconds.
* Default is never to expire.
* @param int $leaseDuration the lease duration.
* A non-infinite
* lease can be between
* 15 and 60 seconds.
* Default is never
* to expire.
* @param Models\BlobServiceOptions $options optional parameters
*
* @return Models\LeaseResult
@ -3766,9 +3851,12 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
* @param string $container name of the container
* @param string $blob name of the blob
* @param string $proposedLeaseId lease id when acquiring
* @param int $leaseDuration the lease duration. A non-infinite
* lease can be between 15 and 60 seconds.
* Default is never to expire.
* @param int $leaseDuration the lease duration.
* A non-infinite
* lease can be between
* 15 and 60 seconds.
* Default is never to
* expire.
* @param Models\BlobServiceOptions $options optional parameters
*
* @return \GuzzleHttp\Promise\PromiseInterface
@ -3790,7 +3878,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$leaseDuration = -1;
}
return $this->_putLeaseAsyncImpl(
return $this->putLeaseAsyncImpl(
LeaseMode::ACQUIRE_ACTION,
$container,
$blob,
@ -3857,7 +3945,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$proposedLeaseId,
Models\BlobServiceOptions $options = null
) {
return $this->_putLeaseAsyncImpl(
return $this->putLeaseAsyncImpl(
LeaseMode::CHANGE_ACTION,
$container,
$blob,
@ -3918,7 +4006,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$leaseId,
Models\BlobServiceOptions $options = null
) {
return $this->_putLeaseAsyncImpl(
return $this->putLeaseAsyncImpl(
LeaseMode::RENEW_ACTION,
$container,
$blob,
@ -3976,7 +4064,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$leaseId,
Models\BlobServiceOptions $options = null
) {
return $this->_putLeaseAsyncImpl(
return $this->putLeaseAsyncImpl(
LeaseMode::RELEASE_ACTION,
$container,
$blob,
@ -4035,7 +4123,7 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
$breakPeriod = null,
Models\BlobServiceOptions $options = null
) {
return $this->_putLeaseAsyncImpl(
return $this->putLeaseAsyncImpl(
LeaseMode::BREAK_ACTION,
$container,
$blob,
@ -4089,8 +4177,8 @@ class BlobRestProxy extends ServiceRestProxy implements IBlob
/**
* Adds optional header to headers if set
*
* @param array $headers The array of request headers.
* @param array $accessCondition The access condition object.
* @param array $headers The array of request headers.
* @param array $accessCondition The access condition object.
*
* @return array
*/

Просмотреть файл

@ -762,10 +762,10 @@ interface IBlob
* block list or from the uncommitted block list, or to commit the most recently
* uploaded version of the block, whichever list it may belong to.
*
* @param string $container name of the container
* @param string $blob name of the blob
* @param BlobModels\BlockList|array $blockList the block list entries
* @param BlobModels\CommitBlobBlocksOptions $options optional parameters
* @param string $container name of the container
* @param string $blob name of the blob
* @param BlobModels\BlockList|BlobModels\Block[] $blockList the block list entries
* @param BlobModels\CommitBlobBlocksOptions $options optional parameters
*
* @return BlobModels\PutBlobResult
*
@ -789,11 +789,11 @@ interface IBlob
* block list or from the uncommitted block list, or to commit the most recently
* uploaded version of the block, whichever list it may belong to.
*
* @param string $container The container name.
* @param string $blob The blob name.
* @param BlobModels\BlockList|array $blockList The block entries.
* @param BlobModels\CommitBlobBlocksOptions $options The optional
* parameters.
* @param string $container name of the container
* @param string $blob name of the blob
* @param BlobModels\BlockList|BlobModels\Block[] $blockList the block list
* entries
* @param BlobModels\CommitBlobBlocksOptions $options optional parameters
*
* @return \GuzzleHttp\Promise\PromiseInterface
*

Просмотреть файл

@ -36,9 +36,9 @@ namespace MicrosoftAzure\Storage\Blob\Models;
*/
class AppendBlockOptions extends BlobServiceOptions
{
private $_contentMD5;
private $_maxBlobSize;
private $_appendPosition;
private $contentMD5;
private $maxBlobSize;
private $appendPosition;
/**
* Gets block contentMD5.
@ -47,7 +47,7 @@ class AppendBlockOptions extends BlobServiceOptions
*/
public function getContentMD5()
{
return $this->_contentMD5;
return $this->contentMD5;
}
/**
@ -59,7 +59,7 @@ class AppendBlockOptions extends BlobServiceOptions
*/
public function setContentMD5($contentMD5)
{
$this->_contentMD5 = $contentMD5;
$this->contentMD5 = $contentMD5;
}
/**
@ -69,7 +69,7 @@ class AppendBlockOptions extends BlobServiceOptions
*/
public function getMaxBlobSize()
{
return $this->_maxBlobSize;
return $this->maxBlobSize;
}
/**
@ -81,7 +81,7 @@ class AppendBlockOptions extends BlobServiceOptions
*/
public function setMaxBlobSize($maxBlobSize)
{
$this->_maxBlobSize = $maxBlobSize;
$this->maxBlobSize = $maxBlobSize;
}
/**
@ -91,7 +91,7 @@ class AppendBlockOptions extends BlobServiceOptions
*/
public function getAppendPosition()
{
return $this->_appendPosition;
return $this->appendPosition;
}
/**
@ -103,6 +103,6 @@ class AppendBlockOptions extends BlobServiceOptions
*/
public function setAppendPosition($appendPosition)
{
$this->_appendPosition = $appendPosition;
$this->appendPosition = $appendPosition;
}
}

Просмотреть файл

@ -1,56 +0,0 @@
<?php
/**
* LICENSE: The MIT License (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://github.com/azure/azure-storage-php/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PHP version 5
*
* @ignore
* @category Microsoft
* @package MicrosoftAzure\Storage\Blob\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Blob\Models;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationToken;
/**
* Trait implementing logic for Blob continuation tokens.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Blob\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
trait BlobContinuationTokenTrait
{
use MarkerContinuationTokenTrait;
/**
* Creates a continuation token if current one is null.
*
* @return void
*/
private function createContinuationTokenIfNotExist()
{
if ($this->continuationToken == null) {
$this->continuationToken = new BlobContinuationToken();
}
}
}

Просмотреть файл

@ -40,7 +40,7 @@ use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer;
*/
class BlockList
{
private $_entries;
private $entries;
private static $xmlRootName = 'BlockList';
/**
@ -71,7 +71,7 @@ class BlockList
*/
public function addEntry($blockId, $type)
{
Validate::isString($blockId, 'blockId');
Validate::canCastAsString($blockId, 'blockId');
Validate::isTrue(
BlobBlockType::isValid($type),
sprintf(Resources::INVALID_BTE_MSG, get_class(new BlobBlockType()))
@ -80,7 +80,7 @@ class BlockList
$block->setBlockId($blockId);
$block->setType($type);
$this->_entries[] = $block;
$this->entries[] = $block;
}
/**
@ -128,7 +128,7 @@ class BlockList
*/
public function getEntry($blockId)
{
foreach ($this->_entries as $value) {
foreach ($this->entries as $value) {
if ($blockId == $value->getBlockId()) {
return $value;
}
@ -144,7 +144,7 @@ class BlockList
*/
public function getEntries()
{
return $this->_entries;
return $this->entries;
}
/**
@ -161,7 +161,7 @@ class BlockList
$properties = array(XmlSerializer::ROOT_NAME => self::$xmlRootName);
$array = array();
foreach ($this->_entries as $value) {
foreach ($this->entries as $value) {
$array[] = array(
$value->getType() => $value->getBlockId()
);

Просмотреть файл

@ -118,7 +118,7 @@ class CreateBlobPagesResult
*/
protected function setETag($etag)
{
Validate::isString($etag, 'etag');
Validate::canCastAsString($etag, 'etag');
$this->_etag = $etag;
}

Просмотреть файл

@ -70,7 +70,7 @@ class CreateContainerOptions extends BlobServiceOptions
*/
public function setPublicAccess($publicAccess)
{
Validate::isString($publicAccess, 'publicAccess');
Validate::canCastAsString($publicAccess, 'publicAccess');
$this->_publicAccess = $publicAccess;
}

Просмотреть файл

@ -39,7 +39,7 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
*/
class LeaseResult
{
private $_leaseId;
private $leaseId;
/**
* Creates LeaseResult from response headers
@ -68,7 +68,7 @@ class LeaseResult
*/
public function getLeaseId()
{
return $this->_leaseId;
return $this->leaseId;
}
/**
@ -80,6 +80,6 @@ class LeaseResult
*/
protected function setLeaseId($leaseId)
{
$this->_leaseId = $leaseId;
$this->leaseId = $leaseId;
}
}

Просмотреть файл

@ -40,12 +40,12 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
*/
class ListBlobBlocksResult
{
private $_lastModified;
private $_etag;
private $_contentType;
private $_contentLength;
private $_committedBlocks;
private $_uncommittedBlocks;
private $lastModified;
private $etag;
private $contentType;
private $contentLength;
private $committedBlocks;
private $uncommittedBlocks;
/**
* Gets block entries from parsed response
@ -55,7 +55,7 @@ class ListBlobBlocksResult
*
* @return array
*/
private static function _getEntries(array $parsed, $type)
private static function getEntries(array $parsed, $type)
{
$entries = array();
@ -107,11 +107,11 @@ class ListBlobBlocksResult
Utilities::tryGetValue($clean, Resources::CONTENT_TYPE)
);
$result->_uncommittedBlocks = self::_getEntries(
$result->uncommittedBlocks = self::getEntries(
$parsed,
'UncommittedBlocks'
);
$result->_committedBlocks = self::_getEntries($parsed, 'CommittedBlocks');
$result->committedBlocks = self::getEntries($parsed, 'CommittedBlocks');
return $result;
}
@ -123,7 +123,7 @@ class ListBlobBlocksResult
*/
public function getLastModified()
{
return $this->_lastModified;
return $this->lastModified;
}
/**
@ -136,7 +136,7 @@ class ListBlobBlocksResult
protected function setLastModified(\DateTime $lastModified)
{
Validate::isDate($lastModified);
$this->_lastModified = $lastModified;
$this->lastModified = $lastModified;
}
/**
@ -146,7 +146,7 @@ class ListBlobBlocksResult
*/
public function getETag()
{
return $this->_etag;
return $this->etag;
}
/**
@ -158,7 +158,7 @@ class ListBlobBlocksResult
*/
protected function setETag($etag)
{
$this->_etag = $etag;
$this->etag = $etag;
}
/**
@ -168,7 +168,7 @@ class ListBlobBlocksResult
*/
public function getContentType()
{
return $this->_contentType;
return $this->contentType;
}
/**
@ -180,7 +180,7 @@ class ListBlobBlocksResult
*/
protected function setContentType($contentType)
{
$this->_contentType = $contentType;
$this->contentType = $contentType;
}
/**
@ -190,7 +190,7 @@ class ListBlobBlocksResult
*/
public function getContentLength()
{
return $this->_contentLength;
return $this->contentLength;
}
/**
@ -203,7 +203,7 @@ class ListBlobBlocksResult
protected function setContentLength($contentLength)
{
Validate::isInteger($contentLength, 'contentLength');
$this->_contentLength = $contentLength;
$this->contentLength = $contentLength;
}
/**
@ -213,7 +213,7 @@ class ListBlobBlocksResult
*/
public function getUncommittedBlocks()
{
return $this->_uncommittedBlocks;
return $this->uncommittedBlocks;
}
/**
@ -225,7 +225,7 @@ class ListBlobBlocksResult
*/
protected function setUncommittedBlocks(array $uncommittedBlocks)
{
$this->_uncommittedBlocks = $uncommittedBlocks;
$this->uncommittedBlocks = $uncommittedBlocks;
}
/**
@ -235,7 +235,7 @@ class ListBlobBlocksResult
*/
public function getCommittedBlocks()
{
return $this->_committedBlocks;
return $this->committedBlocks;
}
/**
@ -247,6 +247,6 @@ class ListBlobBlocksResult
*/
protected function setCommittedBlocks(array $committedBlocks)
{
$this->_committedBlocks = $committedBlocks;
$this->committedBlocks = $committedBlocks;
}
}

Просмотреть файл

@ -26,8 +26,6 @@ namespace MicrosoftAzure\Storage\Blob\Models;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationToken;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationTokenTrait;
/**
* Optional parameters for listBlobs API.
@ -41,7 +39,7 @@ use MicrosoftAzure\Storage\Blob\Models\BlobContinuationTokenTrait;
*/
class ListBlobsOptions extends BlobServiceOptions
{
use BlobContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $_prefix;
private $_delimiter;
@ -70,7 +68,7 @@ class ListBlobsOptions extends BlobServiceOptions
*/
public function setPrefix($prefix)
{
Validate::isString($prefix, 'prefix');
Validate::canCastAsString($prefix, 'prefix');
$this->_prefix = $prefix;
}
@ -93,7 +91,7 @@ class ListBlobsOptions extends BlobServiceOptions
*/
public function setDelimiter($delimiter)
{
Validate::isString($delimiter, 'delimiter');
Validate::canCastAsString($delimiter, 'delimiter');
$this->_delimiter = $delimiter;
}

Просмотреть файл

@ -24,11 +24,11 @@
namespace MicrosoftAzure\Storage\Blob\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Blob\Models\Blob;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationToken;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
use MicrosoftAzure\Storage\Common\Exceptions\InvalidArgumentTypeException;
/**
@ -43,7 +43,7 @@ use MicrosoftAzure\Storage\Common\Exceptions\InvalidArgumentTypeException;
*/
class ListBlobsResult
{
use BlobContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $_blobPrefixes;
private $_blobs;
@ -87,15 +87,17 @@ class ListBlobsResult
Resources::QP_MARKER
));
$result->setContinuationToken(
new BlobContinuationToken(
Utilities::tryGetValue(
$parsed,
Resources::QP_NEXT_MARKER
),
$location
)
);
$nextMarker =
Utilities::tryGetValue($parsed, Resources::QP_NEXT_MARKER);
if ($nextMarker != null) {
$result->setContinuationToken(
new MarkerContinuationToken(
$nextMarker,
$location
)
);
}
$result->setMaxResults(intval(
Utilities::tryGetValue($parsed, Resources::QP_MAX_RESULTS, 0)

Просмотреть файл

@ -25,8 +25,7 @@
namespace MicrosoftAzure\Storage\Blob\Models;
use MicrosoftAzure\Storage\Blob\Models\BlobServiceOptions;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationToken;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Internal\Validate;
/**
@ -41,7 +40,7 @@ use MicrosoftAzure\Storage\Common\Internal\Validate;
*/
class ListContainersOptions extends BlobServiceOptions
{
use BlobContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $_prefix;
private $_maxResults;
@ -68,7 +67,7 @@ class ListContainersOptions extends BlobServiceOptions
*/
public function setPrefix($prefix)
{
Validate::isString($prefix, 'prefix');
Validate::canCastAsString($prefix, 'prefix');
$this->_prefix = $prefix;
}
@ -99,7 +98,7 @@ class ListContainersOptions extends BlobServiceOptions
*/
public function setMaxResults($maxResults)
{
Validate::isString($maxResults, 'maxResults');
Validate::canCastAsString($maxResults, 'maxResults');
$this->_maxResults = $maxResults;
}

Просмотреть файл

@ -27,8 +27,8 @@ namespace MicrosoftAzure\Storage\Blob\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\Blob\Models\Container;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationToken;
use MicrosoftAzure\Storage\Blob\Models\BlobContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
/**
* Container to hold list container response object.
@ -42,7 +42,7 @@ use MicrosoftAzure\Storage\Blob\Models\BlobContinuationTokenTrait;
*/
class ListContainersResult
{
use BlobContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $_containers;
private $_prefix;
@ -80,15 +80,19 @@ class ListContainersResult
$parsedResponse,
Resources::QP_MARKER
));
$result->setContinuationToken(
new BlobContinuationToken(
Utilities::tryGetValue(
$parsedResponse,
Resources::QP_NEXT_MARKER
),
$location
)
);
$nextMarker =
Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
if ($nextMarker != null) {
$result->setContinuationToken(
new MarkerContinuationToken(
$nextMarker,
$location
)
);
}
$result->setMaxResults(Utilities::tryGetValue(
$parsedResponse,
Resources::QP_MAX_RESULTS

Просмотреть файл

@ -128,7 +128,7 @@ class ListPageBlobRangesResult
*/
protected function setETag($etag)
{
Validate::isString($etag, 'etag');
Validate::canCastAsString($etag, 'etag');
$this->_etag = $etag;
}

Просмотреть файл

@ -110,7 +110,7 @@ class SetBlobMetadataResult
*/
protected function setETag($etag)
{
Validate::isString($etag, 'etag');
Validate::canCastAsString($etag, 'etag');
$this->_etag = $etag;
}
}

Просмотреть файл

@ -115,7 +115,7 @@ class SetBlobPropertiesResult
*/
protected function setETag($etag)
{
Validate::isString($etag, 'etag');
Validate::canCastAsString($etag, 'etag');
$this->_etag = $etag;
}

Просмотреть файл

@ -80,7 +80,7 @@ class CloudConfigurationManager
*/
public static function getConnectionString($key)
{
Validate::isString($key, 'key');
Validate::canCastAsString($key, 'key');
self::_init();
$value = null;
@ -110,7 +110,7 @@ class CloudConfigurationManager
*/
public static function registerSource($name, $provider = null, $prepend = false)
{
Validate::isString($name, 'name');
Validate::canCastAsString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
self::_init();
@ -140,7 +140,7 @@ class CloudConfigurationManager
*/
public static function unregisterSource($name)
{
Validate::isString($name, 'name');
Validate::canCastAsString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
self::_init();

Просмотреть файл

@ -185,12 +185,12 @@ abstract class ACLBase
\DateTime $expiry,
$permissions
) {
Validate::isString($id, 'id');
Validate::canCastAsString($id, 'id');
if ($start != null) {
Validate::isDate($start);
}
Validate::isDate($expiry);
Validate::isString($permissions, 'permissions');
Validate::canCastAsString($permissions, 'permissions');
$accessPolicy = new AccessPolicy($this->getResourceType());
$accessPolicy->setStart($start);
@ -222,7 +222,7 @@ abstract class ACLBase
*/
public function removeSignedIdentifier($id)
{
Validate::isString($id, 'id');
Validate::canCastAsString($id, 'id');
//var_dump($this->signedIdentifiers);
for ($i = 0; $i < count($this->signedIdentifiers); ++$i) {
if ($this->signedIdentifiers[$i]->getId() == $id) {

Просмотреть файл

@ -60,9 +60,9 @@ class ConnectionStringParser
*/
public static function parseConnectionString($argumentName, $connectionString)
{
Validate::isString($argumentName, 'argumentName');
Validate::canCastAsString($argumentName, 'argumentName');
Validate::notNullOrEmpty($argumentName, 'argumentName');
Validate::isString($connectionString, 'connectionString');
Validate::canCastAsString($connectionString, 'connectionString');
Validate::notNullOrEmpty($connectionString, 'connectionString');
$parser = new ConnectionStringParser($argumentName, $connectionString);

Просмотреть файл

@ -65,7 +65,7 @@ class ConnectionStringSource
*/
public static function environmentSource($key)
{
Validate::isString($key, 'key');
Validate::canCastAsString($key, 'key');
return getenv($key);
}

Просмотреть файл

@ -87,7 +87,7 @@ class HttpCallContext
*/
public function setMethod($method)
{
Validate::isString($method, 'method');
Validate::canCastAsString($method, 'method');
$this->_method = $method;
}
@ -165,7 +165,7 @@ class HttpCallContext
*/
public function setUri($uri)
{
Validate::isString($uri, 'uri');
Validate::canCastAsString($uri, 'uri');
$this->_uri = $uri;
}
@ -189,7 +189,7 @@ class HttpCallContext
*/
public function setPath($path)
{
Validate::isString($path, 'path');
Validate::canCastAsString($path, 'path');
$this->_path = $path;
}
@ -238,7 +238,7 @@ class HttpCallContext
*/
public function setBody($body)
{
Validate::isString($body, 'body');
Validate::canCastAsString($body, 'body');
$this->_body = $body;
}
@ -253,8 +253,8 @@ class HttpCallContext
*/
public function addHeader($name, $value)
{
Validate::isString($name, 'name');
Validate::isString($value, 'value');
Validate::canCastAsString($name, 'name');
Validate::canCastAsString($value, 'value');
$this->_headers[$name] = $value;
}
@ -271,8 +271,8 @@ class HttpCallContext
*/
public function addOptionalHeader($name, $value)
{
Validate::isString($name, 'name');
Validate::isString($value, 'value');
Validate::canCastAsString($name, 'name');
Validate::canCastAsString($value, 'value');
if (!empty($value)) {
$this->_headers[$name] = $value;
@ -288,7 +288,7 @@ class HttpCallContext
*/
public function removeHeader($name)
{
Validate::isString($name, 'name');
Validate::canCastAsString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
unset($this->_headers[$name]);
@ -304,8 +304,8 @@ class HttpCallContext
*/
public function addQueryParameter($name, $value)
{
Validate::isString($name, 'name');
Validate::isString($value, 'value');
Validate::canCastAsString($name, 'name');
Validate::canCastAsString($value, 'value');
$this->_queryParams[$name] = $value;
}
@ -345,8 +345,8 @@ class HttpCallContext
*/
public function addOptionalQueryParameter($name, $value)
{
Validate::isString($name, 'name');
Validate::isString($value, 'value');
Validate::canCastAsString($name, 'name');
Validate::canCastAsString($value, 'value');
if (!empty($value)) {
$this->_queryParams[$name] = $value;

Просмотреть файл

@ -57,7 +57,7 @@ class CommonRequestMiddleware extends MiddlewareBase
* @param array $headers The headers to be added.
*/
public function __construct(
IAuthScheme $authenticationScheme,
IAuthScheme $authenticationScheme = null,
array $headers = array()
) {
$this->authenticationScheme = $authenticationScheme;
@ -104,8 +104,10 @@ class CommonRequestMiddleware extends MiddlewareBase
if (!$result->hasHeader(Resources::X_MS_REQUEST_ID)) {
$result = $result->withHeader(Resources::X_MS_REQUEST_ID, \uniqid());
}
//Signing the request.
return $this->authenticationScheme->signRequest($result);
//Sign the request if authentication scheme is not null.
$request = $this->authenticationScheme == null ?
$request : $this->authenticationScheme->signRequest($result);
return $request;
}
/**

Просмотреть файл

@ -141,6 +141,8 @@ class Resources
const RESOURCE_RANGE_LENGTH_MUST_SET = "The start and end/length of the range must be set.";
const INVALID_ACCEPT_CONTENT_TYPE = "The given accept content type is not valid.";
const ERROR_CANNOT_PARSE_XML = "Cannot parse XML, reasons: %s";
const INVALID_SCHEME = 'HTTP scheme can only be string \'http\' or \'https\'.';
const CONTENT_SIZE_TOO_LARGE = 'The content is too large for the selected blob type.';
// HTTP Headers
const X_MS_HEADER_PREFIX = 'x-ms-';
@ -279,8 +281,13 @@ class Resources
const MB_IN_BYTES_4 = 4194304;
const MB_IN_BYTES_32 = 33554432;
const MB_IN_BYTES_64 = 67108864;
const MB_IN_BYTES_128 = 134217728;
const MB_IN_BYTES_256 = 268435456;
const MB_IN_BYTES_100 = 104857600;
const GB_IN_BYTES = 1073741824;
const GB_IN_BYTES_200 = 214748364800;
const MAX_BLOB_BLOCKS = 50000;
const MAX_BLOCK_BLOB_SIZE = 5242880000000;
const RETURN_CONTENT = 'return-content';
// Xml Namespaces
@ -294,13 +301,11 @@ class Resources
const DEAFULT_RETRY_INTERVAL = 1000;//Milliseconds
// Header values
const SDK_VERSION = '0.16.0';
const STORAGE_API_LATEST_VERSION = '2015-04-05';
const SDK_VERSION = '1.0.0-beta.1';
const STORAGE_API_LATEST_VERSION = '2016-05-31';
const DATA_SERVICE_VERSION_VALUE = '3.0';
const MAX_DATA_SERVICE_VERSION_VALUE = '3.0;NetFx';
const ACCEPT_HEADER_VALUE = 'application/atom+xml,application/xml';
const ATOM_ENTRY_CONTENT_TYPE = 'application/atom+xml;type=entry;charset=utf-8';
const ATOM_FEED_CONTENT_TYPE = 'application/atom+xml;type=feed;charset=utf-8';
const ACCEPT_HEADER_VALUE = 'application/json';
const JSON_FULL_METADATA_CONTENT_TYPE = 'application/json;odata=fullmetadata';
const JSON_MINIMAL_METADATA_CONTENT_TYPE = 'application/json;odata=minimalmetadata';
const JSON_NO_METADATA_CONTENT_TYPE = 'application/json;odata=nometadata';
@ -365,7 +370,6 @@ class Resources
const XML_CONTENT_TYPE = 'application/xml';
const JSON_CONTENT_TYPE = 'application/json';
const BINARY_FILE_TYPE = 'application/octet-stream';
const XML_ATOM_CONTENT_TYPE = 'application/atom+xml';
const HTTP_TYPE = 'application/http';
const MULTIPART_MIXED_TYPE = 'multipart/mixed';

Просмотреть файл

@ -102,8 +102,8 @@ class RestProxy
protected function addOptionalQueryParam(array &$queryParameters, $key, $value)
{
Validate::isArray($queryParameters, 'queryParameters');
Validate::isString($key, 'key');
Validate::isString($value, 'value');
Validate::canCastAsString($key, 'key');
Validate::canCastAsString($value, 'value');
if (!is_null($value) && Resources::EMPTY_STRING !== $value) {
$queryParameters[$key] = $value;
@ -124,8 +124,8 @@ class RestProxy
protected function addOptionalHeader(array &$headers, $key, $value)
{
Validate::isArray($headers, 'headers');
Validate::isString($key, 'key');
Validate::isString($value, 'value');
Validate::canCastAsString($key, 'key');
Validate::canCastAsString($value, 'value');
if (!is_null($value) && Resources::EMPTY_STRING !== $value) {
$headers[$key] = $value;

Просмотреть файл

@ -50,7 +50,7 @@ class JsonSerializer implements ISerializer
public static function objectSerialize($targetObject, $rootName)
{
Validate::notNull($targetObject, 'targetObject');
Validate::isString($rootName, 'rootName');
Validate::canCastAsString($rootName, 'rootName');
$contianer = new \stdClass();
@ -84,7 +84,7 @@ class JsonSerializer implements ISerializer
*/
public function unserialize($serialized)
{
Validate::isString($serialized, 'serialized');
Validate::canCastAsString($serialized, 'serialized');
$json = json_decode($serialized);
if ($json && !is_array($json)) {

Просмотреть файл

@ -54,11 +54,11 @@ class XmlSerializer implements ISerializer
*
* @return array
*/
private function _sxml2arr($sxml, array $arr = null)
private function sxml2arr($sxml, array $arr = null)
{
foreach ((array) $sxml as $key => $value) {
if (is_object($value) || (is_array($value))) {
$arr[$key] = $this->_sxml2arr($value);
$arr[$key] = $this->sxml2arr($value);
} else {
$arr[$key] = $value;
}
@ -77,7 +77,7 @@ class XmlSerializer implements ISerializer
*
* @return void
*/
private function _arr2xml(\XMLWriter $xmlw, array $data, $defaultTag = null)
private function arr2xml(\XMLWriter $xmlw, array $data, $defaultTag = null)
{
foreach ($data as $key => $value) {
if ($key === Resources::XTAG_ATTRIBUTES) {
@ -93,7 +93,7 @@ class XmlSerializer implements ISerializer
}
}
$this->_arr2xml($xmlw, $value);
$this->arr2xml($xmlw, $value);
if (!is_int($key)) {
$xmlw->endElement();
@ -113,7 +113,7 @@ class XmlSerializer implements ISerializer
*
* @return mixed
*/
private static function _getInstanceAttributes($targetObject, array $methodArray)
private static function getInstanceAttributes($targetObject, array $methodArray)
{
foreach ($methodArray as $method) {
if ($method->name == 'getAttributes') {
@ -135,13 +135,13 @@ class XmlSerializer implements ISerializer
public static function objectSerialize($targetObject, $rootName)
{
Validate::notNull($targetObject, 'targetObject');
Validate::isString($rootName, 'rootName');
Validate::canCastAsString($rootName, 'rootName');
$xmlWriter = new \XmlWriter();
$xmlWriter->openMemory();
$xmlWriter->setIndent(true);
$reflectionClass = new \ReflectionClass($targetObject);
$methodArray = $reflectionClass->getMethods();
$attributes = self::_getInstanceAttributes(
$attributes = self::getInstanceAttributes(
$targetObject,
$methodArray
);
@ -222,7 +222,7 @@ class XmlSerializer implements ISerializer
}
unset($array[Resources::XTAG_NAMESPACE]);
self::_arr2xml($xmlw, $array, $defaultTag);
self::arr2xml($xmlw, $array, $defaultTag);
$xmlw->endElement();
@ -240,6 +240,6 @@ class XmlSerializer implements ISerializer
{
$sxml = new \SimpleXMLElement($serialized);
return $this->_sxml2arr($sxml);
return $this->sxml2arr($sxml);
}
}

Просмотреть файл

@ -635,7 +635,7 @@ class Utilities
*/
public static function base256ToDec($number)
{
Validate::isString($number, 'number');
Validate::canCastAsString($number, 'number');
$result = 0;
$base = 1;
@ -734,8 +734,8 @@ class Utilities
}
foreach ($metadata as $key => $value) {
Validate::isString($key, 'metadata key');
Validate::isString($value, 'metadata value');
Validate::canCastAsString($key, 'metadata key');
Validate::canCastAsString($value, 'metadata value');
}
}
@ -862,8 +862,18 @@ class Utilities
public static function calculateContentMD5($content)
{
Validate::notNull($content, 'content');
Validate::isString($content, 'content');
Validate::canCastAsString($content, 'content');
return base64_encode(md5($content, true));
}
/**
* Return if the environment is in 64 bit PHP.
*
* @return bool
*/
public static function is64BitPHP()
{
return PHP_INT_SIZE == 8;
}
}

Просмотреть файл

@ -58,7 +58,7 @@ class Validate
}
/**
* Throws exception if the provided variable type is not string.
* Throws exception if the provided variable can not convert to a string.
*
* @param mixed $var The variable to check.
* @param string $name The parameter name.
@ -67,7 +67,7 @@ class Validate
*
* @return void
*/
public static function isString($var, $name)
public static function canCastAsString($var, $name)
{
try {
(string)$var;
@ -315,7 +315,7 @@ class Validate
*/
public static function isA($objectInstance, $class, $name)
{
Validate::isString($class, 'class');
Validate::canCastAsString($class, 'class');
Validate::notNull($objectInstance, 'objectInstance');
Validate::isObject($objectInstance, 'objectInstance');
@ -347,7 +347,7 @@ class Validate
*/
public static function methodExists($objectInstance, $method, $name)
{
Validate::isString($method, 'method');
Validate::canCastAsString($method, 'method');
Validate::notNull($objectInstance, 'objectInstance');
Validate::isObject($objectInstance, 'objectInstance');
@ -376,7 +376,7 @@ class Validate
*/
public static function isDateString($value, $name)
{
Validate::isString($value, 'value');
Validate::canCastAsString($value, 'value');
try {
new \DateTime($value);

Просмотреть файл

@ -25,7 +25,7 @@
namespace MicrosoftAzure\Storage\Common;
use MicrosoftAzure\Storage\Common\Models\ContinuationToken;
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
/**
* Trait implementing logic for continuation tokens that has nextMarker.
@ -44,16 +44,19 @@ trait MarkerContinuationTokenTrait
/**
* Setter for continuationToken
*
* @param ContinuationToken $continuationToken the continuation token to be set.
* @param MarkerContinuationToken|null $continuationToken the continuation
* token to be set.
*/
public function setContinuationToken(ContinuationToken $continuationToken)
public function setContinuationToken(MarkerContinuationToken $continuationToken = null)
{
$this->continuationToken = $continuationToken;
}
public function setMarker($marker)
{
$this->createContinuationTokenIfNotExist();
if ($this->continuationToken == null) {
$this->continuationToken = new MarkerContinuationToken();
};
$this->continuationToken->setNextMarker($marker);
}
@ -74,7 +77,9 @@ trait MarkerContinuationTokenTrait
*/
public function getNextMarker()
{
$this->createContinuationTokenIfNotExist();
if ($this->continuationToken == null) {
return null;
}
return $this->continuationToken->getNextMarker();
}
@ -85,14 +90,17 @@ trait MarkerContinuationTokenTrait
*/
public function getLocation()
{
$this->createContinuationTokenIfNotExist();
if ($this->continuationToken == null) {
return null;
}
return $this->continuationToken->getLocation();
}
public function getLocationMode()
{
$this->createContinuationTokenIfNotExist();
if ($this->continuationToken->getLocation() == '') {
if ($this->continuationToken == null) {
return parent::getLocationMode();
} elseif ($this->continuationToken->getLocation() == '') {
return parent::getLocationMode();
} else {
return $this->getLocation();

Просмотреть файл

@ -73,7 +73,7 @@ class AccessPolicy
*/
public function __construct($resourceType = Resources::RESOURCE_TYPE_BLOB)
{
Validate::isString($resourceType, 'resourceType');
Validate::canCastAsString($resourceType, 'resourceType');
Validate::isTrue(
$resourceType == Resources::RESOURCE_TYPE_BLOB ||
$resourceType == Resources::RESOURCE_TYPE_CONTAINER ||

Просмотреть файл

@ -55,7 +55,7 @@ class ContinuationToken
*/
public function setLocation($location)
{
Validate::isString($location, 'location');
Validate::canCastAsString($location, 'location');
Validate::isTrue(
$location == LocationMode::PRIMARY_ONLY ||
$location == LocationMode::SECONDARY_ONLY ||

Просмотреть файл

@ -15,29 +15,30 @@
* PHP version 5
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Blob\Models
* @package MicrosoftAzure\Storage\Common\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Blob\Models;
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Models\ContinuationToken;
/**
* Provides functionality and data structure for blob continuation token.
* Provides functionality and data structure for continuation token that
* contains next marker.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Blob\Models
* @package MicrosoftAzure\Storage\Common\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
class BlobContinuationToken extends ContinuationToken
class MarkerContinuationToken extends ContinuationToken
{
private $nextMarker;
@ -56,7 +57,7 @@ class BlobContinuationToken extends ContinuationToken
*/
public function setNextMarker($nextMarker)
{
Validate::isString($nextMarker, 'nextMarker');
Validate::canCastAsString($nextMarker, 'nextMarker');
$this->nextMarker = $nextMarker;
}

Просмотреть файл

@ -282,6 +282,47 @@ class ServicesBuilder
return $blobWrapper;
}
/**
* Builds an anonymous access object with given primary and secondary
* service endpoint. The service endpoint should contain a scheme and a
* host, e.g.:
* https://www.contoso.com
* http://mystorageaccount.blob.core.windows.net
*
* @param string $primaryServiceEndpoint Primary service endpoint.
* @param string $secondaryServiceEndpoint Secondary service endpoint.
* @param array $options Optional request options.
*
* @return \MicrosoftAzure\Storage\Blob\Internal\IBlob
*/
public function createContainerAnonymousAccess(
$primaryServiceEndpoint,
$secondaryServiceEndpoint = null,
array $options = []
) {
Validate::canCastAsString($primaryServiceEndpoint, '$primaryServiceEndpoint');
if ($secondaryServiceEndpoint != null) {
Validate::canCastAsString(
$secondaryServiceEndpoint,
'$secondaryServiceEndpoint'
);
}
$serializer = $this->serializer();
$blobWrapper = new BlobRestProxy(
$primaryServiceEndpoint,
$secondaryServiceEndpoint,
self::tryParseAccountNameFromBlobEndpointURL($primaryServiceEndpoint),
$serializer,
$options
);
$blobWrapper->pushMiddleware(new CommonRequestMiddleware());
return $blobWrapper;
}
/**
* Builds a file service object, it accepts the following
* options:
@ -428,4 +469,25 @@ class ServicesBuilder
return self::$instance;
}
/**
* Try to parse the account anme from blob endpoint URL, return null
* if pattern failed to found.
*
* @param string $url The blob endpoint URL.
*
* @return string|null
*/
private static function tryParseAccountNameFromBlobEndpointURL($url)
{
$pos = strpos($url, Resources::BLOB_BASE_DNS_NAME);
if ($pos == false) {
return null;
}
$slashPos = strpos($url, '//');
return substr($url, $slashPos + 2, $pos - $slashPos - 3);
}
}

Просмотреть файл

@ -55,10 +55,10 @@ class SharedAccessSignatureHelper
*/
public function __construct($accountName, $accountKey)
{
Validate::isString($accountName, 'accountName');
Validate::canCastAsString($accountName, 'accountName');
Validate::notNullOrEmpty($accountName, 'accountName');
Validate::isString($accountKey, 'accountKey');
Validate::canCastAsString($accountKey, 'accountKey');
Validate::notNullOrEmpty($accountKey, 'accountKey');
$this->accountName = urldecode($accountName);
@ -119,7 +119,7 @@ class SharedAccessSignatureHelper
$signedVersion = Resources::STORAGE_API_LATEST_VERSION;
// check that the resource name is valid.
Validate::notNullOrEmpty($resourceName, 'resourceName');
Validate::isString($resourceName, 'resourceName');
Validate::canCastAsString($resourceName, 'resourceName');
// validate and sanitize signed permissions
$signedPermissions = $this->validateAndSanitizeSignedPermissions(
$signedPermissions,
@ -127,19 +127,19 @@ class SharedAccessSignatureHelper
);
// check that expiracy is valid
Validate::notNullOrEmpty($signedExpiry, 'signedExpiry');
Validate::isString($signedExpiry, 'signedExpiry');
Validate::canCastAsString($signedExpiry, 'signedExpiry');
Validate::isDateString($signedExpiry, 'signedExpiry');
// check that signed start is valid
Validate::isString($signedStart, 'signedStart');
Validate::canCastAsString($signedStart, 'signedStart');
if (strlen($signedStart) > 0) {
Validate::isDateString($signedStart, 'signedStart');
}
// check that signed IP is valid
Validate::isString($signedIP, 'signedIP');
Validate::canCastAsString($signedIP, 'signedIP');
// validate and sanitize signed protocol
$signedProtocol = $this->validateAndSanitizeSignedProtocol($signedProtocol);
// check that signed identifier is valid
Validate::isString($signedIdentifier, 'signedIdentifier');
Validate::canCastAsString($signedIdentifier, 'signedIdentifier');
Validate::isTrue(
strlen($signedIdentifier) <= 64,
sprintf(Resources::INVALID_STRING_LENGTH, 'signedIdentifier', 'maximum 64')
@ -155,16 +155,16 @@ class SharedAccessSignatureHelper
}
if ($type === 'bf') {
Validate::isString($cacheControl, 'cacheControl');
Validate::isString($contentDisposition, 'contentDisposition');
Validate::isString($contentEncoding, 'contentEncoding');
Validate::isString($contentLanguage, 'contentLanguage');
Validate::isString($contentType, 'contentType');
Validate::canCastAsString($cacheControl, 'cacheControl');
Validate::canCastAsString($contentDisposition, 'contentDisposition');
Validate::canCastAsString($contentEncoding, 'contentEncoding');
Validate::canCastAsString($contentLanguage, 'contentLanguage');
Validate::canCastAsString($contentType, 'contentType');
} elseif ($type === 't') {
Validate::isString($startingPartitionKey, 'startingPartitionKey');
Validate::isString($startingRowKey, 'startingRowKey');
Validate::isString($endingPartitionKey, 'endingPartitionKey');
Validate::isString($endingRowKey, 'endingRowKey');
Validate::canCastAsString($startingPartitionKey, 'startingPartitionKey');
Validate::canCastAsString($startingRowKey, 'startingRowKey');
Validate::canCastAsString($endingPartitionKey, 'endingPartitionKey');
Validate::canCastAsString($endingRowKey, 'endingRowKey');
}
// construct an array with the parameters to generate the shared access signature at the account level
@ -282,7 +282,7 @@ class SharedAccessSignatureHelper
$contentType = ""
) {
// check that the resource name is valid.
Validate::isString($signedResource, 'signedResource');
Validate::canCastAsString($signedResource, 'signedResource');
Validate::notNullOrEmpty($signedResource, 'signedResource');
Validate::isTrue(
$signedResource == Resources::RESOURCE_TYPE_BLOB ||
@ -363,7 +363,7 @@ class SharedAccessSignatureHelper
$contentType = ""
) {
// check that the resource name is valid.
Validate::isString($signedResource, 'signedResource');
Validate::canCastAsString($signedResource, 'signedResource');
Validate::notNullOrEmpty($signedResource, 'signedResource');
Validate::isTrue(
$signedResource == Resources::RESOURCE_TYPE_FILE ||
@ -539,7 +539,7 @@ class SharedAccessSignatureHelper
$signedProtocol = ""
) {
// check that version is valid
Validate::isString($signedVersion, 'signedVersion');
Validate::canCastAsString($signedVersion, 'signedVersion');
Validate::notNullOrEmpty($signedVersion, 'signedVersion');
Validate::isDateString($signedVersion, 'signedVersion');
@ -553,18 +553,18 @@ class SharedAccessSignatureHelper
$signedPermissions = $this->validateAndSanitizeSignedPermissions($signedPermissions);
// check that expiracy is valid
Validate::isString($signedExpiry, 'signedExpiry');
Validate::canCastAsString($signedExpiry, 'signedExpiry');
Validate::notNullOrEmpty($signedExpiry, 'signedExpiry');
Validate::isDateString($signedExpiry, 'signedExpiry');
// check that signed start is valid
Validate::isString($signedStart, 'signedStart');
Validate::canCastAsString($signedStart, 'signedStart');
if (strlen($signedStart) > 0) {
Validate::isDateString($signedStart, 'signedStart');
}
// check that signed IP is valid
Validate::isString($signedIP, 'signedIP');
Validate::canCastAsString($signedIP, 'signedIP');
// validate and sanitize signed protocol
$signedProtocol = $this->validateAndSanitizeSignedProtocol($signedProtocol);
@ -619,7 +619,7 @@ class SharedAccessSignatureHelper
private function validateAndSanitizeSignedService($signedService)
{
// validate signed service is not null or empty
Validate::isString($signedService, 'signedService');
Validate::canCastAsString($signedService, 'signedService');
Validate::notNullOrEmpty($signedService, 'signedService');
// The signed service should only be a combination of the letters b(lob) q(ueue) t(able) or f(ile)
@ -643,7 +643,7 @@ class SharedAccessSignatureHelper
private function validateAndSanitizeSignedResourceType($signedResourceType)
{
// validate signed resource type is not null or empty
Validate::isString($signedResourceType, 'signedResourceType');
Validate::canCastAsString($signedResourceType, 'signedResourceType');
Validate::notNullOrEmpty($signedResourceType, 'signedResourceType');
// The signed resource type should only be a combination of the letters s(ervice) c(container) or o(bject)
@ -669,7 +669,7 @@ class SharedAccessSignatureHelper
$signedResource = ''
) {
// validate signed permissions are not null or empty
Validate::isString($signedPermissions, 'signedPermissions');
Validate::canCastAsString($signedPermissions, 'signedPermissions');
Validate::notNullOrEmpty($signedPermissions, 'signedPermissions');
if ($signedResource == '') {
@ -695,7 +695,7 @@ class SharedAccessSignatureHelper
*/
private function validateAndSanitizeSignedProtocol($signedProtocol)
{
Validate::isString($signedProtocol, 'signedProtocol');
Validate::canCastAsString($signedProtocol, 'signedProtocol');
// sanitize string
$sanitizedSignedProtocol = strtolower($signedProtocol);
if (strlen($sanitizedSignedProtocol) > 0) {

Просмотреть файл

@ -122,7 +122,7 @@ class FileRestProxy extends ServiceRestProxy implements IFile
FileServiceOptions $options = null,
$operation = null
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::isTrue(
$operation == 'properties' || $operation == 'metadata',
Resources::FILE_SHARE_PROPERTIES_OPERATION_INVALID
@ -194,12 +194,12 @@ class FileRestProxy extends ServiceRestProxy implements IFile
FileServiceOptions $options = null,
$operation = 'properties'
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::isTrue(
$operation == 'properties' || $operation == 'metadata',
Resources::FILE_SHARE_PROPERTIES_OPERATION_INVALID
);
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
$headers = array();
if ($operation == 'properties') {
@ -478,7 +478,7 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$share,
CreateShareOptions $options = null
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::notNullOrEmpty($share, 'share');
$method = Resources::HTTP_PUT;
@ -548,7 +548,7 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$share,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::notNullOrEmpty($share, 'share');
$method = Resources::HTTP_DELETE;
@ -771,7 +771,7 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$share,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
$method = Resources::HTTP_GET;
$headers = array();
@ -868,7 +868,7 @@ class FileRestProxy extends ServiceRestProxy implements IFile
ShareACL $acl,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::notNullOrEmpty($acl, 'acl');
$method = Resources::HTTP_PUT;
@ -942,7 +942,7 @@ class FileRestProxy extends ServiceRestProxy implements IFile
*/
public function getShareStatsAsync($share, FileServiceOptions $options = null)
{
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
$method = Resources::HTTP_GET;
$headers = array();
@ -1028,8 +1028,9 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path = '',
ListDirectoriesAndFilesOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::notNull($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_GET;
$headers = array();
@ -1129,8 +1130,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
CreateDirectoryOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
Validate::notNullOrEmpty($path, 'path');
$method = Resources::HTTP_PUT;
@ -1199,8 +1200,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_DELETE;
$headers = array();
@ -1266,8 +1267,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_GET;
$headers = array();
@ -1336,8 +1337,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_GET;
$headers = array();
@ -1421,8 +1422,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
array $metadata,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_PUT;
$postParams = array();
@ -1503,9 +1504,9 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$size,
CreateFileOptions $options = null
) {
Validate::isString($share, 'share');
Validate::canCastAsString($share, 'share');
Validate::notNullOrEmpty($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($path, 'path');
Validate::notNullOrEmpty($path, 'path');
Validate::isInteger($size, 'size');
@ -1629,8 +1630,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_DELETE;
$headers = array();
@ -1697,8 +1698,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
GetFileOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_GET;
$headers = array();
@ -1787,8 +1788,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_HEAD;
$headers = array();
@ -1860,8 +1861,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
FileProperties $properties,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$headers = array();
@ -1970,8 +1971,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$path,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_GET;
$headers = array();
@ -2055,8 +2056,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
array $metadata,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
$method = Resources::HTTP_PUT;
$postParams = array();
@ -2146,8 +2147,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
Range $range,
PutFileRangeOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
Validate::notNullOrEmpty($path, 'path');
Validate::notNullOrEmpty($share, 'share');
Validate::notNull($range->getLength(), Resources::RESOURCE_RANGE_LENGTH_MUST_SET);
@ -2344,8 +2345,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
Range $range,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
Validate::notNullOrEmpty($path, 'path');
Validate::notNullOrEmpty($share, 'share');
@ -2437,8 +2438,8 @@ class FileRestProxy extends ServiceRestProxy implements IFile
Range $range = null,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
Validate::notNullOrEmpty($path, 'path');
Validate::notNullOrEmpty($share, 'share');
@ -2565,9 +2566,9 @@ class FileRestProxy extends ServiceRestProxy implements IFile
array $metadata = array(),
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::isString($sourcePath, 'sourcePath');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
Validate::canCastAsString($sourcePath, 'sourcePath');
Validate::notNullOrEmpty($path, 'path');
Validate::notNullOrEmpty($share, 'share');
Validate::notNullOrEmpty($sourcePath, 'sourcePath');
@ -2656,9 +2657,9 @@ class FileRestProxy extends ServiceRestProxy implements IFile
$copyID,
FileServiceOptions $options = null
) {
Validate::isString($share, 'share');
Validate::isString($path, 'path');
Validate::isString($copyID, 'copyID');
Validate::canCastAsString($share, 'share');
Validate::canCastAsString($path, 'path');
Validate::canCastAsString($copyID, 'copyID');
Validate::notNullOrEmpty($share, 'share');
Validate::notNullOrEmpty($path, 'path');
Validate::notNullOrEmpty($copyID, 'copyID');

Просмотреть файл

@ -112,7 +112,7 @@ class CopyFileResult
*/
protected function setETag($etag)
{
Validate::isString($etag, 'etag');
Validate::canCastAsString($etag, 'etag');
$this->etag = $etag;
}
@ -135,7 +135,7 @@ class CopyFileResult
*/
protected function setCopyID($copyID)
{
Validate::isString($copyID, 'copyID');
Validate::canCastAsString($copyID, 'copyID');
$this->copyID = $copyID;
}
@ -158,7 +158,7 @@ class CopyFileResult
*/
protected function setCopyStatus($copyStatus)
{
Validate::isString($copyStatus, 'copyStatus');
Validate::canCastAsString($copyStatus, 'copyStatus');
$this->copyStatus = $copyStatus;
}
}

Просмотреть файл

@ -1,72 +0,0 @@
<?php
/**
* LICENSE: The MIT License (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://github.com/azure/azure-storage-php/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PHP version 5
*
* @category Microsoft
* @package MicrosoftAzure\Storage\File\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\File\Models;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Models\ContinuationToken;
/**
* Provides functionality and data structure for File continuation token.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\File\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
class FileContinuationToken extends ContinuationToken
{
private $nextMarker;
public function __construct(
$nextMarker = '',
$location = ''
) {
parent::__construct($location);
$this->setNextMarker($nextMarker);
}
/**
* Setter for nextMarker
*
* @param string $nextMarker the next marker to be set.
*/
public function setNextMarker($nextMarker)
{
Validate::isString($nextMarker, 'nextMarker');
$this->nextMarker = $nextMarker;
}
/**
* Getter for nextMarker
*
* @return string
*/
public function getNextMarker()
{
return $this->nextMarker;
}
}

Просмотреть файл

@ -1,56 +0,0 @@
<?php
/**
* LICENSE: The MIT License (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://github.com/azure/azure-storage-php/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PHP version 5
*
* @ignore
* @category Microsoft
* @package MicrosoftAzure\Storage\File\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\File\Models;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\File\Models\FileContinuationToken;
/**
* Trait implementing logic for File continuation tokens.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\File\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
trait FileContinuationTokenTrait
{
use MarkerContinuationTokenTrait;
/**
* Creates a continuation token if current one is null.
*
* @return void
*/
private function createContinuationTokenIfNotExist()
{
if ($this->continuationToken == null) {
$this->continuationToken = new FileContinuationToken();
}
}
}

Просмотреть файл

@ -43,7 +43,7 @@ class FileServiceOptions extends ServiceOptions
{
public function setLocationMode($locationMode)
{
Validate::isString($locationMode, 'locationMode');
Validate::canCastAsString($locationMode, 'locationMode');
Validate::isTrue(
$locationMode == LocationMode::PRIMARY_ONLY,
Resources::FILE_LOCATION_IS_PRIMARY_ONLY

Просмотреть файл

@ -28,8 +28,7 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\File\Models\FileServiceOptions;
use MicrosoftAzure\Storage\File\Models\FileContinuationToken;
use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
/**
* The options of listing directories and files.
@ -43,7 +42,7 @@ use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
*/
class ListDirectoriesAndFilesOptions extends FileServiceOptions
{
use FileContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $maxResults;
@ -76,7 +75,7 @@ class ListDirectoriesAndFilesOptions extends FileServiceOptions
*/
public function setMaxResults($maxResults)
{
Validate::isString($maxResults, 'maxResults');
Validate::canCastAsString($maxResults, 'maxResults');
$this->maxResults = $maxResults;
}
}

Просмотреть файл

@ -27,8 +27,8 @@ namespace MicrosoftAzure\Storage\File\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\File\Models\Share;
use MicrosoftAzure\Storage\File\Models\FileContinuationToken;
use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
/**
* Share to hold list directories and files response object.
@ -42,7 +42,7 @@ use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
*/
class ListDirectoriesAndFilesResult
{
use FileContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $directories;
private $files;
@ -73,21 +73,20 @@ class ListDirectoriesAndFilesResult
$serviceEndpoint
));
$result->setContinuationToken(
new FileContinuationToken(
Utilities::tryGetValue(
$parsedResponse,
Resources::QP_NEXT_MARKER
),
$location
)
);
$nextMarker = Utilities::tryGetValue(
$parsedResponse,
Resources::QP_NEXT_MARKER
);
if ($nextMarker != null) {
$result->setContinuationToken(
new MarkerContinuationToken(
$nextMarker,
$location
)
);
}
$result->setMaxResults(Utilities::tryGetValue(
$parsedResponse,
Resources::QP_MAX_RESULTS

Просмотреть файл

@ -127,7 +127,7 @@ class ListFileRangesResult
*/
protected function setETag($etag)
{
Validate::isString($etag, 'etag');
Validate::canCastAsString($etag, 'etag');
$this->etag = $etag;
}

Просмотреть файл

@ -25,8 +25,7 @@
namespace MicrosoftAzure\Storage\File\Models;
use MicrosoftAzure\Storage\File\Models\FileServiceOptions;
use MicrosoftAzure\Storage\File\Models\FileContinuationToken;
use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Internal\Validate;
/**
@ -41,7 +40,7 @@ use MicrosoftAzure\Storage\Common\Internal\Validate;
*/
class ListSharesOptions extends FileServiceOptions
{
use FileContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $prefix;
private $maxResults;
@ -68,7 +67,7 @@ class ListSharesOptions extends FileServiceOptions
*/
public function setPrefix($prefix)
{
Validate::isString($prefix, 'prefix');
Validate::canCastAsString($prefix, 'prefix');
$this->prefix = $prefix;
}
@ -99,7 +98,7 @@ class ListSharesOptions extends FileServiceOptions
*/
public function setMaxResults($maxResults)
{
Validate::isString($maxResults, 'maxResults');
Validate::canCastAsString($maxResults, 'maxResults');
$this->maxResults = $maxResults;
}

Просмотреть файл

@ -27,8 +27,8 @@ namespace MicrosoftAzure\Storage\File\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\File\Models\Share;
use MicrosoftAzure\Storage\File\Models\FileContinuationToken;
use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
/**
* Share to hold list Share response object.
@ -42,7 +42,7 @@ use MicrosoftAzure\Storage\File\Models\FileContinuationTokenTrait;
*/
class ListSharesResult
{
use FileContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $shares;
private $prefix;
@ -80,15 +80,21 @@ class ListSharesResult
$parsedResponse,
Resources::QP_MARKER
));
$result->setContinuationToken(
new FileContinuationToken(
Utilities::tryGetValue(
$parsedResponse,
Resources::QP_NEXT_MARKER
),
$location
)
$nextMarker = Utilities::tryGetValue(
$parsedResponse,
Resources::QP_NEXT_MARKER
);
if ($nextMarker != null) {
$result->setContinuationToken(
new MarkerContinuationToken(
$nextMarker,
$location
)
);
}
$result->setMaxResults(Utilities::tryGetValue(
$parsedResponse,
Resources::QP_MAX_RESULTS

Просмотреть файл

@ -25,8 +25,7 @@
namespace MicrosoftAzure\Storage\Queue\Models;
use MicrosoftAzure\Storage\Queue\Models\QueueServiceOptions;
use MicrosoftAzure\Storage\Queue\Models\QueueContinuationToken;
use MicrosoftAzure\Storage\Queue\Models\QueueContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Internal\Validate;
/**
@ -41,7 +40,7 @@ use MicrosoftAzure\Storage\Common\Internal\Validate;
*/
class ListQueuesOptions extends QueueServiceOptions
{
use QueueContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $_prefix;
private $_maxResults;
@ -66,7 +65,7 @@ class ListQueuesOptions extends QueueServiceOptions
*/
public function setPrefix($prefix)
{
Validate::isString($prefix, 'prefix');
Validate::canCastAsString($prefix, 'prefix');
$this->_prefix = $prefix;
}
@ -89,7 +88,7 @@ class ListQueuesOptions extends QueueServiceOptions
*/
public function setMaxResults($maxResults)
{
Validate::isString($maxResults, 'maxResults');
Validate::canCastAsString($maxResults, 'maxResults');
$this->_maxResults = $maxResults;
}

Просмотреть файл

@ -26,8 +26,8 @@ namespace MicrosoftAzure\Storage\Queue\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Queue\Models\Queue;
use MicrosoftAzure\Storage\Queue\Models\QueueContinuationToken;
use MicrosoftAzure\Storage\Queue\Models\QueueContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
/**
@ -42,7 +42,7 @@ use MicrosoftAzure\Storage\Common\Internal\Utilities;
*/
class ListQueuesResult
{
use QueueContinuationTokenTrait;
use MarkerContinuationTokenTrait;
private $_queues;
private $_prefix;
@ -80,15 +80,18 @@ class ListQueuesResult
$parsedResponse,
Resources::QP_MARKER
));
$result->setContinuationToken(
new QueueContinuationToken(
Utilities::tryGetValue(
$parsedResponse,
Resources::QP_NEXT_MARKER
),
$location
)
);
$nextMarker = Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
if ($nextMarker != null) {
$result->setContinuationToken(
new MarkerContinuationToken(
$nextMarker,
$location
)
);
}
$result->setMaxResults(Utilities::tryGetValue(
$parsedResponse,
Resources::QP_MAX_RESULTS

Просмотреть файл

@ -1,72 +0,0 @@
<?php
/**
* LICENSE: The MIT License (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://github.com/azure/azure-storage-php/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PHP version 5
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Queue\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Queue\Models;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Models\ContinuationToken;
/**
* Provides functionality and data structure for queue continuation token.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Queue\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
class QueueContinuationToken extends ContinuationToken
{
private $nextMarker;
public function __construct(
$nextMarker = '',
$location = ''
) {
parent::__construct($location);
$this->setNextMarker($nextMarker);
}
/**
* Setter for nextMarker
*
* @param string $nextMarker the next marker to be set.
*/
public function setNextMarker($nextMarker)
{
Validate::isString($nextMarker, 'nextMarker');
$this->nextMarker = $nextMarker;
}
/**
* Getter for nextMarker
*
* @return string
*/
public function getNextMarker()
{
return $this->nextMarker;
}
}

Просмотреть файл

@ -1,56 +0,0 @@
<?php
/**
* LICENSE: The MIT License (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://github.com/azure/azure-storage-php/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PHP version 5
*
* @ignore
* @category Microsoft
* @package MicrosoftAzure\Storage\Queue\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Queue\Models;
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
use MicrosoftAzure\Storage\Queue\Models\QueueContinuationToken;
/**
* Trait implementing logic for Queue continuation tokens.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Queue\Models
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
trait QueueContinuationTokenTrait
{
use MarkerContinuationTokenTrait;
/**
* Creates a continuation token if current one is null.
*
* @return void
*/
private function createContinuationTokenIfNotExist()
{
if ($this->continuationToken == null) {
$this->continuationToken = new QueueContinuationToken();
}
}
}

Просмотреть файл

@ -117,7 +117,7 @@ class UpdateMessageResult
*/
protected function setPopReceipt($popReceipt)
{
Validate::isString($popReceipt, 'popReceipt');
Validate::canCastAsString($popReceipt, 'popReceipt');
$this->_popReceipt = $popReceipt;
}
}

Просмотреть файл

@ -169,7 +169,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queueName,
QueueServiceOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
$method = Resources::HTTP_DELETE;
@ -230,9 +230,9 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$messageText,
CreateMessageOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
Validate::isString($messageText, 'messageText');
Validate::canCastAsString($messageText, 'messageText');
$method = Resources::HTTP_POST;
$headers = array();
@ -310,7 +310,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queueName,
Models\CreateQueueOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
$method = Resources::HTTP_PUT;
@ -382,11 +382,11 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$popReceipt,
QueueServiceOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
Validate::isString($messageId, 'messageId');
Validate::canCastAsString($messageId, 'messageId');
Validate::notNullOrEmpty($messageId, 'messageId');
Validate::isString($popReceipt, 'popReceipt');
Validate::canCastAsString($popReceipt, 'popReceipt');
Validate::notNullOrEmpty($popReceipt, 'popReceipt');
$method = Resources::HTTP_DELETE;
@ -445,7 +445,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queueName,
QueueServiceOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
$method = Resources::HTTP_DELETE;
@ -497,7 +497,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queueName,
QueueServiceOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
$method = Resources::HTTP_GET;
@ -561,7 +561,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queueName,
ListMessagesOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
$method = Resources::HTTP_GET;
@ -634,7 +634,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queueName,
PeekMessagesOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
$method = Resources::HTTP_GET;
@ -706,7 +706,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
array $metadata = null,
QueueServiceOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
Utilities::validateMetadata($metadata);
@ -807,13 +807,13 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$visibilityTimeoutInSeconds,
QueueServiceOptions $options = null
) {
Validate::isString($queueName, 'queueName');
Validate::canCastAsString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
Validate::isString($messageId, 'messageId');
Validate::canCastAsString($messageId, 'messageId');
Validate::notNullOrEmpty($messageId, 'messageId');
Validate::isString($popReceipt, 'popReceipt');
Validate::canCastAsString($popReceipt, 'popReceipt');
Validate::notNullOrEmpty($popReceipt, 'popReceipt');
Validate::isString($messageText, 'messageText');
Validate::canCastAsString($messageText, 'messageText');
Validate::isInteger(
$visibilityTimeoutInSeconds,
'visibilityTimeoutInSeconds'
@ -905,7 +905,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$queue,
Models\QueueServiceOptions $options = null
) {
Validate::isString($queue, 'queue');
Validate::canCastAsString($queue, 'queue');
$method = Resources::HTTP_GET;
$headers = array();
@ -978,7 +978,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
Models\QueueACL $acl,
Models\QueueServiceOptions $options = null
) {
Validate::isString($queue, 'queue');
Validate::canCastAsString($queue, 'queue');
Validate::notNullOrEmpty($acl, 'acl');
$method = Resources::HTTP_PUT;

Просмотреть файл

@ -101,7 +101,7 @@ class BatchOperations
*/
public function addInsertEntity($table, Entity $entity)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
$operation = new BatchOperation();
@ -122,7 +122,7 @@ class BatchOperations
*/
public function addUpdateEntity($table, Entity $entity)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
$operation = new BatchOperation();
@ -143,7 +143,7 @@ class BatchOperations
*/
public function addMergeEntity($table, Entity $entity)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
$operation = new BatchOperation();
@ -164,7 +164,7 @@ class BatchOperations
*/
public function addInsertOrReplaceEntity($table, Entity $entity)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
$operation = new BatchOperation();
@ -185,7 +185,7 @@ class BatchOperations
*/
public function addInsertOrMergeEntity($table, Entity $entity)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
$operation = new BatchOperation();
@ -208,7 +208,7 @@ class BatchOperations
*/
public function addDeleteEntity($table, $partitionKey, $rowKey, $etag = null)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::isTrue(!is_null($partitionKey), Resources::NULL_TABLE_KEY_MSG);
Validate::isTrue(!is_null($rowKey), Resources::NULL_TABLE_KEY_MSG);

Просмотреть файл

@ -55,7 +55,7 @@ class Entity
Validate::isArray($properties, 'entity properties');
foreach ($properties as $key => $value) {
Validate::isString($key, 'key');
Validate::canCastAsString($key, 'key');
Validate::isTrue(
$value instanceof Property,
Resources::INVALID_PROP_MSG

Просмотреть файл

@ -68,14 +68,16 @@ class QueryEntitiesResult
Resources::X_MS_CONTINUATION_NEXTROWKEY
);
$result->setContinuationToken(
new TableContinuationToken(
'',
$nextPK,
$nextRK,
Utilities::getLocationFromHeaders($headers)
)
);
if ($nextRK != null && $nextPK != null) {
$result->setContinuationToken(
new TableContinuationToken(
'',
$nextPK,
$nextRK,
Utilities::getLocationFromHeaders($headers)
)
);
}
$result->setEntities($entities);

Просмотреть файл

@ -62,17 +62,21 @@ class QueryTablesResult
$result->setTables($entries);
$result->setContinuationToken(
new TableContinuationToken(
Utilities::tryGetValue(
$headers,
Resources::X_MS_CONTINUATION_NEXTTABLENAME
),
'',
'',
Utilities::getLocationFromHeaders($headers)
)
$nextTableName = Utilities::tryGetValue(
$headers,
Resources::X_MS_CONTINUATION_NEXTTABLENAME
);
if ($nextTableName != null) {
$result->setContinuationToken(
new TableContinuationToken(
$nextTableName,
'',
'',
Utilities::getLocationFromHeaders($headers)
)
);
}
return $result;
}

Просмотреть файл

@ -74,7 +74,7 @@ class TableContinuationToken extends ContinuationToken
*/
public function setNextPartitionKey($nextPartitionKey)
{
Validate::isString($nextPartitionKey, 'nextPartitionKey');
Validate::canCastAsString($nextPartitionKey, 'nextPartitionKey');
$this->nextPartitionKey = $nextPartitionKey;
}
@ -97,7 +97,7 @@ class TableContinuationToken extends ContinuationToken
*/
public function setNextRowKey($nextRowKey)
{
Validate::isString($nextRowKey, 'nextRowKey');
Validate::canCastAsString($nextRowKey, 'nextRowKey');
$this->nextRowKey = $nextRowKey;
}
@ -120,7 +120,7 @@ class TableContinuationToken extends ContinuationToken
*/
public function setNextTableName($nextTableName)
{
Validate::isString($nextTableName, 'nextTableName');
Validate::canCastAsString($nextTableName, 'nextTableName');
$this->nextTableName = $nextTableName;
}
}

Просмотреть файл

@ -69,7 +69,7 @@ trait TableContinuationTokenTrait
public function getLocation()
{
if ($this->continuationToken == null) {
$this->setContinuationToken(new TableContinuationToken());
return null;
}
return $this->continuationToken->getLocation();
}
@ -77,9 +77,8 @@ trait TableContinuationTokenTrait
public function getLocationMode()
{
if ($this->continuationToken == null) {
$this->setContinuationToken(new TableContinuationToken());
}
if ($this->continuationToken->getLocation() == '') {
return parent::getLocationMode();
} elseif ($this->continuationToken->getLocation() == '') {
return parent::getLocationMode();
} else {
return $this->getLocation();
@ -94,7 +93,7 @@ trait TableContinuationTokenTrait
public function getNextTableName()
{
if ($this->continuationToken == null) {
$this->setContinuationToken(new TableContinuationToken());
return null;
}
return $this->continuationToken->getNextTableName();
}
@ -107,7 +106,7 @@ trait TableContinuationTokenTrait
public function getNextPartitionKey()
{
if ($this->continuationToken == null) {
$this->setContinuationToken(new TableContinuationToken());
return null;
}
return $this->continuationToken->getNextPartitionKey();
}
@ -120,7 +119,7 @@ trait TableContinuationTokenTrait
public function getNextRowKey()
{
if ($this->continuationToken == null) {
$this->setContinuationToken(new TableContinuationToken());
return null;
}
return $this->continuationToken->getNextRowKey();
}

Просмотреть файл

@ -288,7 +288,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$rowKey,
DeleteEntityOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
Validate::isTrue(!is_null($partitionKey), Resources::NULL_TABLE_KEY_MSG);
Validate::isTrue(!is_null($rowKey), Resources::NULL_TABLE_KEY_MSG);
@ -311,6 +311,12 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$ETag ? $etagObj : Resources::ASTERISK
);
$this->addOptionalHeader(
$headers,
Resources::ACCEPT_HEADER,
Resources::JSON_CONTENT_TYPE
);
$options->setLocationMode(LocationMode::PRIMARY_ONLY);
$context = new HttpCallContext();
@ -344,7 +350,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$useETag,
TableServiceOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
Validate::isTrue($entity->isValid($msg), $msg);
@ -407,7 +413,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
Entity $entity,
TableServiceCreateOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
Validate::notNullOrEmpty($entity, 'entity');
Validate::isTrue($entity->isValid($msg), $msg);
@ -830,7 +836,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$table,
TableServiceCreateOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
$method = Resources::HTTP_POST;
@ -899,7 +905,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$table,
GetTableOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
$method = Resources::HTTP_GET;
@ -949,7 +955,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
*
* @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179387.aspx
*/
public function deleteTable($table, TableServiceOptions$options = null)
public function deleteTable($table, TableServiceOptions $options = null)
{
$this->deleteTableAsync($table, $options)->wait();
}
@ -968,7 +974,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$table,
TableServiceOptions$options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
$method = Resources::HTTP_DELETE;
@ -1027,7 +1033,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
*/
public function queryEntitiesAsync($table, $options = null)
{
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
$method = Resources::HTTP_GET;
@ -1442,7 +1448,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$rowKey,
GetEntityOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($table, 'table');
Validate::isTrue(!is_null($partitionKey), Resources::NULL_TABLE_KEY_MSG);
Validate::isTrue(!is_null($rowKey), Resources::NULL_TABLE_KEY_MSG);
@ -1599,7 +1605,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
$table,
Models\TableServiceOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
$method = Resources::HTTP_GET;
$headers = array();
@ -1618,6 +1624,12 @@ class TableRestProxy extends ServiceRestProxy implements ITable
'acl'
);
$this->addOptionalHeader(
$headers,
Resources::ACCEPT_HEADER,
Resources::XML_CONTENT_TYPE
);
$dataSerializer = $this->dataSerializer;
$promise = $this->sendAsync(
@ -1672,7 +1684,7 @@ class TableRestProxy extends ServiceRestProxy implements ITable
TableACL $acl,
TableServiceOptions $options = null
) {
Validate::isString($table, 'table');
Validate::canCastAsString($table, 'table');
Validate::notNullOrEmpty($acl, 'acl');
$method = Resources::HTTP_PUT;
@ -1692,6 +1704,12 @@ class TableRestProxy extends ServiceRestProxy implements ITable
'acl'
);
$this->addOptionalHeader(
$headers,
Resources::ACCEPT_HEADER,
Resources::XML_CONTENT_TYPE
);
$options->setLocationMode(LocationMode::PRIMARY_ONLY);
return $this->sendAsync(

Просмотреть файл

@ -1233,7 +1233,7 @@ class TestResources
)
);
$sample['NextMarker'] = '';
$sample['NextMarker'] = 'abcdefg';
return $sample;
}

Просмотреть файл

@ -27,14 +27,23 @@ namespace MicrosoftAzure\Storage\Tests\functional\Blob;
use MicrosoftAzure\Storage\Tests\Framework\TestResources;
use MicrosoftAzure\Storage\Blob\Models\BlobServiceOptions;
use MicrosoftAzure\Storage\Blob\Models\CopyBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\BlobType;
use MicrosoftAzure\Storage\Blob\Models\BlobBlockType;
use MicrosoftAzure\Storage\Blob\Models\Block;
use MicrosoftAzure\Storage\Blob\Models\BlockList;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobMetadataOptions;
use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions;
use MicrosoftAzure\Storage\Blob\Models\AppendBlockOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobPagesOptions;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
use MicrosoftAzure\Storage\Blob\Models\ListContainersOptions;
use MicrosoftAzure\Storage\Blob\Models\ListBlobBlocksOptions;
use MicrosoftAzure\Storage\Blob\Models\PublicAccessType;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
use MicrosoftAzure\Storage\Common\Internal\Resources;
@ -3034,18 +3043,505 @@ class BlobServiceFunctionalTest extends FunctionalTestBase
);
}
// createBlockBlob
// createBlobBlock
// commitBlobBlocks
// listBlobBlocks
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlob
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobAsync
*/
public function testCreateBlockBlobNormal()
{
$attrs = BlobServiceFunctionalTestData::getCreateBlockBlobAttributes();
$container = BlobServiceFunctionalTestData::getContainerName();
// createPageBlob
// createBlobPages
// clearBlobPages
// listBlobRegions
foreach ($attrs as $attr) {
$threshold = array_key_exists('threshold', $attr)?
$attr['threshold'] : Resources::MB_IN_BYTES_32;
$size = $attr['size'];
$this->createBlockBlobWorker($container, $threshold, $size);
}
}
// acquireLease
// renewLease
// releaseLease
// breakLease
private function createBlockBlobWorker($container, $threshold, $size)
{
//create a temp file of size $size.
$cwd = getcwd();
$uuid = uniqid('test-file-', true);
$path = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt';
$resource = fopen($path, 'w+');
$count = $size / Resources::MB_IN_BYTES_32;
for ($i = 0; $i < $count; ++$i) {
fwrite($resource, openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_32));
}
$remain = $size - (Resources::MB_IN_BYTES_32 * $count);
fwrite($resource, openssl_random_pseudo_bytes($remain));
rewind($resource);
//upload the blob
$blobName = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$metadata = array('m1' => 'v1', 'm2' => 'v2');
$contentType = 'text/plain; charset=UTF-8';
$options = new CreateBlobOptions();
$options->setContentType($contentType);
$options->setMetadata($metadata);
$this->restProxy->setSingleBlobUploadThresholdInBytes($threshold);
$this->restProxy->createBlockBlob(
$container,
$blobName,
$resource,
$options
);
// Test
$result = $this->restProxy->getBlob($container, $blobName);
//get the path for the file to be downloaded into.
$uuid = uniqid('test-file-', true);
$downloadPath = $cwd.DIRECTORY_SEPARATOR.$uuid.'.txt';
$downloadResource = fopen($downloadPath, 'w');
//download the file
$content = $result->getContentStream();
while (!feof($content)) {
fwrite(
$downloadResource,
stream_get_contents($content, Resources::MB_IN_BYTES_32)
);
}
// Assert
$this->assertEquals(
BlobType::BLOCK_BLOB,
$result->getProperties()->getBlobType()
);
$this->assertEquals($metadata, $result->getMetadata());
$originMd5 = md5_file($path);
$downloadMd5 = md5_file($downloadPath);
$this->assertEquals($originMd5, $downloadMd5);
//clean-up.
if (is_resource($resource)) {
fclose($resource);
}
fclose($downloadResource);
unlink($path);
unlink($downloadPath);
}
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlob
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlockBlobAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobBlock
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobBlockAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocks
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::commitBlobBlocksAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocks
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listBlobBlocksAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobPropertiesAsync
*/
public function testBlockBlobBlocks()
{
//create block blob
$container = BlobServiceFunctionalTestData::getContainerName();
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createBlockBlob($container, $blob, '');
//create blocks
$blockIds = array();
$contents = array();
for ($i = 0; $i < 5; ++$i) {
$blockId = BlobServiceFunctionalTestData::getInterestingBlockId();
$content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4);
$this->restProxy->createBlobBlock($container, $blob, $blockId, $content);
$blockIds[] = $blockId;
$contents[] = $content;
}
$this->verifyBlocks($container, $blob, $blockIds, false);
//commit blocks 1 and 3.
$latest = BlobBlockType::LATEST_TYPE;
$committed = BlobBlockType::COMMITTED_TYPE;
$blockList = [
new Block($blockIds[1], $latest),
new Block($blockIds[3], $latest)
];
$this->restProxy->commitBlobBlocks($container, $blob, $blockList);
//verify MD5 and uncommitted.
$this->verifyBlobMd5($container, $blob, $contents[1] . $contents[3]);
$this->verifyBlocks(
$container,
$blob,
[$blockIds[1], $blockIds[3]]
);
//update blob with blocks 3 and 4.
for ($i = 0; $i < 5; ++$i) {
$this->restProxy->createBlobBlock(
$container,
$blob,
$blockIds[$i],
$contents[$i]
);
}
$blockList = [
new Block($blockIds[3], $latest),
new Block($blockIds[4], $latest),
];
$this->restProxy->commitBlobBlocks($container, $blob, $blockList);
//verify MD5 and uncommitted.
$this->verifyBlobMd5($container, $blob, $contents[3] . $contents[4]);
$this->verifyBlocks(
$container,
$blob,
[$blockIds[3], $blockIds[4]]
);
//commit a blob with same id with block 3
$this->restProxy->createBlobBlock($container, $blob, $blockIds[0], $contents[0]);
$content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4);
$this->restProxy->createBlobBlock($container, $blob, $blockIds[3], $content);
//test BlobBlockType::COMMITTED_TYPE
$blockList = [
new Block($blockIds[3], $committed),
new Block($blockIds[0], $latest),
];
$this->restProxy->commitBlobBlocks($container, $blob, $blockList);
//verify MD5 and uncommitted.
$this->verifyBlobMd5($container, $blob, $contents[3] . $contents[0]);
$this->verifyBlocks(
$container,
$blob,
[$blockIds[0], $blockIds[3]]
);
//test BlobBlockType::LATEST_TYPE
$this->restProxy->createBlobBlock($container, $blob, $blockIds[0], $contents[0]);
$content = openssl_random_pseudo_bytes(Resources::MB_IN_BYTES_4);
$this->restProxy->createBlobBlock($container, $blob, $blockIds[3], $content);
$blockList = [
new Block($blockIds[3], $latest),
new Block($blockIds[0], $latest),
];
$this->restProxy->commitBlobBlocks($container, $blob, $blockList);
//verify MD5 and uncommitted.
$this->verifyBlobMd5($container, $blob, $content . $contents[0]);
$this->verifyBlocks(
$container,
$blob,
[$blockIds[3], $blockIds[0]]
);
}
private function verifyBlobMd5($container, $blob, $content)
{
$c = stream_get_contents($this->restProxy->getBlob($container, $blob)->getContentStream());
$expectedMd5 = md5($content);
$actualMd5 = md5($c);
$this->assertEquals($expectedMd5, $actualMd5);
}
private function verifyBlocks($container, $blob, $list, $isCommitted = true)
{
$options = new ListBlobBlocksOptions();
if ($isCommitted) {
$options->setIncludeCommittedBlobs(true);
} else {
$options->setIncludeUncommittedBlobs(true);
}
$result = $this->restProxy->listBlobBlocks($container, $blob, $options);
$blocks = $isCommitted? $result->getCommittedBlocks() : $result->getUncommittedBlocks();
foreach ($list as $blockId) {
$this->assertTrue(array_key_exists($blockId, $blocks));
}
}
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlobAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPages
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobPagesAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::clearBlobPages
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::clearBlobPagesAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRanges
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::listPageBlobRangesAsync
*/
public function testPutListClearPageRanges()
{
$rangesArray = BlobServiceFunctionalTestData::getRangesArray();
$container = BlobServiceFunctionalTestData::getInterestingContainerName();
$this->createContainer($container);
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createPageBlob($container, $blob, 2048);
foreach ($rangesArray as $array) {
$this->putListClearPageRangesWorker(
$container,
$blob,
$array['putRange'],
$array['clearRange'],
$array['listRange'],
$array['resultListRange']
);
}
$this->deleteContainer($container);
}
private function putListClearPageRangesWorker(
$container,
$blob,
$putRange,
$clearRange,
$listRange,
$resultListRange
) {
if ($putRange != null) {
$length = $putRange->getLength();
if ($length == null) {
$length = 2048 - $putRange->getStart();
}
$content = \openssl_random_pseudo_bytes($length);
$options = new CreateBlobPagesOptions();
//setting the wrong md5.
$options->setContentMD5(Utilities::calculateContentMD5(''));
$message = '';
try {
$this->restProxy->createBlobPages(
$container,
$blob,
$putRange,
$content,
$options
);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains('400', $message);
$this->assertContains(
'The MD5 value specified in the request did not match with the MD5 value calculated by the server.',
$message
);
//Ends debug code snippet
// Now set the correct content MD5
$options->setContentMD5(Utilities::calculateContentMD5($content));
$this->restProxy->createBlobPages(
$container,
$blob,
$putRange,
$content,
$options
);
$getOptions = new GetBlobOptions();
$getOptions->setRangeStart($putRange->getStart());
$getOptions->setRangeEnd($putRange->getEnd());
$getOptions->setComputeRangeMD5(true);
$result = $this->restProxy->getBlob($container, $blob, $getOptions);
$actualContent = stream_get_contents($result->getContentStream());
$actualMD5 = $result->getProperties()->getContentMD5();
//Validate
$this->assertEquals(Utilities::calculateContentMD5($content), $actualMD5);
$this->assertEquals($content, $actualContent);
}
if ($clearRange != null) {
$this->restProxy->clearBlobPages($container, $blob, $clearRange);
}
//Validate result
$listRangeOptions = new ListPageBlobRangesOptions();
if ($listRange != null) {
$listRangeOptions->setRangeStart($listRange->getStart());
$listRangeOptions->setRangeEnd($listRange->getEnd());
}
$listResult =
$this->restProxy->listPageBlobRanges($container, $blob, $listRangeOptions);
$this->assertEquals(2048, $listResult->getContentLength());
$resultRanges = $listResult->getRanges();
for ($i = 0; $i < count($resultRanges); ++$i) {
$this->assertEquals($resultListRange[$i], $resultRanges[$i]);
}
}
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlob
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createAppendBlobAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlock
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::appendBlockAsync
*/
public function testAppendBlob()
{
$container = BlobServiceFunctionalTestData::getInterestingContainerName();
$this->createContainer($container);
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createAppendBlob($container, $blob);
$setupArrays = BlobServiceFunctionalTestData::getAppendBlockSetup();
foreach ($setupArrays as $setupArray) {
$content = openssl_random_pseudo_bytes($setupArray['size']);
$options = $setupArray['options'];
$errorMsg = $setupArray['error'];
$message = '';
try {
$this->restProxy->appendBlock(
$container,
$blob,
$content,
$options
);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
if ($errorMsg == '') {
$this->assertEquals('', $message);
} else {
$this->assertContains($errorMsg, $message);
}
}
}
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync
*/
public function testLeaseContainer()
{
$container = BlobServiceFunctionalTestData::getInterestingContainerName();
$this->restProxy->createContainer($container);
$leaseId = Utilities::getGuid();
$result = $this->restProxy->acquireLease($container, '', $leaseId);
$this->assertEquals($leaseId, $result->getLeaseId());
$message = '';
try {
$this->restProxy->deleteContainer($container);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains('There is currently a lease on the container and no lease ID was specified in the request', $message);
$options = new BlobServiceOptions();
$options->setLeaseId($leaseId);
$this->restProxy->deleteContainer($container, $options);
}
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync
*/
public function testLeaseBlob()
{
$container = BlobServiceFunctionalTestData::getInterestingContainerName();
$this->restProxy->createContainer($container);
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createPageBlob($container, $blob, 1024);
$leaseId = Utilities::getGuid();
$result = $this->restProxy->acquireLease($container, $blob, $leaseId);
$this->assertEquals($leaseId, $result->getLeaseId());
$message = '';
try {
$this->restProxy->deleteBlob($container, $blob);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message);
$options = new DeleteBlobOptions();
$options->setLeaseId($leaseId);
$this->restProxy->deleteBlob($container, $blob, $options);
}
/**
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::acquireLeaseAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::renewLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::renewLeaseAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::releaseLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::releaseLeaseAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::changeLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::changeLeaseAsync
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::breakLease
* @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::breakLeaseAsync
*/
public function testLeaseOperations()
{
$container = BlobServiceFunctionalTestData::getInterestingContainerName();
$this->restProxy->createContainer($container);
//configure
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createPageBlob($container, $blob, 1024);
$leaseId = Utilities::getGuid();
$message = '';
//test acquire lease duration no in bound
try {
$this->restProxy->acquireLease($container, $blob, $leaseId, 14);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains(' The value for one of the HTTP headers is not in the correct format.', $message);
try {
$this->restProxy->acquireLease($container, $blob, $leaseId, 61);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains(' The value for one of the HTTP headers is not in the correct format.', $message);
$result = $this->restProxy->acquireLease($container, $blob, $leaseId, 15);
$this->assertEquals($leaseId, $result->getLeaseId());
//test lease duration expire
\sleep(15);
$this->restProxy->deleteBlob($container, $blob);
//re-configure
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createPageBlob($container, $blob, 1024);
$leaseId = Utilities::getGuid();
$this->restProxy->acquireLease($container, $blob, $leaseId);
//test change lease
$newLeaseId = Utilities::getGuid();
$result = $this->restProxy->changeLease($container, $blob, $leaseId, $newLeaseId);
$options = new DeleteBlobOptions();
$options->setLeaseId($newLeaseId);
$this->restProxy->deleteBlob($container, $blob, $options);
$result = $this->restProxy->listBlobs($container);
$this->assertTrue(empty($result->getBlobs()));
//test renew lease
//re-configure
$blob = BlobServiceFunctionalTestData::getInterestingBlobName($container);
$this->restProxy->createPageBlob($container, $blob, 1024);
$leaseId = Utilities::getGuid();
$this->restProxy->acquireLease($container, $blob, $leaseId, 15);
\sleep(15);
$this->restProxy->renewLease($container, $blob, $leaseId);
try {
$this->restProxy->deleteBlob($container, $blob);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message);
//test release lease
$this->restProxy->releaseLease($container, $blob, $leaseId);
//acquire a lease immediately after.
$leaseId = Utilities::getGuid();
$this->restProxy->acquireLease($container, $blob, $leaseId);
try {
$this->restProxy->deleteBlob($container, $blob);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message);
//test break lease
$result = $this->restProxy->breakLease($container, $blob, 10);
$leaseId = Utilities::getGuid();
try {
$this->restProxy->acquireLease($container, $blob, $leaseId);
} catch (ServiceException $e) {
$message = $e->getMessage();
}
$this->assertContains('There is currently a lease on the blob and no lease ID was specified in the request.', $message);
\sleep(10);
$this->restProxy->acquireLease($container, $blob, $leaseId);
$options = new DeleteBlobOptions();
$options->setLeaseId($leaseId);
$this->restProxy->deleteBlob($container, $blob, $options);
$result = $this->restProxy->listBlobs($container);
$this->assertTrue(empty($result->getBlobs()));
}
}

Просмотреть файл

@ -32,6 +32,7 @@ use MicrosoftAzure\Storage\Blob\Models\BlobServiceOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobSnapshotOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions;
use MicrosoftAzure\Storage\Blob\Models\AppendBlockOptions;
use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobPropertiesOptions;
@ -40,6 +41,8 @@ use MicrosoftAzure\Storage\Blob\Models\ListContainersOptions;
use MicrosoftAzure\Storage\Blob\Models\PublicAccessType;
use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\Common\Models\Range;
use MicrosoftAzure\Storage\Common\Models\Logging;
use MicrosoftAzure\Storage\Common\Models\Metrics;
use MicrosoftAzure\Storage\Common\Models\CORS;
@ -54,6 +57,7 @@ class BlobServiceFunctionalTestData
public static $nonExistBlobPrefix;
public static $testContainerNames;
public static $testBlobNames;
private static $blockIdCount;
private static $accountName;
private static $badETag = '0x123456789ABCDEF';
@ -66,6 +70,7 @@ class BlobServiceFunctionalTestData
self::$nonExistBlobPrefix = 'qa-' . ($rint . 2) . '-';
self::$testContainerNames = array( self::$testUniqueId . 'a1', self::$testUniqueId . 'a2', self::$testUniqueId . 'b1' );
self::$testBlobNames = array( 'b' . self::$testUniqueId . 'a1', 'b' . self::$testUniqueId . 'a2', 'b' . self::$testUniqueId . 'b1' );
self::$blockIdCount = 0;
}
public static function getInterestingContainerName()
@ -104,6 +109,14 @@ class BlobServiceFunctionalTestData
return $blobname;
}
public static function getInterestingBlockId()
{
//Block ID must be base64 encoded.
return base64_encode(
str_pad(self::$blockIdCount++, 6, '0', STR_PAD_LEFT)
);
}
public static function getSimpleMessageText()
{
return 'simple message text #' . (self::$tempBlobCounter++);
@ -812,11 +825,6 @@ class BlobServiceFunctionalTestData
$options->setSnapshot('placeholder');
array_push($ret, $options);
// TODO: Handle Lease ID
// $options = new GetBlobOptions();
// $options->setLeaseId('setLeaseId');
// array_push($ret, $options);
return $ret;
}
@ -853,11 +861,6 @@ class BlobServiceFunctionalTestData
$options->setSnapshot('placeholder');
array_push($ret, $options);
// TODO: Handle Lease ID
// $options = new DeleteBlobOptions();
// $options->setLeaseId('setLeaseId');
// array_push($ret, $options);
return $ret;
}
@ -886,11 +889,6 @@ class BlobServiceFunctionalTestData
$options->setMetadata(self::getNiceMetadata());
array_push($ret, $options);
// TODO: Handle Lease ID
// $options = new CreateBlobSnapshotOptions();
// $options->setLeaseId('setLeaseId');
// array_push($ret, $options);
return $ret;
}
@ -932,15 +930,121 @@ class BlobServiceFunctionalTestData
$options = new CopyBlobOptions();
$options->setSourceSnapshot('placeholder');
array_push($ret, $options);
return $ret;
}
// TODO: Handle Lease ID
// $options = new CopyBlobOptions();
// $options->setLeaseId('setLeaseId');
// array_push($ret, $options);
//
// $options = new CopyBlobOptions();
// $options->setSourceLeaseId('setSourceLeaseId');
// array_push($ret, $options);
public static function getCreateBlockBlobAttributes()
{
$ret = array();
$ret[] = ['size' => Resources::MB_IN_BYTES_4];
$ret[] = ['size' => Resources::MB_IN_BYTES_32];
$ret[] = ['size' => Resources::MB_IN_BYTES_32 + Resources::MB_IN_BYTES_1];
$ret[] = ['size' => Resources::MB_IN_BYTES_128];
$ret[] = ['size' => Resources::MB_IN_BYTES_256];
$ret[] = [
'threshold' => Resources::MB_IN_BYTES_4,
'size' => Resources::MB_IN_BYTES_4 * 2
];
$ret[] = [
'threshold' => Resources::MB_IN_BYTES_64,
'size' => Resources::MB_IN_BYTES_64
];
$ret[] = [
'threshold' => Resources::MB_IN_BYTES_64,
'size' => Resources::MB_IN_BYTES_64 + Resources::MB_IN_BYTES_1
];
return $ret;
}
public static function getRangesArray()
{
$ret = array();
$ret[] = [
'putRange' => new Range(0, 511),
'clearRange' => null,
'listRange' => null,
'resultListRange' => [new Range(0, 511)]
];
$ret[] = [
'putRange' => new Range(1024, 1535),
'clearRange' => null,
'listRange' => null,
'resultListRange' => [new Range(0, 511), new Range(1024, 1535)]
];
$ret[] = [
'putRange' => new Range(512, 1023),
'clearRange' => null,
'listRange' => null,
'resultListRange' => [new Range(0, 1535)]
];
$ret[] = [
'putRange' => null,
'clearRange' => new Range(1024, 1535),
'listRange' => null,
'resultListRange' => [new Range(0, 1023)]
];
$ret[] = [
'putRange' => null,
'clearRange' => null,
'listRange' => new Range(0, 511),
'resultListRange' => [new Range(0, 511)]
];
$ret[] = [
'putRange' => new Range(1024, 2047),
'clearRange' => new Range(512, 1023),
'listRange' => null,
'resultListRange' => [new Range(0, 511), new Range(1024, 2047)]
];
$ret[] = [
'putRange' => null,
'clearRange' => new Range(0, 2047),
'listRange' => null,
'resultListRange' => array()
];
return $ret;
}
public static function getAppendBlockSetup()
{
$ret = array();
$size = Resources::MB_IN_BYTES_4;
$options = new AppendBlockOptions();
$errorMsg = '';
$ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg];
$size = Resources::MB_IN_BYTES_1;
$options = new AppendBlockOptions();
$options->setContentMD5(Utilities::calculateContentMD5(''));
$errorMsg = 'The MD5 value specified in the request did not match with the MD5 value calculated by the server.';
$ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg];
$size = Resources::MB_IN_BYTES_1;
$options = new AppendBlockOptions();
$options->setMaxBlobSize(Resources::MB_IN_BYTES_4);
$errorMsg = 'The max blob size condition specified was not met';
$ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg];
$size = Resources::MB_IN_BYTES_1;
$options = new AppendBlockOptions();
$options->setAppendPosition(Resources::MB_IN_BYTES_1);
$errorMsg = 'The append position condition specified was not met.';
$ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg];
$size = Resources::MB_IN_BYTES_1 + Resources::MB_IN_BYTES_4;
$options = new AppendBlockOptions();
$errorMsg = 'The request body is too large and exceeds the maximum permissible limit.';
$ret[] = ['size' => $size, 'options' => $options, 'error' => $errorMsg];
return $ret;
}

Просмотреть файл

@ -0,0 +1,162 @@
<?php
/**
* LICENSE: The MIT License (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://github.com/azure/azure-storage-php/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PHP version 5
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Tests\Framework
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Tests\functional\Common;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\Common\ServicesBuilder;
use MicrosoftAzure\Storage\Tests\framework\TestResources;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
use MicrosoftAzure\Storage\Blob\Models\PublicAccessType;
/**
* Tests for account SAS proxy tests.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Tests\Framework
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
* @copyright 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
class AnonymousAccessFunctionalTest extends \PHPUnit_Framework_TestCase
{
private $containerName;
private static $blobRestProxy;
private static $serviceBuilder;
private static $accountName;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$connectionString = TestResources::getWindowsAzureStorageServicesConnectionString();
self::$serviceBuilder = new ServicesBuilder();
self::$blobRestProxy =
self::$serviceBuilder->createBlobService($connectionString);
self::$accountName = self::$blobRestProxy->getAccountName();
}
public function setUp()
{
parent::setUp();
$this->containerName = TestResources::getInterestingName('con');
self::$blobRestProxy->createContainer($this->containerName);
}
public function tearDown()
{
self::$blobRestProxy->deleteContainer($this->containerName);
parent::tearDown();
}
/**
* @covers MicrosoftAzure\Storage\Common\ServicesBuilder::createContainerAnonymousAccess
*/
public function testPublicAccessContainerAndBlob()
{
$acl = self::$blobRestProxy->getContainerAcl($this->containerName)->getContainerAcl();
$acl->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);
self::$blobRestProxy->setContainerAcl($this->containerName, $acl);
$pEndpoint = sprintf(
'%s://%s.%s',
Resources::HTTPS_SCHEME,
self::$accountName,
Resources::BLOB_BASE_DNS_NAME
);
$sEndpoint = sprintf(
'%s://%s.%s',
Resources::HTTPS_SCHEME,
self::$accountName . '-secondary',
Resources::BLOB_BASE_DNS_NAME
);
$proxy = self::$serviceBuilder->createContainerAnonymousAccess(
$pEndpoint,
$sEndpoint
);
$result = $proxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
$blob = TestResources::getInterestingName('b');
self::$blobRestProxy->createPageBlob($this->containerName, $blob, 512);
$result = $proxy->listBlobs($this->containerName);
$this->assertEquals(1, count($result->getBlobs()));
self::$blobRestProxy->deleteBlob($this->containerName, $blob);
$result = $proxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
}
/**
* @covers MicrosoftAzure\Storage\Common\ServicesBuilder::createContainerAnonymousAccess
* @expectedException MicrosoftAzure\Storage\Common\Exceptions\ServiceException
* @expectedExceptionMessage 404
*/
public function testPublicAccessBlobOnly()
{
$acl = self::$blobRestProxy->getContainerAcl($this->containerName)->getContainerAcl();
$acl->setPublicAccess(PublicAccessType::BLOBS_ONLY);
self::$blobRestProxy->setContainerAcl($this->containerName, $acl);
$pHost = self::$accountName . '.' . Resources::BLOB_BASE_DNS_NAME;
$sHost = self::$accountName . '-secondary' . '.' . Resources::BLOB_BASE_DNS_NAME;
$scheme = Resources::HTTPS_SCHEME;
$pEndpoint = sprintf(
'%s://%s.%s',
Resources::HTTPS_SCHEME,
self::$accountName,
Resources::BLOB_BASE_DNS_NAME
);
$sEndpoint = sprintf(
'%s://%s.%s',
Resources::HTTPS_SCHEME,
self::$accountName . '-secondary',
Resources::BLOB_BASE_DNS_NAME
);
$proxy = self::$serviceBuilder->createContainerAnonymousAccess(
$pEndpoint,
$sEndpoint
);
$result = self::$blobRestProxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
$blob = TestResources::getInterestingName('b');
self::$blobRestProxy->createBlockBlob($this->containerName, $blob, 'test content');
$result = self::$blobRestProxy->listBlobs($this->containerName);
$this->assertEquals(1, count($result->getBlobs()));
$content = stream_get_contents($proxy->getBlob($this->containerName, $blob)->getContentStream());
$this->assertEquals('test content', $content);
self::$blobRestProxy->deleteBlob($this->containerName, $blob);
$result = self::$blobRestProxy->listBlobs($this->containerName);
$this->assertEquals(0, count($result->getBlobs()));
//The following line will generate ServiceException with 404.
$result = $proxy->listBlobs($this->containerName);
}
}

Просмотреть файл

@ -43,7 +43,9 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
{
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServicePropertiesAsync
*/
public function testGetServicePropertiesNoOptions()
{
@ -71,7 +73,9 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServicePropertiesAsync
*/
public function testGetServiceProperties()
{
@ -103,9 +107,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getServiceProperties
*/
private function getServicePropertiesWorker($options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -204,19 +205,12 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
);
}
// /**
// * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties
// * @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties
// */
// public function testSetServicePropertiesNoOptions()
// {
// $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties();
// $this->setServicePropertiesWorker($serviceProperties, null);
// }
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setServicePropertiesAsync
*/
public function testSetServiceProperties()
{
@ -235,10 +229,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::setServiceProperties
*/
private function setServicePropertiesWorker($serviceProperties, $options)
{
try {
@ -288,6 +278,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
*/
public function testListQueuesNoOptions()
{
@ -296,6 +287,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
*/
public function testListQueues()
{
@ -305,9 +297,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listQueues
*/
private function listQueuesWorker($options)
{
$finished = false;
@ -442,9 +431,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
*/
public function testCreateQueueNoOptions()
{
@ -453,9 +446,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
*/
public function testCreateQueue()
{
@ -465,12 +462,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listQueues
*/
private function createQueueWorker($options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -552,8 +543,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
*/
public function testDeleteQueueNoOptions()
{
@ -562,8 +556,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
*/
public function testDeleteQueue()
{
@ -575,11 +572,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listQueues
*/
private function deleteQueueWorker($options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -644,14 +636,17 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
// TODO: Negative tests, like accessing a non-existant queue, or recreating an existing queue?
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync
*/
public function testGetQueueMetadataNoOptions()
{
@ -663,10 +658,15 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync
*/
public function testGetQueueMetadata()
{
@ -682,13 +682,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::setQueueMetadata
*/
private function getQueueMetadataWorker($options, $metadata)
{
self::println('Trying $options: ' . self::tmptostring($options) .
@ -760,9 +753,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync
*/
public function testSetQueueMetadataNoOptions()
{
@ -778,9 +775,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteQueueAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::getQueueMetadataAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadata
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::setQueueMetadataAsync
*/
public function testSetQueueMetadata()
{
@ -800,12 +801,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteQueue
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::getQueueMetadata
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::setQueueMetadata
*/
private function setQueueMetadataWorker($options, $metadata)
{
self::println('Trying $options: ' . self::tmptostring($options) .
@ -852,8 +847,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testCreateMessageEmpty()
{
@ -862,8 +860,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testCreateMessageUnicodeMessage()
{
@ -885,8 +886,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testCreateMessageXmlMessage()
{
@ -898,8 +902,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testCreateMessageWithSmallTTL()
{
@ -929,8 +936,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testCreateMessage()
{
@ -959,11 +969,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages
*/
private function createMessageWorker($messageText, $options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -1042,9 +1047,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessageAsync
*/
public function testUpdateMessageNoOptions()
{
@ -1071,9 +1080,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::updateMessageAsync
*/
public function testUpdateMessage()
{
@ -1104,12 +1117,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::updateMessage
*/
private function updateMessageWorker($messageText, $startingMessage, $visibilityTimeoutInSeconds, $options)
{
self::println('Trying $options: ' . self::tmptostring($options) .
@ -1203,9 +1210,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testDeleteMessageNoOptions()
{
@ -1214,9 +1225,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::deleteMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testDeleteMessage()
{
@ -1228,12 +1243,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::deleteMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages
*/
private function deleteMessageWorker($options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -1282,9 +1291,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync
*/
public function testListMessagesNoOptions()
{
@ -1293,9 +1306,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync
*/
public function testListMessages()
{
@ -1319,12 +1336,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::peekMessages
*/
private function listMessagesWorker($options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -1422,9 +1433,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync
*/
public function testPeekMessagesNoOptions()
{
@ -1433,9 +1448,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::peekMessagesAsync
*/
public function testPeekMessages()
{
@ -1455,12 +1474,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::peekMessages
*/
private function peekMessagesWorker($options)
{
self::println('Trying $options: ' . self::tmptostring($options));
@ -1525,8 +1538,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testClearMessagesNoOptions()
{
@ -1535,8 +1551,11 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::clearMessagesAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessage
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::createMessageAsync
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessages
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listMessagesAsync
*/
public function testClearMessages()
{
@ -1548,11 +1567,6 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::clearMessages
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::createMessage
* @covers MicrosoftAzure\Storage\ServiceBus\ServiceBusRestProxy::listMessages
*/
private function clearMessagesWorker($options)
{
self::println('Trying $options: ' .
@ -1610,6 +1624,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
* @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack
*/
public function testMiddlewares()
@ -1662,6 +1677,7 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueues
* @covers MicrosoftAzure\Storage\Queue\QueueRestProxy::listQueuesAsync
* @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack
*/
public function testRetryFromSecondary()

Просмотреть файл

@ -56,7 +56,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
{
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync
*/
public function testGetServicePropertiesNoOptions()
{
@ -84,7 +86,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync
*/
public function testGetServiceProperties()
{
@ -105,6 +109,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync
*/
private function getServicePropertiesWorker($options)
{
@ -196,7 +201,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync
*/
public function testSetServicePropertiesNoOptions()
{
@ -206,7 +213,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync
*/
public function testSetServiceProperties()
{
@ -224,7 +233,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getServicePropertiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServiceProperties
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::setServicePropertiesAsync
*/
private function setServicePropertiesWorker($serviceProperties, $options)
{
@ -255,6 +266,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
public function testQueryTablesNoOptions()
{
@ -263,6 +275,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
public function testQueryTables()
{
@ -275,6 +288,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
private function queryTablesWorker($options)
{
@ -372,8 +386,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
public function testCreateTableNoOptions()
{
@ -382,8 +399,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
public function testCreateTable()
{
@ -391,11 +411,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
$this->createTableWorker($options);
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
*/
private function createTableWorker($options)
{
$table = TableServiceFunctionalTestData::getInterestingTableName();
@ -437,8 +452,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
public function testDeleteTableNoOptions()
{
@ -447,8 +465,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
public function testDeleteTable()
{
@ -458,8 +479,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
*/
private function deleteTableWorker($options)
{
@ -518,8 +542,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTableAsync
*/
public function testGetTableNoOptions()
{
@ -528,8 +555,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTableAsync
*/
public function testGetTable()
{
@ -539,8 +569,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::createTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteTableAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTable
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getTableAsync
*/
private function getTableWorker($options)
{
@ -571,7 +604,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
*/
public function testGetEntity()
{
@ -584,7 +619,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
*/
private function getEntityWorker($ent, $isGood, $options)
{
@ -696,8 +733,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
*/
public function testDeleteEntity()
{
@ -712,8 +752,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
*/
private function deleteEntityWorker($ent, $useETag, $options)
{
@ -754,7 +797,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntity()
{
@ -767,7 +812,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertBadEntity()
{
@ -786,7 +833,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityBoolean()
{
@ -799,30 +848,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
// /**
// * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
// * @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
// */
// public function testInsertEntityBooleanNegative()
// {
// foreach(TableServiceFunctionalTestData::getInterestingBadBooleans() as $o) {
// $ent = new Entity();
// $ent->setPartitionKey(TableServiceFunctionalTestData::getNewKey());
// $ent->setRowKey(TableServiceFunctionalTestData::getNewKey());
// try {
// $ent->addProperty('BOOLEAN', EdmType::BOOLEAN, $o);
// $this->fail('Should get an exception when trying to parse this value');
// $this->insertEntityWorker($ent, false, null, $o);
// } catch (\Exception $e) {
// $this->assertEquals(0, $e->getCode(), 'getCode');
// $this->assertTrue(true, 'got expected exception');
// }
// }
// }
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityDate()
{
@ -837,7 +867,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityDateNegative()
{
@ -858,7 +890,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityDouble()
{
@ -873,7 +907,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityDoubleNegative()
{
@ -894,7 +930,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityGuid()
{
@ -909,7 +947,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityGuidNegative()
{
@ -930,7 +970,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityInt()
{
@ -945,7 +987,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityIntNegative()
{
@ -966,7 +1010,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityLong()
{
@ -981,7 +1027,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityLongNegative()
{
@ -1002,7 +1050,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityBinary()
{
@ -1017,7 +1067,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityBinaryNegative()
{
@ -1038,7 +1090,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertEntityString()
{
@ -1053,7 +1107,9 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
private function insertEntityWorker($ent, $isGood, $options, $specialValue = null)
{
@ -1102,8 +1158,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
public function testUpdateEntity()
{
@ -1120,8 +1179,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
private function updateEntityWorker($initialEnt, $ent, $options)
{
@ -1153,8 +1215,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testMergeEntity()
{
@ -1171,8 +1236,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
private function mergeEntityWorker($initialEnt, $ent, $options)
{
@ -1205,8 +1273,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertOrReplaceEntity()
{
@ -1233,8 +1304,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
private function insertOrReplaceEntityWorker($initialEnt, $ent, $options)
{
@ -1266,8 +1340,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
public function testInsertOrMergeEntity()
{
@ -1294,8 +1371,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntities
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryEntitiesAsync
*/
private function insertOrMergeEntityWorker($initialEnt, $ent, $options)
{
@ -1328,11 +1408,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
public function testCRUDdeleteEntity()
{
@ -1350,11 +1436,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/*
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
public function testCRUDinsertEntity()
{
@ -1372,11 +1464,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
public function testCRUDinsertOrMergeEntity()
{
@ -1396,11 +1494,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/*
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
public function testCRUDinsertOrReplaceEntity()
{
@ -1420,11 +1524,17 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
*/
public function testCRUDmergeEntity()
{
@ -1442,11 +1552,19 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
*/
public function testCRUDupdateEntity()
{
@ -1462,14 +1580,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
*/
private function crudWorker($opType, $concurType, $mutatePivot, $ent, $options)
{
$exptErr = $this->expectConcurrencyFailure($opType, $concurType);
@ -1503,7 +1613,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
*/
public function testBatchPositiveFirstNoKeyMatch()
{
@ -1512,7 +1626,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
*/
public function testBatchPositiveFirstKeyMatchNoETag()
{
@ -1521,7 +1639,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
*/
public function testBatchPositiveFirstKeyMatchETagMismatch()
{
@ -1531,7 +1653,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
*/
public function testBatchPositiveFirstKeyMatchETagMatch()
{
@ -1540,7 +1666,11 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batchAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntityAsync
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntityAsync
*/
public function testBatchNegative()
{
@ -1668,10 +1798,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
*/
private function batchPositiveOuter($firstConcurType, $seed)
{
// The random here is not to generate random values, but to
@ -1738,10 +1864,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::batch
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
*/
private function batchWorker($configs, $options)
{
$exptErrs = array();
@ -1840,9 +1962,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
$this->clearTable($table);
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
*/
private function verifyEntryData($table, $exptErr, $targetEnt, $opResult)
{
if ($opResult instanceof InsertEntityResult) {
@ -1919,14 +2038,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrMergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertOrReplaceEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::mergeEntity
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
*/
private function executeCrudMethod($table, $targetEnt, $opType, $concurType, $options)
{
switch ($opType) {
@ -1982,9 +2093,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::getEntity
*/
private function verifyCrudWorker($opType, $table, $initialEnt, $targetEnt, $expectedSuccess)
{
$entInTable = null;
@ -2036,9 +2144,6 @@ class TableServiceFunctionalTest extends FunctionalTestBase
}
}
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity
*/
private function createTargetEntity($table, $initialEnt, $concurType, $mutatePivot)
{
$targetEnt = TableServiceFunctionalTestUtils::cloneEntity($initialEnt);
@ -2139,6 +2244,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
* @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack
*/
public function testMiddlewares()
@ -2191,6 +2297,7 @@ class TableServiceFunctionalTest extends FunctionalTestBase
/**
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTables
* @covers MicrosoftAzure\Storage\Table\TableRestProxy::queryTablesAsync
* @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::createHandlerStack
*/
public function testRetryFromSecondary()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -60,7 +60,7 @@ class ListBlobBlocksResultTest extends \PHPUnit_Framework_TestCase
$sampleHeaders = TestResources::listBlocksMultipleEntriesHeaders();
$sampleBody = TestResources::listBlocksMultipleEntriesBody();
$expectedDate = Utilities::rfc1123ToDateTime($sampleHeaders['Last-Modified']);
$getEntry = self::getMethod('_getEntries');
$getEntry = self::getMethod('getEntries');
$uncommittedBlocks = $getEntry->invokeArgs(null, array($sampleBody, 'UncommittedBlocks'));
$committedBlocks = $getEntry->invokeArgs(null, array($sampleBody, 'CommittedBlocks'));

Просмотреть файл

@ -101,13 +101,15 @@ class SharedKeyAuthSchemeTest extends \PHPUnit_Framework_TestCase
$headers = array(Resources::X_MS_VERSION => $apiVersion, Resources::X_MS_DATE => $date1);
$queryParams = array(Resources::QP_COMP => 'list');
$httpMethod = 'GET';
$expected = 'SharedKey ' . $accountName . ':YDjZ61Lqt6HeMx+vv5QzFjW1juW7XEECVXJ4V9/pFgA=';
$expected = 'SharedKey ' . $accountName;
$mock = new SharedKeyAuthSchemeMock($accountName, $accountKey);
$actual = $mock->getAuthorizationHeader($headers, $url, $queryParams, $httpMethod);
$this->assertEquals($expected, $actual);
$this->assertTrue(
substr($actual, 0, \strlen($expected)) == $expected
);
}
/**

Просмотреть файл

@ -61,22 +61,22 @@ class ValidateTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers MicrosoftAzure\Storage\Common\Internal\Validate::isString
* @covers MicrosoftAzure\Storage\Common\Internal\Validate::canCastAsString
*/
public function testIsStringWithString()
{
Validate::isString('I\'m a string', 'string');
Validate::canCastAsString('I\'m a string', 'string');
$this->assertTrue(true);
}
/**
* @covers MicrosoftAzure\Storage\Common\Internal\Validate::isString
* @covers MicrosoftAzure\Storage\Common\Internal\Validate::canCastAsString
*/
public function testIsStringWithNonString()
{
$this->setExpectedException(get_class(new InvalidArgumentTypeException('')));
Validate::isString(new \DateTime(), 'string');
Validate::canCastAsString(new \DateTime(), 'string');
}
/**

Просмотреть файл

@ -124,4 +124,33 @@ class ServicesBuilderTest extends \PHPUnit_Framework_TestCase
// Assert
$this->assertInstanceOf('MicrosoftAzure\Storage\Common\ServicesBuilder', $actual);
}
/**
* @covers MicrosoftAzure\Storage\Common\ServicesBuilder::createContainerAnonymousAccess
*/
public function testBuildForAnonymousAccess()
{
$builder = new ServicesBuilder();
$pEndpoint = sprintf(
'%s://%s%s',
Resources::HTTP_SCHEME,
'myaccount.',
Resources::BLOB_BASE_DNS_NAME
);
$sEndpoint = sprintf(
'%s://%s%s',
Resources::HTTP_SCHEME,
'myaccount-secondary.',
Resources::BLOB_BASE_DNS_NAME
);
$blobRestProxy = $builder->createContainerAnonymousAccess(
$pEndpoint,
$sEndpoint
);
$this->assertInstanceOf('MicrosoftAzure\Storage\Blob\Internal\IBlob', $blobRestProxy);
$this->assertEquals('myaccount', $blobRestProxy->getAccountName());
}
}

Просмотреть файл

@ -215,6 +215,16 @@ class FileRestProxyTest extends FileServiceRestProxyTestBase
$this->assertEquals(0, $result->getShareUsage());
}
/**
* @covers \MicrosoftAzure\Storage\File\FileRestProxy::listDirectoriesAndFiles
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage can't be NULL.
*/
public function testListDirectoriesAndFilesWithNull()
{
$this->restProxy->listDirectoriesAndFiles(null);
}
/**
* @covers \MicrosoftAzure\Storage\File\FileRestProxy::deleteShare
* @covers \MicrosoftAzure\Storage\File\FileRestProxy::deleteShareAsync