Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Adding functional test cases and fixed some issues in the previous PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
katmsft committed Apr 1, 2017
1 parent 9aa46e3 commit d674f3e
Show file tree
Hide file tree
Showing 11 changed files with 786 additions and 245 deletions.
2 changes: 1 addition & 1 deletion src/Common/Internal/Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Resources
const INVALID_NEGATIVE_PARAM = 'The provided parameter \'%s\' should be positive number.';
const SIGNED_SERVICE_INVALID_VALIDATION_MSG = 'The signed service should only be a combination of the letters b(lob) q(ueue) t(able) or f(ile).';
const SIGNED_RESOURCE_TYPE_INVALID_VALIDATION_MSG = 'The signed resource type should only be a combination of the letters s(ervice) c(container) or o(bject).';
const SIGNED_PERMISSIONS_INVALID_VALIDATION_MSG = 'The signed permissions should only be a combination of the letters r, w, d, l, a, c, u, p.';
const STRING_NOT_WITH_GIVEN_COMBINATION = 'The string should only be a combination of the letters %s.';
const SIGNED_PROTOCOL_INVALID_VALIDATION_MSG = 'The signed protocol is invalid: possible values are https or https,http.';
const ERROR_RESOURCE_TYPE_NOT_SUPPORTED = 'The given resource type cannot be recognized or is not supported.';
const ERROR_TOO_MANY_SIGNED_IDENTIFIERS = 'There can be at most 5 signed identifiers at the same time.';
Expand Down
3 changes: 3 additions & 0 deletions src/Common/Internal/RestProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Internal\IMiddleware;
use MicrosoftAzure\Storage\Common\Middlewares\HistoryMiddleware;

/**
* Base class for all REST proxies.
Expand Down Expand Up @@ -67,6 +68,8 @@ public function __construct(Serialization\ISerializer $dataSerializer = null, $u
$this->middlewares = array();
$this->dataSerializer = $dataSerializer;
$this->_uri = $uri;
//For logging the request and responses.
//$this->middlewares[] = new HistoryMiddleware('.\\messages.log');
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/Common/Internal/ServiceRestProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use MicrosoftAzure\Storage\Common\Internal\RetryMiddlewareFactory;
use MicrosoftAzure\Storage\Common\Internal\Http\HttpCallContext;
use MicrosoftAzure\Storage\Common\Internal\Middlewares\MiddlewareBase;
use MicrosoftAzure\Storage\Common\Middlewares\HistoryMiddleware;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Promise\EachPromise;
use GuzzleHttp\Exception\RequestException;
Expand Down Expand Up @@ -85,9 +84,6 @@ public function __construct(
$this->_accountName = $accountName;
$this->_psrUri = new \GuzzleHttp\Psr7\Uri($uri);
$this->_options = array_merge(array('http' => array()), $options);

//For logging the request and responses.
// $this->_options['middlewares'][] = (new HistoryMiddleware('.\\messages.log'));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Internal/ServiceSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ protected static function parseAndValidateKeys($connectionString)
static::init();
static::$isInitialized = true;
}

$tokenizedSettings = ConnectionStringParser::parseConnectionString(
'connectionString',
$connectionString
);

// Assure that all given keys are valid.
foreach ($tokenizedSettings as $key => $value) {
if (!Utilities::inArrayInsensitive($key, static::$validSettingKeys)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Middlewares/HistoryMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private function appendNewEntryToPath(array $entry)
$entryString = $delimiter;
$entryString .= sprintf(
"Time: %s\n",
(new \DateTime())->format('Y-m-d H:i:s')
(new \DateTime("now", new \DateTimeZone('UTC')))->format('Y-m-d H:i:s')
);
$entryString .= MessageSerializer::objectSerialize($entry['request']);
if (array_key_exists('reason', $entry)) {
Expand Down
12 changes: 6 additions & 6 deletions src/Common/ServicesBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ protected function sasAuthenticationScheme($sasToken)
/**
* Builds a queue service object, it accepts the following
* options:
*
*
* - http: (array) the underlying guzzle options. refer to
* http://docs.guzzlephp.org/en/latest/request-options.html for detailed available options
* - middlewares: (mixed) the middleware should be either an instance of a sub-class that
* implements {@see MicrosoftAzure\Storage\Common\Middlewares\IMiddleware}, or a
* `callable` that follows the Guzzle middleware implementation convention
* `callable` that follows the Guzzle middleware implementation convention
*
* @param string $connectionString The configuration connection string.
* @param array $options Array of options to pass to the service
Expand Down Expand Up @@ -204,12 +204,12 @@ public function createQueueService($connectionString, array $options = [])
/**
* Builds a blob service object, it accepts the following
* options:
*
*
* - http: (array) the underlying guzzle options. refer to
* http://docs.guzzlephp.org/en/latest/request-options.html for detailed available options
* - middlewares: (mixed) the middleware should be either an instance of a sub-class that
* implements {@see MicrosoftAzure\Storage\Common\Middlewares\IMiddleware}, or a
* `callable` that follows the Guzzle middleware implementation convention
* `callable` that follows the Guzzle middleware implementation convention
*
* @param string $connectionString The configuration connection string.
* @param array $options Array of options to pass to the service
Expand Down Expand Up @@ -255,12 +255,12 @@ public function createBlobService($connectionString, array $options = [])
/**
* Builds a table service object, it accepts the following
* options:
*
*
* - http: (array) the underlying guzzle options. refer to
* http://docs.guzzlephp.org/en/latest/request-options.html for detailed available options
* - middlewares: (mixed) the middleware should be either an instance of a sub-class that
* implements {@see MicrosoftAzure\Storage\Common\Middlewares\IMiddleware}, or a
* `callable` that follows the Guzzle middleware implementation convention
* `callable` that follows the Guzzle middleware implementation convention
*
* @param string $connectionString The configuration connection string.
* @param array $options Array of options to pass to the service
Expand Down
Loading

0 comments on commit d674f3e

Please sign in to comment.