From 4186dd059080e11266bada7323507fd9d6e18f6c Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Thu, 29 Apr 2021 14:30:48 -0700 Subject: [PATCH 01/10] Fix Directories and Namespaces to be CamelCase --- composer.json | 29 +++++++++---------- .../AppIdentity}/AppIdentityException.php | 2 +- .../AppIdentity}/AppIdentityService.php | 8 ++--- .../AppIdentity}/PublicCertificate.php | 2 +- .../AppIdentity}/app_identity_service_pb.php | 2 +- .../Memcache}/memcache_service_pb.php | 2 +- .../Urlfetch}/urlfetch_service_pb.php | 2 +- src/{api => Api}/api_base_pb.php | 2 +- src/{api => Api}/source_pb.php | 2 +- src/{datastore => Datastore}/action_pb.php | 2 +- .../datastore_v3_pb.php | 10 +++---- .../datastore_v4_pb.php | 4 +-- src/{datastore => Datastore}/document_pb.php | 2 +- src/{datastore => Datastore}/entity_pb.php | 2 +- src/{datastore => Datastore}/entity_v4_pb.php | 2 +- src/{datastore => Datastore}/snapshot_pb.php | 2 +- .../RemoteApi}/remote_api_pb.php | 6 ++-- src/{runtime => Runtime}/ApiProxy.php | 2 +- src/{runtime => Runtime}/ApiProxyBase.php | 20 ++++++------- src/{runtime => Runtime}/ApplicationError.php | 2 +- src/{runtime => Runtime}/ArgumentError.php | 2 +- .../CallNotFoundError.php | 2 +- src/{runtime => Runtime}/CancelledError.php | 2 +- .../CapabilityDisabledError.php | 2 +- src/{runtime => Runtime}/CurlLite.php | 12 ++++---- .../CurlLiteMethodNotSupportedException.php | 2 +- .../CurlLiteOptionNotSupportedException.php | 2 +- .../DeadlineExceededError.php | 2 +- .../DirectUploadHandler.php | 2 +- src/{runtime => Runtime}/Error.php | 2 +- .../FeatureNotEnabledError.php | 2 +- src/{runtime => Runtime}/Mail.php | 10 +++---- src/{runtime => Runtime}/Memcache.php | 8 ++--- src/{runtime => Runtime}/MemcacheUtils.php | 2 +- src/{runtime => Runtime}/Memcached.php | 8 ++--- src/{runtime => Runtime}/OverQuotaError.php | 2 +- .../proto => Runtime/Proto}/Decoder.php | 2 +- .../proto => Runtime/Proto}/Encoder.php | 4 +-- .../Proto}/ProtocolBufferDecodeError.php | 0 .../Proto}/ProtocolBufferEncodeError.php | 0 .../Proto}/ProtocolMessage.php | 8 ++--- src/{runtime => Runtime}/RPCFailedError.php | 2 +- src/{runtime => Runtime}/RealApiProxy.php | 2 +- src/{runtime => Runtime}/RemoteApiProxy.php | 8 ++--- .../RequestTooLargeError.php | 2 +- .../ResponseTooLargeError.php | 2 +- src/{runtime => Runtime}/Setup.php | 2 +- src/{runtime => Runtime}/UnlinkUploads.php | 0 .../VirtualFileSystem.php | 0 src/{runtime => Runtime}/VmApiProxy.php | 24 +++++++-------- src/{testing => Testing}/ApiCallArguments.php | 2 +- src/{testing => Testing}/ApiProxyMock.php | 6 ++-- src/{testing => Testing}/ApiProxyTestBase.php | 6 ++-- src/{testing => Testing}/TestUtils.php | 2 +- src/{util => Util}/ArrayUtil.php | 2 +- src/{util => Util}/HttpUtil.php | 2 +- src/{util => Util}/StringUtil.php | 2 +- .../AppIdentity}/AppIdentityServiceTest.php | 16 +++++----- .../DatastoreProtoTest.php | 0 .../DatastoreV4ProtoTest.php | 0 .../RemoteApi}/RemoteApiProtoTest.php | 0 tests/{runtime => Runtime}/ApiProxyTest.php | 6 ++-- tests/{runtime => Runtime}/CurlLiteStub.php | 6 ++-- tests/{runtime => Runtime}/CurlLiteTest.php | 12 ++++---- .../DirectUploadHandlerTest.php | 2 +- tests/{runtime => Runtime}/MailTest.php | 6 ++-- tests/{runtime => Runtime}/MemcacheTest.php | 4 +-- tests/{runtime => Runtime}/MemcachedTest.php | 4 +-- .../UnlinkUploadsTest.php | 2 +- tests/{runtime => Runtime}/VmApiProxyTest.php | 14 ++++----- tests/{util => Util}/ArrayUtilTest.php | 6 ++-- 71 files changed, 162 insertions(+), 161 deletions(-) rename src/{api/app_identity => Api/AppIdentity}/AppIdentityException.php (94%) rename src/{api/app_identity => Api/AppIdentity}/AppIdentityService.php (98%) rename src/{api/app_identity => Api/AppIdentity}/PublicCertificate.php (97%) rename src/{api/app_identity => Api/AppIdentity}/app_identity_service_pb.php (99%) rename src/{api/memcache => Api/Memcache}/memcache_service_pb.php (99%) rename src/{api/urlfetch => Api/Urlfetch}/urlfetch_service_pb.php (99%) rename src/{api => Api}/api_base_pb.php (99%) rename src/{api => Api}/source_pb.php (98%) rename src/{datastore => Datastore}/action_pb.php (92%) rename src/{datastore => Datastore}/datastore_v3_pb.php (99%) rename src/{datastore => Datastore}/datastore_v4_pb.php (99%) rename src/{datastore => Datastore}/document_pb.php (99%) rename src/{datastore => Datastore}/entity_pb.php (99%) rename src/{datastore => Datastore}/entity_v4_pb.php (99%) rename src/{datastore => Datastore}/snapshot_pb.php (98%) rename src/{ext/remote_api => Ext/RemoteApi}/remote_api_pb.php (99%) rename src/{runtime => Runtime}/ApiProxy.php (98%) rename src/{runtime => Runtime}/ApiProxyBase.php (83%) rename src/{runtime => Runtime}/ApplicationError.php (96%) rename src/{runtime => Runtime}/ArgumentError.php (95%) rename src/{runtime => Runtime}/CallNotFoundError.php (95%) rename src/{runtime => Runtime}/CancelledError.php (95%) rename src/{runtime => Runtime}/CapabilityDisabledError.php (95%) rename src/{runtime => Runtime}/CurlLite.php (98%) rename src/{runtime => Runtime}/CurlLiteMethodNotSupportedException.php (95%) rename src/{runtime => Runtime}/CurlLiteOptionNotSupportedException.php (95%) rename src/{runtime => Runtime}/DeadlineExceededError.php (95%) rename src/{runtime => Runtime}/DirectUploadHandler.php (98%) rename src/{runtime => Runtime}/Error.php (94%) rename src/{runtime => Runtime}/FeatureNotEnabledError.php (95%) rename src/{runtime => Runtime}/Mail.php (97%) rename src/{runtime => Runtime}/Memcache.php (99%) rename src/{runtime => Runtime}/MemcacheUtils.php (98%) rename src/{runtime => Runtime}/Memcached.php (99%) rename src/{runtime => Runtime}/OverQuotaError.php (95%) rename src/{runtime/proto => Runtime/Proto}/Decoder.php (99%) rename src/{runtime/proto => Runtime/Proto}/Encoder.php (97%) rename src/{runtime/proto => Runtime/Proto}/ProtocolBufferDecodeError.php (100%) rename src/{runtime/proto => Runtime/Proto}/ProtocolBufferEncodeError.php (100%) rename src/{runtime/proto => Runtime/Proto}/ProtocolMessage.php (97%) rename src/{runtime => Runtime}/RPCFailedError.php (95%) rename src/{runtime => Runtime}/RealApiProxy.php (98%) rename src/{runtime => Runtime}/RemoteApiProxy.php (94%) rename src/{runtime => Runtime}/RequestTooLargeError.php (95%) rename src/{runtime => Runtime}/ResponseTooLargeError.php (95%) rename src/{runtime => Runtime}/Setup.php (98%) rename src/{runtime => Runtime}/UnlinkUploads.php (100%) rename src/{runtime => Runtime}/VirtualFileSystem.php (100%) rename src/{runtime => Runtime}/VmApiProxy.php (93%) rename src/{testing => Testing}/ApiCallArguments.php (97%) rename src/{testing => Testing}/ApiProxyMock.php (93%) rename src/{testing => Testing}/ApiProxyTestBase.php (87%) rename src/{testing => Testing}/TestUtils.php (99%) rename src/{util => Util}/ArrayUtil.php (99%) rename src/{util => Util}/HttpUtil.php (98%) rename src/{util => Util}/StringUtil.php (98%) rename tests/{api/app_identity => Api/AppIdentity}/AppIdentityServiceTest.php (96%) rename tests/{datastore => Datastore}/DatastoreProtoTest.php (100%) rename tests/{datastore => Datastore}/DatastoreV4ProtoTest.php (100%) rename tests/{ext/remote_api => Ext/RemoteApi}/RemoteApiProtoTest.php (100%) rename tests/{runtime => Runtime}/ApiProxyTest.php (96%) rename tests/{runtime => Runtime}/CurlLiteStub.php (99%) rename tests/{runtime => Runtime}/CurlLiteTest.php (98%) rename tests/{runtime => Runtime}/DirectUploadHandlerTest.php (99%) rename tests/{runtime => Runtime}/MailTest.php (99%) rename tests/{runtime => Runtime}/MemcacheTest.php (99%) rename tests/{runtime => Runtime}/MemcachedTest.php (99%) rename tests/{runtime => Runtime}/UnlinkUploadsTest.php (99%) rename tests/{runtime => Runtime}/VmApiProxyTest.php (97%) rename tests/{util => Util}/ArrayUtilTest.php (92%) diff --git a/composer.json b/composer.json index 33c9c3b0..629a6b8f 100644 --- a/composer.json +++ b/composer.json @@ -19,23 +19,22 @@ }, "autoload": { "psr-4": { - "google\\appengine\\": "src" + "Google\\Appengine\\": "src" }, "classmap": [ - "src/api/api_base_pb.php", - "src/api/memcache/memcache_service_pb.php", - "src/api/urlfetch/urlfetch_service_pb.php", - "src/api/app_identity/app_identity_service_pb.php", - "src/api/app_identity/app_identity_service_pb.php", - "src/datastore/action_pb.php", - "src/datastore/datastore_v3_pb.php", - "src/datastore/datastore_v4_pb.php", - "src/ext/remote_api/remote_api_pb.php", - "src/runtime/proto/ProtocolMessage.php", - "src/runtime/proto/ProtocolBufferEncodeError.php", - "src/runtime/proto/ProtocolBufferDecodeError.php", - "src/runtime/proto/Encoder.php", - "src/runtime/proto/Decoder.php" + "src/Api/api_base_pb.php", + "src/Api/Memcache/memcache_service_pb.php", + "src/Api/Urlfetch/urlfetch_service_pb.php", + "src/Api/AppIdentity/app_identity_service_pb.php", + "src/Datastore/action_pb.php", + "src/Datastore/datastore_v3_pb.php", + "src/Datastore/datastore_v4_pb.php", + "src/Ext/RemoteApi/remote_api_pb.php", + "src/Runtime/Proto/ProtocolMessage.php", + "src/Runtime/Proto/ProtocolBufferEncodeError.php", + "src/Runtime/Proto/ProtocolBufferDecodeError.php", + "src/Runtime/Proto/Encoder.php", + "src/Runtime/Proto/Decoder.php" ] } } diff --git a/src/api/app_identity/AppIdentityException.php b/src/Api/AppIdentity/AppIdentityException.php similarity index 94% rename from src/api/app_identity/AppIdentityException.php rename to src/Api/AppIdentity/AppIdentityException.php index 0134368d..49b45245 100644 --- a/src/api/app_identity/AppIdentityException.php +++ b/src/Api/AppIdentity/AppIdentityException.php @@ -17,7 +17,7 @@ /** */ -namespace google\appengine\api\app_identity; +namespace Google\Appengine\Api\AppIdentity; /** * Thrown when there is a general failure using the AppIdentityService. diff --git a/src/api/app_identity/AppIdentityService.php b/src/Api/AppIdentity/AppIdentityService.php similarity index 98% rename from src/api/app_identity/AppIdentityService.php rename to src/Api/AppIdentity/AppIdentityService.php index 042033b2..9e99ca10 100644 --- a/src/api/app_identity/AppIdentityService.php +++ b/src/Api/AppIdentity/AppIdentityService.php @@ -18,7 +18,7 @@ */ -namespace google\appengine\api\app_identity; +namespace Google\Appengine\Api\AppIdentity; use google\appengine\AppIdentityServiceError\ErrorCode; use google\appengine\GetAccessTokenRequest; @@ -29,9 +29,9 @@ use google\appengine\GetServiceAccountNameResponse; use google\appengine\SignForAppRequest; use google\appengine\SignForAppResponse; -use google\appengine\runtime\ApiProxy; -use google\appengine\runtime\ApplicationError; -use google\appengine\runtime\Memcache; +use Google\Appengine\Runtime\ApiProxy; +use Google\Appengine\Runtime\ApplicationError; +use Google\Appengine\Runtime\Memcache; /** * The AppIdentityService allows you to sign arbitrary byte diff --git a/src/api/app_identity/PublicCertificate.php b/src/Api/AppIdentity/PublicCertificate.php similarity index 97% rename from src/api/app_identity/PublicCertificate.php rename to src/Api/AppIdentity/PublicCertificate.php index ae03a47a..cc37ae56 100644 --- a/src/api/app_identity/PublicCertificate.php +++ b/src/Api/AppIdentity/PublicCertificate.php @@ -17,7 +17,7 @@ /** */ -namespace google\appengine\api\app_identity; +namespace Google\Appengine\Api\AppIdentity; /** * PublicCertificate contains an X509 public certificate in PEM format and a diff --git a/src/api/app_identity/app_identity_service_pb.php b/src/Api/AppIdentity/app_identity_service_pb.php similarity index 99% rename from src/api/app_identity/app_identity_service_pb.php rename to src/Api/AppIdentity/app_identity_service_pb.php index 5d57505b..b53ff1e3 100644 --- a/src/api/app_identity/app_identity_service_pb.php +++ b/src/Api/AppIdentity/app_identity_service_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace google\appengine\AppIdentityServiceError { diff --git a/src/api/memcache/memcache_service_pb.php b/src/Api/Memcache/memcache_service_pb.php similarity index 99% rename from src/api/memcache/memcache_service_pb.php rename to src/Api/Memcache/memcache_service_pb.php index 1621363f..f810a49b 100644 --- a/src/api/memcache/memcache_service_pb.php +++ b/src/Api/Memcache/memcache_service_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace google\appengine\MemcacheServiceError { diff --git a/src/api/urlfetch/urlfetch_service_pb.php b/src/Api/Urlfetch/urlfetch_service_pb.php similarity index 99% rename from src/api/urlfetch/urlfetch_service_pb.php rename to src/Api/Urlfetch/urlfetch_service_pb.php index 626983fa..38a51455 100644 --- a/src/api/urlfetch/urlfetch_service_pb.php +++ b/src/Api/Urlfetch/urlfetch_service_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace google\appengine\URLFetchServiceError { diff --git a/src/api/api_base_pb.php b/src/Api/api_base_pb.php similarity index 99% rename from src/api/api_base_pb.php rename to src/Api/api_base_pb.php index 608b4f21..49db303b 100644 --- a/src/api/api_base_pb.php +++ b/src/Api/api_base_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace google\appengine\base { diff --git a/src/api/source_pb.php b/src/Api/source_pb.php similarity index 98% rename from src/api/source_pb.php rename to src/Api/source_pb.php index 2947cbc9..ab5f9f31 100644 --- a/src/api/source_pb.php +++ b/src/Api/source_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'google/runtime/proto/ProtocolMessage.php'; + require_once 'google/Runtime/Proto/ProtocolMessage.php'; } } namespace google\appengine { diff --git a/src/datastore/action_pb.php b/src/Datastore/action_pb.php similarity index 92% rename from src/datastore/action_pb.php rename to src/Datastore/action_pb.php index 64d4eb86..23efcbbe 100644 --- a/src/datastore/action_pb.php +++ b/src/Datastore/action_pb.php @@ -19,7 +19,7 @@ namespace google\appengine_datastore_v3; -require_once 'src/runtime/proto/ProtocolMessage.php'; +require_once 'src/Runtime/Proto/ProtocolMessage.php'; abstract class Action extends \google\net\ProtocolMessage { } diff --git a/src/datastore/datastore_v3_pb.php b/src/Datastore/datastore_v3_pb.php similarity index 99% rename from src/datastore/datastore_v3_pb.php rename to src/Datastore/datastore_v3_pb.php index e1d073af..a7a52621 100644 --- a/src/datastore/datastore_v3_pb.php +++ b/src/Datastore/datastore_v3_pb.php @@ -19,11 +19,11 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; - require_once 'src/api/api_base_pb.php'; - require_once 'src/datastore/action_pb.php'; - require_once 'src/datastore/entity_pb.php'; - require_once 'src/datastore/snapshot_pb.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; + require_once 'src/Api/api_base_pb.php'; + require_once 'src/Datastore/action_pb.php'; + require_once 'src/Datastore/entity_pb.php'; + require_once 'src/Datastore/snapshot_pb.php'; } } namespace google\appengine_datastore_v3 { diff --git a/src/datastore/datastore_v4_pb.php b/src/Datastore/datastore_v4_pb.php similarity index 99% rename from src/datastore/datastore_v4_pb.php rename to src/Datastore/datastore_v4_pb.php index 451ed418..ad727c62 100644 --- a/src/datastore/datastore_v4_pb.php +++ b/src/Datastore/datastore_v4_pb.php @@ -19,8 +19,8 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; - require_once 'src/datastore/entity_v4_pb.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; + require_once 'src/Datastore/entity_v4_pb.php'; } } namespace google\appengine\datastore\v4\Error { diff --git a/src/datastore/document_pb.php b/src/Datastore/document_pb.php similarity index 99% rename from src/datastore/document_pb.php rename to src/Datastore/document_pb.php index 5b976236..a32f17b7 100644 --- a/src/datastore/document_pb.php +++ b/src/Datastore/document_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace storage_onestore_v3\FieldValue { diff --git a/src/datastore/entity_pb.php b/src/Datastore/entity_pb.php similarity index 99% rename from src/datastore/entity_pb.php rename to src/Datastore/entity_pb.php index 14fef8cd..a2619f72 100644 --- a/src/datastore/entity_pb.php +++ b/src/Datastore/entity_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace storage_onestore_v3\PropertyValue { diff --git a/src/datastore/entity_v4_pb.php b/src/Datastore/entity_v4_pb.php similarity index 99% rename from src/datastore/entity_v4_pb.php rename to src/Datastore/entity_v4_pb.php index b53cc8ae..d28d9ee8 100644 --- a/src/datastore/entity_v4_pb.php +++ b/src/Datastore/entity_v4_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace google\appengine\datastore\v4\PartitionId { diff --git a/src/datastore/snapshot_pb.php b/src/Datastore/snapshot_pb.php similarity index 98% rename from src/datastore/snapshot_pb.php rename to src/Datastore/snapshot_pb.php index e9eb9e9d..a4ecee7a 100644 --- a/src/datastore/snapshot_pb.php +++ b/src/Datastore/snapshot_pb.php @@ -19,7 +19,7 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; } } namespace storage_onestore_v3\Snapshot { diff --git a/src/ext/remote_api/remote_api_pb.php b/src/Ext/RemoteApi/remote_api_pb.php similarity index 99% rename from src/ext/remote_api/remote_api_pb.php rename to src/Ext/RemoteApi/remote_api_pb.php index 2216d202..fcfbc530 100644 --- a/src/ext/remote_api/remote_api_pb.php +++ b/src/Ext/RemoteApi/remote_api_pb.php @@ -19,9 +19,9 @@ namespace dummy { if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolMessage.php'; - require_once 'src/datastore/datastore_v3_pb.php'; - require_once 'src/datastore/entity_pb.php'; + require_once 'src/Runtime/Proto/ProtocolMessage.php'; + require_once 'src/Datastore/datastore_v3_pb.php'; + require_once 'src/Datastore/entity_pb.php'; } } diff --git a/src/runtime/ApiProxy.php b/src/Runtime/ApiProxy.php similarity index 98% rename from src/runtime/ApiProxy.php rename to src/Runtime/ApiProxy.php index 6a8b6a62..a4e5a1eb 100644 --- a/src/runtime/ApiProxy.php +++ b/src/Runtime/ApiProxy.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; class ApiProxy { private static $apiProxy = null; diff --git a/src/runtime/ApiProxyBase.php b/src/Runtime/ApiProxyBase.php similarity index 83% rename from src/runtime/ApiProxyBase.php rename to src/Runtime/ApiProxyBase.php index 9f85eefb..87c23179 100644 --- a/src/runtime/ApiProxyBase.php +++ b/src/Runtime/ApiProxyBase.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; abstract class ApiProxyBase { const OK = 0; @@ -33,32 +33,32 @@ abstract class ApiProxyBase { protected static $exceptionLookupTable = array( self::RPC_FAILED => array( - '\google\appengine\runtime\RPCFailedError', + '\Google\Appengine\Runtime\RPCFailedError', 'The remote RPC to the application server failed for the call %s.%s().'), self::CALL_NOT_FOUND => array( - '\google\appengine\runtime\CallNotFoundError', + '\Google\Appengine\Runtime\CallNotFoundError', "The API package '%s' or call '%s()' was not found."), self::ARGUMENT_ERROR => array( - '\google\appengine\runtime\ArgumentError', + '\Google\Appengine\Runtime\ArgumentError', 'An error occurred parsing (locally or remotely) the arguments to %s.%s().' ), self::DEADLINE_EXCEEDED => array( - '\google\appengine\runtime\DeadlineExceededError', + '\Google\Appengine\Runtime\DeadlineExceededError', 'The API call %s.%s() took too long to respond and was cancelled.'), self::CANCELLED => array( - '\google\appengine\runtime\CancelledError', + '\Google\Appengine\Runtime\CancelledError', 'The API call %s.%s() was explicitly cancelled.'), self::OTHER_ERROR => array( - '\google\appengine\runtime\Error', + '\Google\Appengine\Runtime\Error', 'An error occurred for the API request %s.%s().'), self::OVER_QUOTA => array( - '\google\appengine\runtime\OverQuotaError', + '\Google\Appengine\Runtime\OverQuotaError', 'The API call %s.%s() required more quota than is available.'), self::REQUEST_TOO_LARGE => array( - '\google\appengine\runtime\RequestTooLargeError', + '\Google\Appengine\Runtime\RequestTooLargeError', 'The request to API call %s.%s() was too large.'), self::RESPONSE_TOO_LARGE => array( - '\google\appengine\runtime\ResponseTooLargeError', + '\Google\Appengine\Runtime\ResponseTooLargeError', 'The response from API call %s.%s() was too large.'), # APPLICATION_ERROR is special-cased to create an ApplicationError diff --git a/src/runtime/ApplicationError.php b/src/Runtime/ApplicationError.php similarity index 96% rename from src/runtime/ApplicationError.php rename to src/Runtime/ApplicationError.php index 5ba2e2aa..256ad6e9 100644 --- a/src/runtime/ApplicationError.php +++ b/src/Runtime/ApplicationError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy in the event of an application-level error. diff --git a/src/runtime/ArgumentError.php b/src/Runtime/ArgumentError.php similarity index 95% rename from src/runtime/ArgumentError.php rename to src/Runtime/ArgumentError.php index 307f3e43..4d3195ad 100644 --- a/src/runtime/ArgumentError.php +++ b/src/Runtime/ArgumentError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls if there is an error parsing the arguments. diff --git a/src/runtime/CallNotFoundError.php b/src/Runtime/CallNotFoundError.php similarity index 95% rename from src/runtime/CallNotFoundError.php rename to src/Runtime/CallNotFoundError.php index 54cf48ef..1636b589 100644 --- a/src/runtime/CallNotFoundError.php +++ b/src/Runtime/CallNotFoundError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls when the requested method cannot be found. diff --git a/src/runtime/CancelledError.php b/src/Runtime/CancelledError.php similarity index 95% rename from src/runtime/CancelledError.php rename to src/Runtime/CancelledError.php index 539fa44c..675dd949 100644 --- a/src/runtime/CancelledError.php +++ b/src/Runtime/CancelledError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls if the call was cancelled, such as when diff --git a/src/runtime/CapabilityDisabledError.php b/src/Runtime/CapabilityDisabledError.php similarity index 95% rename from src/runtime/CapabilityDisabledError.php rename to src/Runtime/CapabilityDisabledError.php index 86c8965d..d70a1157 100644 --- a/src/runtime/CapabilityDisabledError.php +++ b/src/Runtime/CapabilityDisabledError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy when API calls are temporarily disabled. diff --git a/src/runtime/CurlLite.php b/src/Runtime/CurlLite.php similarity index 98% rename from src/runtime/CurlLite.php rename to src/Runtime/CurlLite.php index c9353e1c..7d88ffd4 100644 --- a/src/runtime/CurlLite.php +++ b/src/Runtime/CurlLite.php @@ -27,14 +27,14 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; -use google\appengine\runtime\ApiProxy; -use google\appengine\runtime\ApplicationError; +use Google\Appengine\Runtime\ApiProxy; +use Google\Appengine\Runtime\ApplicationError; use google\appengine\URLFetchRequest\RequestMethod; use google\appengine\URLFetchServiceError\ErrorCode; -use google\appengine\util\ArrayUtil; -use google\appengine\util\HttpUtil; +use Google\Appengine\Util\ArrayUtil; +use Google\Appengine\Util\HttpUtil; final class CurlLite { // The list of requests protocols supported by this implementation. @@ -242,7 +242,7 @@ public function exec() { if (!$this->prepareRequest()) { return false; } - $this->response = new \google\appengine\URLFetchResponse(); + $this->response = new \Google\Appengine\URLFetchResponse(); try { ApiProxy::makeSyncCall('urlfetch', diff --git a/src/runtime/CurlLiteMethodNotSupportedException.php b/src/Runtime/CurlLiteMethodNotSupportedException.php similarity index 95% rename from src/runtime/CurlLiteMethodNotSupportedException.php rename to src/Runtime/CurlLiteMethodNotSupportedException.php index cb1c64f3..b392457b 100644 --- a/src/runtime/CurlLiteMethodNotSupportedException.php +++ b/src/Runtime/CurlLiteMethodNotSupportedException.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by the CurlLiteStub if a called method is not supported by the diff --git a/src/runtime/CurlLiteOptionNotSupportedException.php b/src/Runtime/CurlLiteOptionNotSupportedException.php similarity index 95% rename from src/runtime/CurlLiteOptionNotSupportedException.php rename to src/Runtime/CurlLiteOptionNotSupportedException.php index dd3d3a30..f6a5bd6a 100644 --- a/src/runtime/CurlLiteOptionNotSupportedException.php +++ b/src/Runtime/CurlLiteOptionNotSupportedException.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Called by the CurlLite implementation if an unsupported option is set. diff --git a/src/runtime/DeadlineExceededError.php b/src/Runtime/DeadlineExceededError.php similarity index 95% rename from src/runtime/DeadlineExceededError.php rename to src/Runtime/DeadlineExceededError.php index e16a9486..5acb311c 100644 --- a/src/runtime/DeadlineExceededError.php +++ b/src/Runtime/DeadlineExceededError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls if the call took too long to respond. diff --git a/src/runtime/DirectUploadHandler.php b/src/Runtime/DirectUploadHandler.php similarity index 98% rename from src/runtime/DirectUploadHandler.php rename to src/Runtime/DirectUploadHandler.php index 4fdffffb..cb001380 100644 --- a/src/runtime/DirectUploadHandler.php +++ b/src/Runtime/DirectUploadHandler.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use org\bovigo\vfs\vfsStream; diff --git a/src/runtime/Error.php b/src/Runtime/Error.php similarity index 94% rename from src/runtime/Error.php rename to src/Runtime/Error.php index 53b670c0..0319aeed 100644 --- a/src/runtime/Error.php +++ b/src/Runtime/Error.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Base APIProxy error type. diff --git a/src/runtime/FeatureNotEnabledError.php b/src/Runtime/FeatureNotEnabledError.php similarity index 95% rename from src/runtime/FeatureNotEnabledError.php rename to src/Runtime/FeatureNotEnabledError.php index 5b3c9a48..518dda76 100644 --- a/src/runtime/FeatureNotEnabledError.php +++ b/src/Runtime/FeatureNotEnabledError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy when the app must enable a feature to use this call. diff --git a/src/runtime/Mail.php b/src/Runtime/Mail.php similarity index 97% rename from src/runtime/Mail.php rename to src/Runtime/Mail.php index 6aa639de..8e44d186 100644 --- a/src/runtime/Mail.php +++ b/src/Runtime/Mail.php @@ -19,12 +19,12 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; -use google\appengine\api\app_identity\AppIdentityService; -use google\appengine\api\mail\Message; -use google\appengine\util\ArrayUtil; -use google\appengine\util\StringUtil; +use Google\Appengine\Api\AppIdentity\AppIdentityService; +use Google\Appengine\Api\Mail\Message; +use Google\Appengine\Util\ArrayUtil; +use Google\Appengine\Util\StringUtil; final class Mail { diff --git a/src/runtime/Memcache.php b/src/Runtime/Memcache.php similarity index 99% rename from src/runtime/Memcache.php rename to src/Runtime/Memcache.php index 1b3e27cc..9c6d1c13 100644 --- a/src/runtime/Memcache.php +++ b/src/Runtime/Memcache.php @@ -25,7 +25,7 @@ * no-ops. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -41,9 +41,9 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use google\appengine\runtime\ApiProxy; -use google\appengine\runtime\Error; -use google\appengine\runtime\MemcacheUtils; +use Google\Appengine\Runtime\ApiProxy; +use Google\Appengine\Runtime\Error; +use Google\Appengine\Runtime\MemcacheUtils; // Define constants for compatibility, but they will be ignored. const MEMCACHE_COMPRESSED = 2; diff --git a/src/runtime/MemcacheUtils.php b/src/Runtime/MemcacheUtils.php similarity index 98% rename from src/runtime/MemcacheUtils.php rename to src/Runtime/MemcacheUtils.php index 89a37f1a..22e7378a 100644 --- a/src/runtime/MemcacheUtils.php +++ b/src/Runtime/MemcacheUtils.php @@ -19,7 +19,7 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\MemcacheSetRequest; use google\appengine\MemcacheSetResponse; diff --git a/src/runtime/Memcached.php b/src/Runtime/Memcached.php similarity index 99% rename from src/runtime/Memcached.php rename to src/Runtime/Memcached.php index bc470e20..35f9e886 100644 --- a/src/runtime/Memcached.php +++ b/src/Runtime/Memcached.php @@ -23,7 +23,7 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -36,9 +36,9 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use google\appengine\runtime\ApiProxy; -use google\appengine\runtime\Error; -use google\appengine\runtime\MemcacheUtils; +use Google\Appengine\Runtime\ApiProxy; +use Google\Appengine\Runtime\Error; +use Google\Appengine\Runtime\MemcacheUtils; class Memcached { diff --git a/src/runtime/OverQuotaError.php b/src/Runtime/OverQuotaError.php similarity index 95% rename from src/runtime/OverQuotaError.php rename to src/Runtime/OverQuotaError.php index 614301b0..934adeb8 100644 --- a/src/runtime/OverQuotaError.php +++ b/src/Runtime/OverQuotaError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls when they have been blocked due to a lack of diff --git a/src/runtime/proto/Decoder.php b/src/Runtime/Proto/Decoder.php similarity index 99% rename from src/runtime/proto/Decoder.php rename to src/Runtime/Proto/Decoder.php index 6cdfd5a1..162c1f96 100644 --- a/src/runtime/proto/Decoder.php +++ b/src/Runtime/Proto/Decoder.php @@ -17,7 +17,7 @@ namespace google\net; if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/ProtocolBufferDecodeError.php'; + require_once 'src/Runtime/Proto/ProtocolBufferDecodeError.php'; } /** diff --git a/src/runtime/proto/Encoder.php b/src/Runtime/Proto/Encoder.php similarity index 97% rename from src/runtime/proto/Encoder.php rename to src/Runtime/Proto/Encoder.php index 925b4f67..c65f4746 100644 --- a/src/runtime/proto/Encoder.php +++ b/src/Runtime/Proto/Encoder.php @@ -17,8 +17,8 @@ namespace google\net; if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/Decoder.php'; - require_once 'src/runtime/proto/ProtocolBufferEncodeError.php'; + require_once 'src/Runtime/Proto/Decoder.php'; + require_once 'src/Runtime/Proto/ProtocolBufferEncodeError.php'; } /** * Class to encode protocol buffer into serialized form. Used by protocol diff --git a/src/runtime/proto/ProtocolBufferDecodeError.php b/src/Runtime/Proto/ProtocolBufferDecodeError.php similarity index 100% rename from src/runtime/proto/ProtocolBufferDecodeError.php rename to src/Runtime/Proto/ProtocolBufferDecodeError.php diff --git a/src/runtime/proto/ProtocolBufferEncodeError.php b/src/Runtime/Proto/ProtocolBufferEncodeError.php similarity index 100% rename from src/runtime/proto/ProtocolBufferEncodeError.php rename to src/Runtime/Proto/ProtocolBufferEncodeError.php diff --git a/src/runtime/proto/ProtocolMessage.php b/src/Runtime/Proto/ProtocolMessage.php similarity index 97% rename from src/runtime/proto/ProtocolMessage.php rename to src/Runtime/Proto/ProtocolMessage.php index 86dd31a4..26428ba2 100644 --- a/src/runtime/proto/ProtocolMessage.php +++ b/src/Runtime/Proto/ProtocolMessage.php @@ -20,10 +20,10 @@ namespace google\net; if (!defined('GOOGLE_APPENGINE_CLASSLOADER')) { - require_once 'src/runtime/proto/Decoder.php'; - require_once 'src/runtime/proto/Encoder.php'; - require_once 'src/runtime/proto/ProtocolBufferDecodeError.php'; - require_once 'src/runtime/proto/ProtocolBufferEncodeError.php'; + require_once 'src/Runtime/Proto/Decoder.php'; + require_once 'src/Runtime/Proto/Encoder.php'; + require_once 'src/Runtime/Proto/ProtocolBufferDecodeError.php'; + require_once 'src/Runtime/Proto/ProtocolBufferEncodeError.php'; } /** diff --git a/src/runtime/RPCFailedError.php b/src/Runtime/RPCFailedError.php similarity index 95% rename from src/runtime/RPCFailedError.php rename to src/Runtime/RPCFailedError.php index b83f7fd3..9fcbccbe 100644 --- a/src/runtime/RPCFailedError.php +++ b/src/Runtime/RPCFailedError.php @@ -17,7 +17,7 @@ /** */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls when the RPC to the application server diff --git a/src/runtime/RealApiProxy.php b/src/Runtime/RealApiProxy.php similarity index 98% rename from src/runtime/RealApiProxy.php rename to src/Runtime/RealApiProxy.php index 69bf81a1..5445c715 100644 --- a/src/runtime/RealApiProxy.php +++ b/src/Runtime/RealApiProxy.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; class RealApiProxy extends ApiProxyBase { // Specifying a value of -1.0 for the default deadline ensures that the diff --git a/src/runtime/RemoteApiProxy.php b/src/Runtime/RemoteApiProxy.php similarity index 94% rename from src/runtime/RemoteApiProxy.php rename to src/Runtime/RemoteApiProxy.php index d0f16130..a9f3ca44 100644 --- a/src/runtime/RemoteApiProxy.php +++ b/src/Runtime/RemoteApiProxy.php @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; -use google\appengine\ext\remote_api\Request; -use google\appengine\ext\remote_api\Response; -use google\appengine\runtime\RPCFailedError; +use Google\Appengine\Ext\RemoteApi\Request; +use Google\Appengine\Ext\RemoteApi\Response; +use Google\Appengine\Runtime\RPCFailedError; class RemoteApiProxy extends ApiProxyBase{ diff --git a/src/runtime/RequestTooLargeError.php b/src/Runtime/RequestTooLargeError.php similarity index 95% rename from src/runtime/RequestTooLargeError.php rename to src/Runtime/RequestTooLargeError.php index 95a568a8..9e963251 100644 --- a/src/runtime/RequestTooLargeError.php +++ b/src/Runtime/RequestTooLargeError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls if the request was too large. diff --git a/src/runtime/ResponseTooLargeError.php b/src/Runtime/ResponseTooLargeError.php similarity index 95% rename from src/runtime/ResponseTooLargeError.php rename to src/Runtime/ResponseTooLargeError.php index 11f7174b..ad9e13da 100644 --- a/src/runtime/ResponseTooLargeError.php +++ b/src/Runtime/ResponseTooLargeError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; /** * Thrown by APIProxy calls if the response was too large. diff --git a/src/runtime/Setup.php b/src/Runtime/Setup.php similarity index 98% rename from src/runtime/Setup.php rename to src/Runtime/Setup.php index 3145034f..d83a3def 100644 --- a/src/runtime/Setup.php +++ b/src/Runtime/Setup.php @@ -18,7 +18,7 @@ * Performs any required initialization before the user's script is run. */ -namespace google\appengine\runtime { +namespace Google\Appengine\Runtime { // Ensure that the class autoloader is the first include. // @codingStandardsIgnoreStart diff --git a/src/runtime/UnlinkUploads.php b/src/Runtime/UnlinkUploads.php similarity index 100% rename from src/runtime/UnlinkUploads.php rename to src/Runtime/UnlinkUploads.php diff --git a/src/runtime/VirtualFileSystem.php b/src/Runtime/VirtualFileSystem.php similarity index 100% rename from src/runtime/VirtualFileSystem.php rename to src/Runtime/VirtualFileSystem.php diff --git a/src/runtime/VmApiProxy.php b/src/Runtime/VmApiProxy.php similarity index 93% rename from src/runtime/VmApiProxy.php rename to src/Runtime/VmApiProxy.php index 43777721..11591159 100644 --- a/src/runtime/VmApiProxy.php +++ b/src/Runtime/VmApiProxy.php @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\ext\remote_api\Request; use google\appengine\ext\remote_api\Response; use google\appengine\ext\remote_api\RpcError\ErrorCode; -use google\appengine\runtime\RPCFailedError; +use Google\Appengine\Runtime\RPCFailedError; /** * An ApiProxy implementation that communicates with the VMRuntime Service @@ -46,43 +46,43 @@ class VmApiProxy extends ApiProxyBase{ // Map of Rpc Error Codes to the corresponging runtime exception. protected static $exceptionLookupTable = [ ErrorCode::UNKNOWN => [ - '\google\appengine\runtime\RPCFailedError', + '\Google\Appengine\Runtime\RPCFailedError', 'The remote RPC to the application server failed for the call %s.%s().', ], ErrorCode::CALL_NOT_FOUND => [ - '\google\appengine\runtime\CallNotFoundError', + '\Google\Appengine\Runtime\CallNotFoundError', "The API package '%s' or call '%s()' was not found.", ], ErrorCode::PARSE_ERROR => [ - '\google\appengine\runtime\ArgumentError', + '\Google\Appengine\Runtime\ArgumentError', 'There was an error parsing arguments for API call %s.%s().', ], ErrorCode::OVER_QUOTA => [ - '\google\appengine\runtime\OverQuotaError', + '\Google\Appengine\Runtime\OverQuotaError', 'The API call %s.%s() required more quota than is available.', ], ErrorCode::REQUEST_TOO_LARGE => [ - '\google\appengine\runtime\RequestTooLargeError', + '\Google\Appengine\Runtime\RequestTooLargeError', 'The request to API call %s.%s() was too large.', ], ErrorCode::CAPABILITY_DISABLED => [ - '\google\appengine\runtime\CapabilityDisabledError', + '\Google\Appengine\Runtime\CapabilityDisabledError', 'The API call %s.%s() is temporarily disabled.', ], ErrorCode::FEATURE_DISABLED => [ - '\google\appengine\runtime\FeatureNotEnabledError', + '\Google\Appengine\Runtime\FeatureNotEnabledError', 'The API call %s.%s() is currently not enabled.', ], ErrorCode::RESPONSE_TOO_LARGE => [ - '\google\appengine\runtime\ResponseTooLargeError', + '\Google\Appengine\Runtime\ResponseTooLargeError', 'The response from API call %s.%s() was too large.', ], ErrorCode::CANCELLED => [ - '\google\appengine\runtime\CancelledError', + '\Google\Appengine\Runtime\CancelledError', 'The API call %s.%s() was explicitly cancelled.', ], ErrorCode::DEADLINE_EXCEEDED => [ - '\google\appengine\runtime\DeadlineExceededError', + '\Google\Appengine\Runtime\DeadlineExceededError', 'The API call %s.%s() took too long to respond and was cancelled.', ], ]; diff --git a/src/testing/ApiCallArguments.php b/src/Testing/ApiCallArguments.php similarity index 97% rename from src/testing/ApiCallArguments.php rename to src/Testing/ApiCallArguments.php index 3423f906..1ab10d12 100644 --- a/src/testing/ApiCallArguments.php +++ b/src/Testing/ApiCallArguments.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\testing; +namespace Google\Appengine\Testing; class ApiCallArguments { public function __construct($package, $call_name, $req, $resp) { diff --git a/src/testing/ApiProxyMock.php b/src/Testing/ApiProxyMock.php similarity index 93% rename from src/testing/ApiProxyMock.php rename to src/Testing/ApiProxyMock.php index 908e9e12..a5b868f7 100644 --- a/src/testing/ApiProxyMock.php +++ b/src/Testing/ApiProxyMock.php @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\testing; +namespace Google\Appengine\Testing; -use google\appengine\runtime\ApiProxy; -use google\appengine\runtime\ApiProxyBase; +use Google\Appengine\Runtime\ApiProxy; +use Google\Appengine\Runtime\ApiProxyBase; class ApiProxyMock extends ApiProxyBase { public function init($testcase) { diff --git a/src/testing/ApiProxyTestBase.php b/src/Testing/ApiProxyTestBase.php similarity index 87% rename from src/testing/ApiProxyTestBase.php rename to src/Testing/ApiProxyTestBase.php index 507e2b6e..863feb1f 100644 --- a/src/testing/ApiProxyTestBase.php +++ b/src/Testing/ApiProxyTestBase.php @@ -14,9 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\testing; +namespace Google\Appengine\Testing; -class ApiProxyTestBase extends \PHPUnit\Framework\TestCase { +use \PHPUnit\Framework\TestCase; + +class ApiProxyTestBase extends TestCase { protected function setUp(): void { $this->apiProxyMock = new ApiProxyMock(); $this->apiProxyMock->init($this); diff --git a/src/testing/TestUtils.php b/src/Testing/TestUtils.php similarity index 99% rename from src/testing/TestUtils.php rename to src/Testing/TestUtils.php index ff243383..ae7d5264 100644 --- a/src/testing/TestUtils.php +++ b/src/Testing/TestUtils.php @@ -18,7 +18,7 @@ * Useful utility functions for SDK testing. */ -namespace google\appengine\testing; +namespace Google\Appengine\Testing; final class TestUtils { /** diff --git a/src/util/ArrayUtil.php b/src/Util/ArrayUtil.php similarity index 99% rename from src/util/ArrayUtil.php rename to src/Util/ArrayUtil.php index d21caafc..d204af11 100644 --- a/src/util/ArrayUtil.php +++ b/src/Util/ArrayUtil.php @@ -18,7 +18,7 @@ * Various utilities for working with PHP arrays. * */ -namespace google\appengine\util; +namespace Google\Appengine\Util; /** * Various PHP array related utility functions. diff --git a/src/util/HttpUtil.php b/src/Util/HttpUtil.php similarity index 98% rename from src/util/HttpUtil.php rename to src/Util/HttpUtil.php index 3d9f6d86..a5043b0a 100644 --- a/src/util/HttpUtil.php +++ b/src/Util/HttpUtil.php @@ -18,7 +18,7 @@ * Various HTTP utility functions. * */ -namespace google\appengine\util; +namespace Google\Appengine\Util; /** * HTTP related Utilities. diff --git a/src/util/StringUtil.php b/src/Util/StringUtil.php similarity index 98% rename from src/util/StringUtil.php rename to src/Util/StringUtil.php index 10b8f891..c3b7bfd5 100644 --- a/src/util/StringUtil.php +++ b/src/Util/StringUtil.php @@ -18,7 +18,7 @@ * Various utilities for working with Strings. * */ -namespace google\appengine\util; +namespace Google\Appengine\Util; /** * Various PHP string related utility functions. diff --git a/tests/api/app_identity/AppIdentityServiceTest.php b/tests/Api/AppIdentity/AppIdentityServiceTest.php similarity index 96% rename from tests/api/app_identity/AppIdentityServiceTest.php rename to tests/Api/AppIdentity/AppIdentityServiceTest.php index 86b61769..fc3d54f6 100644 --- a/tests/api/app_identity/AppIdentityServiceTest.php +++ b/tests/Api/AppIdentity/AppIdentityServiceTest.php @@ -18,11 +18,11 @@ * PHP Unit tests for the AppIdentityService. * */ -namespace google\appengine\api\app_identity; +namespace Google\Appengine\Api\AppIdentity; use google\appengine\AppIdentityServiceError\ErrorCode; -use google\appengine\api\app_identity\AppIdentityService; -use google\appengine\testing\ApiProxyTestBase; +use Google\Appengine\Api\AppIdentity\AppIdentityService; +use Google\Appengine\Testing\ApiProxyTestBase; /** * Mock functions for APC cache functions. @@ -162,7 +162,7 @@ private function expectGetAccessTokenRequest($scopes, $cached, 'expiration_time' => 12345, ])); $item->setFlags( - \google\appengine\runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); + \Google\Appengine\Runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); } $this->apiProxyMock->expectCall('memcache', @@ -205,7 +205,7 @@ private function expectGetAccessTokenRequest($scopes, $cached, AppIdentityService::EXPIRY_SAFETY_MARGIN_SECS - AppIdentityService::EXPIRY_SHORT_MARGIN_SECS); $item->setFlags( - \google\appengine\runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); + \Google\Appengine\Runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); $item->setSetPolicy(1); // Add $resp = new \google\appengine\MemcacheSetResponse(); $resp->addSetStatus(1); // Stored @@ -339,7 +339,7 @@ public function testGetAccessTokenServiceInvalidScope() { $scope = 'mail.google.com/invalid-scope'; $req->addScope($scope); - $exception = new \google\appengine\runtime\ApplicationError( + $exception = new \Google\Appengine\Runtime\ApplicationError( ErrorCode::UNKNOWN_SCOPE, "unknown scope"); $this->expectException('\InvalidArgumentException', @@ -401,11 +401,11 @@ private function executeServiceErrorTest($error, $expected_response) { $scope = 'mail.google.com/invalid-scope'; $req->addScope($scope); - $exception = new \google\appengine\runtime\ApplicationError( + $exception = new \Google\Appengine\Runtime\ApplicationError( $error, "not initialized"); $this->expectException( - '\google\appengine\api\app_identity\AppIdentityException', + '\Google\Appengine\Api\AppIdentity\AppIdentityException', $expected_response); self::expectGetAccessTokenRequest(array($scope), false, $exception); diff --git a/tests/datastore/DatastoreProtoTest.php b/tests/Datastore/DatastoreProtoTest.php similarity index 100% rename from tests/datastore/DatastoreProtoTest.php rename to tests/Datastore/DatastoreProtoTest.php diff --git a/tests/datastore/DatastoreV4ProtoTest.php b/tests/Datastore/DatastoreV4ProtoTest.php similarity index 100% rename from tests/datastore/DatastoreV4ProtoTest.php rename to tests/Datastore/DatastoreV4ProtoTest.php diff --git a/tests/ext/remote_api/RemoteApiProtoTest.php b/tests/Ext/RemoteApi/RemoteApiProtoTest.php similarity index 100% rename from tests/ext/remote_api/RemoteApiProtoTest.php rename to tests/Ext/RemoteApi/RemoteApiProtoTest.php diff --git a/tests/runtime/ApiProxyTest.php b/tests/Runtime/ApiProxyTest.php similarity index 96% rename from tests/runtime/ApiProxyTest.php rename to tests/Runtime/ApiProxyTest.php index b7e2aca6..74b535e1 100644 --- a/tests/runtime/ApiProxyTest.php +++ b/tests/Runtime/ApiProxyTest.php @@ -17,11 +17,11 @@ /** */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\base\VoidProto; -use google\appengine\runtime\ApiProxyBase; -use google\appengine\runtime\RealApiProxy; +use Google\Appengine\Runtime\ApiProxyBase; +use Google\Appengine\Runtime\RealApiProxy; use \PHPUnit\Framework\TestCase; /** diff --git a/tests/runtime/CurlLiteStub.php b/tests/Runtime/CurlLiteStub.php similarity index 99% rename from tests/runtime/CurlLiteStub.php rename to tests/Runtime/CurlLiteStub.php index 0b257bdb..b8b51c29 100644 --- a/tests/runtime/CurlLiteStub.php +++ b/tests/Runtime/CurlLiteStub.php @@ -20,7 +20,7 @@ */ // Constant Definitions -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; if (!defined('CURLAUTH_ANYSAFE')) { define('CURLAUTH_ANYSAFE', -18); @@ -1294,8 +1294,8 @@ // Function Definitions -use google\appengine\runtime\CurlLite; -use google\appengine\runtime\CurlLiteMethodNotSupportedException; +use Google\Appengine\Runtime\CurlLite; +use Roogle\Appengine\Runtime\CurlLiteMethodNotSupportedException; if (!function_exists('curl_init')) { function curl_init($url = null) { diff --git a/tests/runtime/CurlLiteTest.php b/tests/Runtime/CurlLiteTest.php similarity index 98% rename from tests/runtime/CurlLiteTest.php rename to tests/Runtime/CurlLiteTest.php index 84e71557..6589bcae 100644 --- a/tests/runtime/CurlLiteTest.php +++ b/tests/Runtime/CurlLiteTest.php @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; -use google\appengine\testing\ApiProxyTestBase; -use google\appengine\testing\TestUtils; +use Google\Appengine\Testing\ApiProxyTestBase; +use Google\Appengine\Testing\TestUtils; use google\appengine\URLFetchRequest\RequestMethod; use google\appengine\URLFetchServiceError\ErrorCode; -use google\appengine\runtime\ApplicationError; -use google\appengine\runtime\CurlLiteStub; +use Google\Appengine\Runtime\ApplicationError; +use Google\Appengine\Runtime\CurlLiteStub; // This file is included in Setup.php if google_app_engine.enable_curl_lite is // set in php.ini. Include it here unconditionally for the sake of testing @@ -34,7 +34,7 @@ class CurlLiteTest extends ApiProxyTestBase { public function setUp(): void { parent::setUp(); - TestUtils::setStaticProperty('google\appengine\runtime\CurlLite', + TestUtils::setStaticProperty('Google\Appengine\Runtime\CurlLite', 'logging_callback', [$this, 'mockLog']); } diff --git a/tests/runtime/DirectUploadHandlerTest.php b/tests/Runtime/DirectUploadHandlerTest.php similarity index 99% rename from tests/runtime/DirectUploadHandlerTest.php rename to tests/Runtime/DirectUploadHandlerTest.php index 825ab655..b2747b47 100644 --- a/tests/runtime/DirectUploadHandlerTest.php +++ b/tests/Runtime/DirectUploadHandlerTest.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use \PHPUnit\Framework\TestCase; diff --git a/tests/runtime/MailTest.php b/tests/Runtime/MailTest.php similarity index 99% rename from tests/runtime/MailTest.php rename to tests/Runtime/MailTest.php index b4011505..8efd3f9d 100644 --- a/tests/runtime/MailTest.php +++ b/tests/Runtime/MailTest.php @@ -19,12 +19,12 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\base\VoidProto; use google\appengine\MailMessage; -use google\appengine\runtime\Mail; -use google\appengine\testing\ApiProxyTestBase; +use Google\Appengine\Runtime\Mail; +use Google\Appengine\Testing\ApiProxyTestBase; /** * @requires extension mailparse diff --git a/tests/runtime/MemcacheTest.php b/tests/Runtime/MemcacheTest.php similarity index 99% rename from tests/runtime/MemcacheTest.php rename to tests/Runtime/MemcacheTest.php index a6495272..bf5bee1a 100644 --- a/tests/runtime/MemcacheTest.php +++ b/tests/Runtime/MemcacheTest.php @@ -19,7 +19,7 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -34,7 +34,7 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use google\appengine\testing\ApiProxyTestBase; +use Google\Appengine\Testing\ApiProxyTestBase; class MemcacheTest extends ApiProxyTestBase { diff --git a/tests/runtime/MemcachedTest.php b/tests/Runtime/MemcachedTest.php similarity index 99% rename from tests/runtime/MemcachedTest.php rename to tests/Runtime/MemcachedTest.php index bee8b42f..e248a6d7 100644 --- a/tests/runtime/MemcachedTest.php +++ b/tests/Runtime/MemcachedTest.php @@ -19,7 +19,7 @@ * */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -34,7 +34,7 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use google\appengine\testing\ApiProxyTestBase; +use Google\Appengine\Testing\ApiProxyTestBase; class MemcachedTest extends ApiProxyTestBase { diff --git a/tests/runtime/UnlinkUploadsTest.php b/tests/Runtime/UnlinkUploadsTest.php similarity index 99% rename from tests/runtime/UnlinkUploadsTest.php rename to tests/Runtime/UnlinkUploadsTest.php index 9d31ab51..381a0b6e 100644 --- a/tests/runtime/UnlinkUploadsTest.php +++ b/tests/Runtime/UnlinkUploadsTest.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use org\bovigo\vfs\vfsStream; use \PHPUnit\Framework\TestCase; diff --git a/tests/runtime/VmApiProxyTest.php b/tests/Runtime/VmApiProxyTest.php similarity index 97% rename from tests/runtime/VmApiProxyTest.php rename to tests/Runtime/VmApiProxyTest.php index a666ee57..133bb053 100644 --- a/tests/runtime/VmApiProxyTest.php +++ b/tests/Runtime/VmApiProxyTest.php @@ -18,15 +18,15 @@ // File defines two classes and the funtion names are not CamelCase as they are // following the streamWrapper interface. -namespace google\appengine\runtime; +namespace Google\Appengine\Runtime; use google\appengine\ext\remote_api\Request; use google\appengine\ext\remote_api\Response; use google\appengine\ext\remote_api\RpcError\ErrorCode; use google\appengine\SignForAppRequest; use google\appengine\SignForAppResponse; -use google\appengine\runtime\ApiProxy; -use google\appengine\runtime\ApplicationError; +use Google\Appengine\Runtime\ApiProxy; +use Google\Appengine\Runtime\ApplicationError; use \PHPUnit\Framework\TestCase; @@ -266,7 +266,7 @@ public function testRpcException($error_code, $exception) { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('google\appengine\runtime\\' . $exception); + $this->expectException('Google\Appengine\Runtime\\' . $exception); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, @@ -305,7 +305,7 @@ public function testApplicationError() { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('google\appengine\runtime\ApplicationError'); + $this->expectException('Google\Appengine\Runtime\ApplicationError'); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, @@ -323,7 +323,7 @@ public function testGenericExceptionError() { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('google\appengine\runtime\RPCFailedError'); + $this->expectException('Google\Appengine\Runtime\RPCFailedError'); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, @@ -363,7 +363,7 @@ public function testFailedHttpConnection() { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('google\appengine\runtime\RPCFailedError'); + $this->expectException('Google\Appengine\Runtime\RPCFailedError'); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, diff --git a/tests/util/ArrayUtilTest.php b/tests/Util/ArrayUtilTest.php similarity index 92% rename from tests/util/ArrayUtilTest.php rename to tests/Util/ArrayUtilTest.php index 881bd5a4..f841eea9 100644 --- a/tests/util/ArrayUtilTest.php +++ b/tests/Util/ArrayUtilTest.php @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\util; +namespace Google\Appengine\Util; -use google\appengine\util\ArrayUtil; +use Google\Appengine\Util\ArrayUtil; use \PHPUnit\Framework\TestCase; class ArrayUtilTest extends TestCase { - private $merge_fn = "google\appengine\util\ArrayUtil::arrayMergeIgnoreCase"; + private $merge_fn = "Google\Appengine\Util\ArrayUtil::arrayMergeIgnoreCase"; /** * @dataProvider arrayMergeDataProvider */ From 33558544a47e5ac9d83b7041ea2acb5617c9bb05 Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Thu, 29 Apr 2021 15:59:37 -0700 Subject: [PATCH 02/10] update review changes --- composer.json | 2 +- src/Api/AppIdentity/AppIdentityException.php | 2 +- src/Api/AppIdentity/AppIdentityService.php | 8 +++---- src/Api/AppIdentity/PublicCertificate.php | 2 +- src/Runtime/ApiProxy.php | 2 +- src/Runtime/ApiProxyBase.php | 20 ++++++++-------- src/Runtime/ApplicationError.php | 2 +- src/Runtime/ArgumentError.php | 2 +- src/Runtime/CallNotFoundError.php | 2 +- src/Runtime/CancelledError.php | 2 +- src/Runtime/CapabilityDisabledError.php | 2 +- src/Runtime/CurlLite.php | 12 +++++----- .../CurlLiteMethodNotSupportedException.php | 2 +- .../CurlLiteOptionNotSupportedException.php | 2 +- src/Runtime/DeadlineExceededError.php | 2 +- src/Runtime/DirectUploadHandler.php | 2 +- src/Runtime/Error.php | 2 +- src/Runtime/FeatureNotEnabledError.php | 2 +- src/Runtime/Mail.php | 10 ++++---- src/Runtime/Memcache.php | 8 +++---- src/Runtime/MemcacheUtils.php | 2 +- src/Runtime/Memcached.php | 8 +++---- src/Runtime/OverQuotaError.php | 2 +- src/Runtime/RPCFailedError.php | 2 +- src/Runtime/RealApiProxy.php | 2 +- src/Runtime/RemoteApiProxy.php | 2 +- src/Runtime/RequestTooLargeError.php | 2 +- src/Runtime/ResponseTooLargeError.php | 2 +- src/Runtime/UnlinkUploads.php | 2 +- src/Runtime/VirtualFileSystem.php | 2 +- src/Runtime/VmApiProxy.php | 24 +++++++++---------- src/Testing/ApiCallArguments.php | 2 +- src/Testing/ApiProxyMock.php | 6 ++--- src/Testing/ApiProxyTestBase.php | 2 +- src/Testing/TestUtils.php | 2 +- src/Util/ArrayUtil.php | 2 +- src/Util/HttpUtil.php | 2 +- src/Util/StringUtil.php | 2 +- .../AppIdentity/AppIdentityServiceTest.php | 14 +++++------ tests/Runtime/ApiProxyTest.php | 6 ++--- tests/Runtime/CurlLiteStub.php | 2 +- tests/Runtime/CurlLiteTest.php | 12 +++++----- tests/Runtime/DirectUploadHandlerTest.php | 2 +- tests/Runtime/MailTest.php | 6 ++--- tests/Runtime/MemcacheTest.php | 4 ++-- tests/Runtime/MemcachedTest.php | 4 ++-- tests/Runtime/UnlinkUploadsTest.php | 2 +- tests/Runtime/VmApiProxyTest.php | 14 +++++------ tests/Util/ArrayUtilTest.php | 6 ++--- 49 files changed, 114 insertions(+), 114 deletions(-) diff --git a/composer.json b/composer.json index 629a6b8f..5d704af8 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ }, "autoload": { "psr-4": { - "Google\\Appengine\\": "src" + "Google\\AppEngine\\": "src" }, "classmap": [ "src/Api/api_base_pb.php", diff --git a/src/Api/AppIdentity/AppIdentityException.php b/src/Api/AppIdentity/AppIdentityException.php index 49b45245..22e3e8d2 100644 --- a/src/Api/AppIdentity/AppIdentityException.php +++ b/src/Api/AppIdentity/AppIdentityException.php @@ -17,7 +17,7 @@ /** */ -namespace Google\Appengine\Api\AppIdentity; +namespace Google\AppEngine\Api\AppIdentity; /** * Thrown when there is a general failure using the AppIdentityService. diff --git a/src/Api/AppIdentity/AppIdentityService.php b/src/Api/AppIdentity/AppIdentityService.php index 9e99ca10..982b6f75 100644 --- a/src/Api/AppIdentity/AppIdentityService.php +++ b/src/Api/AppIdentity/AppIdentityService.php @@ -18,7 +18,7 @@ */ -namespace Google\Appengine\Api\AppIdentity; +namespace Google\AppEngine\Api\AppIdentity; use google\appengine\AppIdentityServiceError\ErrorCode; use google\appengine\GetAccessTokenRequest; @@ -29,9 +29,9 @@ use google\appengine\GetServiceAccountNameResponse; use google\appengine\SignForAppRequest; use google\appengine\SignForAppResponse; -use Google\Appengine\Runtime\ApiProxy; -use Google\Appengine\Runtime\ApplicationError; -use Google\Appengine\Runtime\Memcache; +use Google\AppEngine\Runtime\ApiProxy; +use Google\AppEngine\Runtime\ApplicationError; +use Google\AppEngine\Runtime\Memcache; /** * The AppIdentityService allows you to sign arbitrary byte diff --git a/src/Api/AppIdentity/PublicCertificate.php b/src/Api/AppIdentity/PublicCertificate.php index cc37ae56..91585292 100644 --- a/src/Api/AppIdentity/PublicCertificate.php +++ b/src/Api/AppIdentity/PublicCertificate.php @@ -17,7 +17,7 @@ /** */ -namespace Google\Appengine\Api\AppIdentity; +namespace Google\AppEngine\Api\AppIdentity; /** * PublicCertificate contains an X509 public certificate in PEM format and a diff --git a/src/Runtime/ApiProxy.php b/src/Runtime/ApiProxy.php index a4e5a1eb..3a062be5 100644 --- a/src/Runtime/ApiProxy.php +++ b/src/Runtime/ApiProxy.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; class ApiProxy { private static $apiProxy = null; diff --git a/src/Runtime/ApiProxyBase.php b/src/Runtime/ApiProxyBase.php index 87c23179..bd9d1b8b 100644 --- a/src/Runtime/ApiProxyBase.php +++ b/src/Runtime/ApiProxyBase.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; abstract class ApiProxyBase { const OK = 0; @@ -33,32 +33,32 @@ abstract class ApiProxyBase { protected static $exceptionLookupTable = array( self::RPC_FAILED => array( - '\Google\Appengine\Runtime\RPCFailedError', + '\Google\AppEngine\Runtime\RPCFailedError', 'The remote RPC to the application server failed for the call %s.%s().'), self::CALL_NOT_FOUND => array( - '\Google\Appengine\Runtime\CallNotFoundError', + '\Google\AppEngine\Runtime\CallNotFoundError', "The API package '%s' or call '%s()' was not found."), self::ARGUMENT_ERROR => array( - '\Google\Appengine\Runtime\ArgumentError', + '\Google\AppEngine\Runtime\ArgumentError', 'An error occurred parsing (locally or remotely) the arguments to %s.%s().' ), self::DEADLINE_EXCEEDED => array( - '\Google\Appengine\Runtime\DeadlineExceededError', + '\Google\AppEngine\Runtime\DeadlineExceededError', 'The API call %s.%s() took too long to respond and was cancelled.'), self::CANCELLED => array( - '\Google\Appengine\Runtime\CancelledError', + '\Google\AppEngine\Runtime\CancelledError', 'The API call %s.%s() was explicitly cancelled.'), self::OTHER_ERROR => array( - '\Google\Appengine\Runtime\Error', + '\Google\AppEngine\Runtime\Error', 'An error occurred for the API request %s.%s().'), self::OVER_QUOTA => array( - '\Google\Appengine\Runtime\OverQuotaError', + '\Google\AppEngine\Runtime\OverQuotaError', 'The API call %s.%s() required more quota than is available.'), self::REQUEST_TOO_LARGE => array( - '\Google\Appengine\Runtime\RequestTooLargeError', + '\Google\AppEngine\Runtime\RequestTooLargeError', 'The request to API call %s.%s() was too large.'), self::RESPONSE_TOO_LARGE => array( - '\Google\Appengine\Runtime\ResponseTooLargeError', + '\Google\AppEngine\Runtime\ResponseTooLargeError', 'The response from API call %s.%s() was too large.'), # APPLICATION_ERROR is special-cased to create an ApplicationError diff --git a/src/Runtime/ApplicationError.php b/src/Runtime/ApplicationError.php index 256ad6e9..45cf3187 100644 --- a/src/Runtime/ApplicationError.php +++ b/src/Runtime/ApplicationError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy in the event of an application-level error. diff --git a/src/Runtime/ArgumentError.php b/src/Runtime/ArgumentError.php index 4d3195ad..aba0662d 100644 --- a/src/Runtime/ArgumentError.php +++ b/src/Runtime/ArgumentError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls if there is an error parsing the arguments. diff --git a/src/Runtime/CallNotFoundError.php b/src/Runtime/CallNotFoundError.php index 1636b589..496875a8 100644 --- a/src/Runtime/CallNotFoundError.php +++ b/src/Runtime/CallNotFoundError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls when the requested method cannot be found. diff --git a/src/Runtime/CancelledError.php b/src/Runtime/CancelledError.php index 675dd949..83c496cc 100644 --- a/src/Runtime/CancelledError.php +++ b/src/Runtime/CancelledError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls if the call was cancelled, such as when diff --git a/src/Runtime/CapabilityDisabledError.php b/src/Runtime/CapabilityDisabledError.php index d70a1157..921506f8 100644 --- a/src/Runtime/CapabilityDisabledError.php +++ b/src/Runtime/CapabilityDisabledError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy when API calls are temporarily disabled. diff --git a/src/Runtime/CurlLite.php b/src/Runtime/CurlLite.php index 7d88ffd4..b7b6cc16 100644 --- a/src/Runtime/CurlLite.php +++ b/src/Runtime/CurlLite.php @@ -27,14 +27,14 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; -use Google\Appengine\Runtime\ApiProxy; -use Google\Appengine\Runtime\ApplicationError; +use Google\AppEngine\Runtime\ApiProxy; +use Google\AppEngine\Runtime\ApplicationError; use google\appengine\URLFetchRequest\RequestMethod; use google\appengine\URLFetchServiceError\ErrorCode; -use Google\Appengine\Util\ArrayUtil; -use Google\Appengine\Util\HttpUtil; +use Google\AppEngine\Util\ArrayUtil; +use Google\AppEngine\Util\HttpUtil; final class CurlLite { // The list of requests protocols supported by this implementation. @@ -242,7 +242,7 @@ public function exec() { if (!$this->prepareRequest()) { return false; } - $this->response = new \Google\Appengine\URLFetchResponse(); + $this->response = new \google\appengine\URLFetchResponse(); try { ApiProxy::makeSyncCall('urlfetch', diff --git a/src/Runtime/CurlLiteMethodNotSupportedException.php b/src/Runtime/CurlLiteMethodNotSupportedException.php index b392457b..ece8e819 100644 --- a/src/Runtime/CurlLiteMethodNotSupportedException.php +++ b/src/Runtime/CurlLiteMethodNotSupportedException.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by the CurlLiteStub if a called method is not supported by the diff --git a/src/Runtime/CurlLiteOptionNotSupportedException.php b/src/Runtime/CurlLiteOptionNotSupportedException.php index f6a5bd6a..056a912e 100644 --- a/src/Runtime/CurlLiteOptionNotSupportedException.php +++ b/src/Runtime/CurlLiteOptionNotSupportedException.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Called by the CurlLite implementation if an unsupported option is set. diff --git a/src/Runtime/DeadlineExceededError.php b/src/Runtime/DeadlineExceededError.php index 5acb311c..db46d991 100644 --- a/src/Runtime/DeadlineExceededError.php +++ b/src/Runtime/DeadlineExceededError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls if the call took too long to respond. diff --git a/src/Runtime/DirectUploadHandler.php b/src/Runtime/DirectUploadHandler.php index cb001380..a8d07030 100644 --- a/src/Runtime/DirectUploadHandler.php +++ b/src/Runtime/DirectUploadHandler.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use org\bovigo\vfs\vfsStream; diff --git a/src/Runtime/Error.php b/src/Runtime/Error.php index 0319aeed..f139820d 100644 --- a/src/Runtime/Error.php +++ b/src/Runtime/Error.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Base APIProxy error type. diff --git a/src/Runtime/FeatureNotEnabledError.php b/src/Runtime/FeatureNotEnabledError.php index 518dda76..5ec1fdd6 100644 --- a/src/Runtime/FeatureNotEnabledError.php +++ b/src/Runtime/FeatureNotEnabledError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy when the app must enable a feature to use this call. diff --git a/src/Runtime/Mail.php b/src/Runtime/Mail.php index 8e44d186..cc444606 100644 --- a/src/Runtime/Mail.php +++ b/src/Runtime/Mail.php @@ -19,12 +19,12 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; -use Google\Appengine\Api\AppIdentity\AppIdentityService; -use Google\Appengine\Api\Mail\Message; -use Google\Appengine\Util\ArrayUtil; -use Google\Appengine\Util\StringUtil; +use Google\AppEngine\Api\AppIdentity\AppIdentityService; +use Google\AppEngine\Api\Mail\Message; +use Google\AppEngine\Util\ArrayUtil; +use Google\AppEngine\Util\StringUtil; final class Mail { diff --git a/src/Runtime/Memcache.php b/src/Runtime/Memcache.php index 9c6d1c13..87dcd0d0 100644 --- a/src/Runtime/Memcache.php +++ b/src/Runtime/Memcache.php @@ -25,7 +25,7 @@ * no-ops. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -41,9 +41,9 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use Google\Appengine\Runtime\ApiProxy; -use Google\Appengine\Runtime\Error; -use Google\Appengine\Runtime\MemcacheUtils; +use Google\AppEngine\Runtime\ApiProxy; +use Google\AppEngine\Runtime\Error; +use Google\AppEngine\Runtime\MemcacheUtils; // Define constants for compatibility, but they will be ignored. const MEMCACHE_COMPRESSED = 2; diff --git a/src/Runtime/MemcacheUtils.php b/src/Runtime/MemcacheUtils.php index 22e7378a..7bbac7d7 100644 --- a/src/Runtime/MemcacheUtils.php +++ b/src/Runtime/MemcacheUtils.php @@ -19,7 +19,7 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\MemcacheSetRequest; use google\appengine\MemcacheSetResponse; diff --git a/src/Runtime/Memcached.php b/src/Runtime/Memcached.php index 35f9e886..0e0d9844 100644 --- a/src/Runtime/Memcached.php +++ b/src/Runtime/Memcached.php @@ -23,7 +23,7 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -36,9 +36,9 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use Google\Appengine\Runtime\ApiProxy; -use Google\Appengine\Runtime\Error; -use Google\Appengine\Runtime\MemcacheUtils; +use Google\AppEngine\Runtime\ApiProxy; +use Google\AppEngine\Runtime\Error; +use Google\AppEngine\Runtime\MemcacheUtils; class Memcached { diff --git a/src/Runtime/OverQuotaError.php b/src/Runtime/OverQuotaError.php index 934adeb8..dbf49522 100644 --- a/src/Runtime/OverQuotaError.php +++ b/src/Runtime/OverQuotaError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls when they have been blocked due to a lack of diff --git a/src/Runtime/RPCFailedError.php b/src/Runtime/RPCFailedError.php index 9fcbccbe..61a1ac1d 100644 --- a/src/Runtime/RPCFailedError.php +++ b/src/Runtime/RPCFailedError.php @@ -17,7 +17,7 @@ /** */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls when the RPC to the application server diff --git a/src/Runtime/RealApiProxy.php b/src/Runtime/RealApiProxy.php index 5445c715..3ad3b314 100644 --- a/src/Runtime/RealApiProxy.php +++ b/src/Runtime/RealApiProxy.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; class RealApiProxy extends ApiProxyBase { // Specifying a value of -1.0 for the default deadline ensures that the diff --git a/src/Runtime/RemoteApiProxy.php b/src/Runtime/RemoteApiProxy.php index a9f3ca44..3a353ebd 100644 --- a/src/Runtime/RemoteApiProxy.php +++ b/src/Runtime/RemoteApiProxy.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use Google\Appengine\Ext\RemoteApi\Request; use Google\Appengine\Ext\RemoteApi\Response; diff --git a/src/Runtime/RequestTooLargeError.php b/src/Runtime/RequestTooLargeError.php index 9e963251..2d2db2a3 100644 --- a/src/Runtime/RequestTooLargeError.php +++ b/src/Runtime/RequestTooLargeError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls if the request was too large. diff --git a/src/Runtime/ResponseTooLargeError.php b/src/Runtime/ResponseTooLargeError.php index ad9e13da..913da92a 100644 --- a/src/Runtime/ResponseTooLargeError.php +++ b/src/Runtime/ResponseTooLargeError.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; /** * Thrown by APIProxy calls if the response was too large. diff --git a/src/Runtime/UnlinkUploads.php b/src/Runtime/UnlinkUploads.php index 4f63edbb..1536c738 100644 --- a/src/Runtime/UnlinkUploads.php +++ b/src/Runtime/UnlinkUploads.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace google\appengine\runtime; +namespace Google\AppEngine\Runtime; /** * Handles removing (unlink()) uploaded files that are left at tmp_name. diff --git a/src/Runtime/VirtualFileSystem.php b/src/Runtime/VirtualFileSystem.php index c4c97226..9a2c6b40 100644 --- a/src/Runtime/VirtualFileSystem.php +++ b/src/Runtime/VirtualFileSystem.php @@ -19,7 +19,7 @@ * underlying vfs stream. */ -namespace google\appengine\runtime; +namespace Google\AppEngine\Runtime; use org\bovigo\vfs\vfsStream; diff --git a/src/Runtime/VmApiProxy.php b/src/Runtime/VmApiProxy.php index 11591159..480dc59d 100644 --- a/src/Runtime/VmApiProxy.php +++ b/src/Runtime/VmApiProxy.php @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\ext\remote_api\Request; use google\appengine\ext\remote_api\Response; use google\appengine\ext\remote_api\RpcError\ErrorCode; -use Google\Appengine\Runtime\RPCFailedError; +use Google\AppEngine\Runtime\RPCFailedError; /** * An ApiProxy implementation that communicates with the VMRuntime Service @@ -46,43 +46,43 @@ class VmApiProxy extends ApiProxyBase{ // Map of Rpc Error Codes to the corresponging runtime exception. protected static $exceptionLookupTable = [ ErrorCode::UNKNOWN => [ - '\Google\Appengine\Runtime\RPCFailedError', + '\Google\AppEngine\Runtime\RPCFailedError', 'The remote RPC to the application server failed for the call %s.%s().', ], ErrorCode::CALL_NOT_FOUND => [ - '\Google\Appengine\Runtime\CallNotFoundError', + '\Google\AppEngine\Runtime\CallNotFoundError', "The API package '%s' or call '%s()' was not found.", ], ErrorCode::PARSE_ERROR => [ - '\Google\Appengine\Runtime\ArgumentError', + '\Google\AppEngine\Runtime\ArgumentError', 'There was an error parsing arguments for API call %s.%s().', ], ErrorCode::OVER_QUOTA => [ - '\Google\Appengine\Runtime\OverQuotaError', + '\Google\AppEngine\Runtime\OverQuotaError', 'The API call %s.%s() required more quota than is available.', ], ErrorCode::REQUEST_TOO_LARGE => [ - '\Google\Appengine\Runtime\RequestTooLargeError', + '\Google\AppEngine\Runtime\RequestTooLargeError', 'The request to API call %s.%s() was too large.', ], ErrorCode::CAPABILITY_DISABLED => [ - '\Google\Appengine\Runtime\CapabilityDisabledError', + '\Google\AppEngine\Runtime\CapabilityDisabledError', 'The API call %s.%s() is temporarily disabled.', ], ErrorCode::FEATURE_DISABLED => [ - '\Google\Appengine\Runtime\FeatureNotEnabledError', + '\Google\AppEngine\Runtime\FeatureNotEnabledError', 'The API call %s.%s() is currently not enabled.', ], ErrorCode::RESPONSE_TOO_LARGE => [ - '\Google\Appengine\Runtime\ResponseTooLargeError', + '\Google\AppEngine\Runtime\ResponseTooLargeError', 'The response from API call %s.%s() was too large.', ], ErrorCode::CANCELLED => [ - '\Google\Appengine\Runtime\CancelledError', + '\Google\AppEngine\Runtime\CancelledError', 'The API call %s.%s() was explicitly cancelled.', ], ErrorCode::DEADLINE_EXCEEDED => [ - '\Google\Appengine\Runtime\DeadlineExceededError', + '\Google\AppEngine\Runtime\DeadlineExceededError', 'The API call %s.%s() took too long to respond and was cancelled.', ], ]; diff --git a/src/Testing/ApiCallArguments.php b/src/Testing/ApiCallArguments.php index 1ab10d12..11a990f3 100644 --- a/src/Testing/ApiCallArguments.php +++ b/src/Testing/ApiCallArguments.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Testing; +namespace Google\AppEngine\Testing; class ApiCallArguments { public function __construct($package, $call_name, $req, $resp) { diff --git a/src/Testing/ApiProxyMock.php b/src/Testing/ApiProxyMock.php index a5b868f7..b2b50e01 100644 --- a/src/Testing/ApiProxyMock.php +++ b/src/Testing/ApiProxyMock.php @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Testing; +namespace Google\AppEngine\Testing; -use Google\Appengine\Runtime\ApiProxy; -use Google\Appengine\Runtime\ApiProxyBase; +use Google\AppEngine\Runtime\ApiProxy; +use Google\AppEngine\Runtime\ApiProxyBase; class ApiProxyMock extends ApiProxyBase { public function init($testcase) { diff --git a/src/Testing/ApiProxyTestBase.php b/src/Testing/ApiProxyTestBase.php index 863feb1f..efdd1c1b 100644 --- a/src/Testing/ApiProxyTestBase.php +++ b/src/Testing/ApiProxyTestBase.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Testing; +namespace Google\AppEngine\Testing; use \PHPUnit\Framework\TestCase; diff --git a/src/Testing/TestUtils.php b/src/Testing/TestUtils.php index ae7d5264..5c5e8658 100644 --- a/src/Testing/TestUtils.php +++ b/src/Testing/TestUtils.php @@ -18,7 +18,7 @@ * Useful utility functions for SDK testing. */ -namespace Google\Appengine\Testing; +namespace Google\AppEngine\Testing; final class TestUtils { /** diff --git a/src/Util/ArrayUtil.php b/src/Util/ArrayUtil.php index d204af11..d25586bd 100644 --- a/src/Util/ArrayUtil.php +++ b/src/Util/ArrayUtil.php @@ -18,7 +18,7 @@ * Various utilities for working with PHP arrays. * */ -namespace Google\Appengine\Util; +namespace Google\AppEngine\Util; /** * Various PHP array related utility functions. diff --git a/src/Util/HttpUtil.php b/src/Util/HttpUtil.php index a5043b0a..066f9061 100644 --- a/src/Util/HttpUtil.php +++ b/src/Util/HttpUtil.php @@ -18,7 +18,7 @@ * Various HTTP utility functions. * */ -namespace Google\Appengine\Util; +namespace Google\AppEngine\Util; /** * HTTP related Utilities. diff --git a/src/Util/StringUtil.php b/src/Util/StringUtil.php index c3b7bfd5..62078607 100644 --- a/src/Util/StringUtil.php +++ b/src/Util/StringUtil.php @@ -18,7 +18,7 @@ * Various utilities for working with Strings. * */ -namespace Google\Appengine\Util; +namespace Google\AppEngine\Util; /** * Various PHP string related utility functions. diff --git a/tests/Api/AppIdentity/AppIdentityServiceTest.php b/tests/Api/AppIdentity/AppIdentityServiceTest.php index fc3d54f6..8262bf49 100644 --- a/tests/Api/AppIdentity/AppIdentityServiceTest.php +++ b/tests/Api/AppIdentity/AppIdentityServiceTest.php @@ -18,11 +18,11 @@ * PHP Unit tests for the AppIdentityService. * */ -namespace Google\Appengine\Api\AppIdentity; +namespace Google\AppEngine\Api\AppIdentity; use google\appengine\AppIdentityServiceError\ErrorCode; -use Google\Appengine\Api\AppIdentity\AppIdentityService; -use Google\Appengine\Testing\ApiProxyTestBase; +use Google\AppEngine\Api\AppIdentity\AppIdentityService; +use Google\AppEngine\Testing\ApiProxyTestBase; /** * Mock functions for APC cache functions. @@ -162,7 +162,7 @@ private function expectGetAccessTokenRequest($scopes, $cached, 'expiration_time' => 12345, ])); $item->setFlags( - \Google\Appengine\Runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); + \Google\AppEngine\Runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); } $this->apiProxyMock->expectCall('memcache', @@ -205,7 +205,7 @@ private function expectGetAccessTokenRequest($scopes, $cached, AppIdentityService::EXPIRY_SAFETY_MARGIN_SECS - AppIdentityService::EXPIRY_SHORT_MARGIN_SECS); $item->setFlags( - \Google\Appengine\Runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); + \Google\AppEngine\Runtime\MemcacheUtils::TYPE_PHP_SERIALIZED); $item->setSetPolicy(1); // Add $resp = new \google\appengine\MemcacheSetResponse(); $resp->addSetStatus(1); // Stored @@ -339,7 +339,7 @@ public function testGetAccessTokenServiceInvalidScope() { $scope = 'mail.google.com/invalid-scope'; $req->addScope($scope); - $exception = new \Google\Appengine\Runtime\ApplicationError( + $exception = new \Google\AppEngine\Runtime\ApplicationError( ErrorCode::UNKNOWN_SCOPE, "unknown scope"); $this->expectException('\InvalidArgumentException', @@ -401,7 +401,7 @@ private function executeServiceErrorTest($error, $expected_response) { $scope = 'mail.google.com/invalid-scope'; $req->addScope($scope); - $exception = new \Google\Appengine\Runtime\ApplicationError( + $exception = new \Google\AppEngine\Runtime\ApplicationError( $error, "not initialized"); $this->expectException( diff --git a/tests/Runtime/ApiProxyTest.php b/tests/Runtime/ApiProxyTest.php index 74b535e1..6a7850c3 100644 --- a/tests/Runtime/ApiProxyTest.php +++ b/tests/Runtime/ApiProxyTest.php @@ -17,11 +17,11 @@ /** */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\base\VoidProto; -use Google\Appengine\Runtime\ApiProxyBase; -use Google\Appengine\Runtime\RealApiProxy; +use Google\AppEngine\Runtime\ApiProxyBase; +use Google\AppEngine\Runtime\RealApiProxy; use \PHPUnit\Framework\TestCase; /** diff --git a/tests/Runtime/CurlLiteStub.php b/tests/Runtime/CurlLiteStub.php index b8b51c29..1c75d33c 100644 --- a/tests/Runtime/CurlLiteStub.php +++ b/tests/Runtime/CurlLiteStub.php @@ -20,7 +20,7 @@ */ // Constant Definitions -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; if (!defined('CURLAUTH_ANYSAFE')) { define('CURLAUTH_ANYSAFE', -18); diff --git a/tests/Runtime/CurlLiteTest.php b/tests/Runtime/CurlLiteTest.php index 6589bcae..01d07c2d 100644 --- a/tests/Runtime/CurlLiteTest.php +++ b/tests/Runtime/CurlLiteTest.php @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; -use Google\Appengine\Testing\ApiProxyTestBase; -use Google\Appengine\Testing\TestUtils; +use Google\AppEngine\Testing\ApiProxyTestBase; +use Google\AppEngine\Testing\TestUtils; use google\appengine\URLFetchRequest\RequestMethod; use google\appengine\URLFetchServiceError\ErrorCode; -use Google\Appengine\Runtime\ApplicationError; -use Google\Appengine\Runtime\CurlLiteStub; +use Google\AppEngine\Runtime\ApplicationError; +use Google\AppEngine\Runtime\CurlLiteStub; // This file is included in Setup.php if google_app_engine.enable_curl_lite is // set in php.ini. Include it here unconditionally for the sake of testing @@ -34,7 +34,7 @@ class CurlLiteTest extends ApiProxyTestBase { public function setUp(): void { parent::setUp(); - TestUtils::setStaticProperty('Google\Appengine\Runtime\CurlLite', + TestUtils::setStaticProperty('Google\AppEngine\Runtime\CurlLite', 'logging_callback', [$this, 'mockLog']); } diff --git a/tests/Runtime/DirectUploadHandlerTest.php b/tests/Runtime/DirectUploadHandlerTest.php index b2747b47..ee5f826b 100644 --- a/tests/Runtime/DirectUploadHandlerTest.php +++ b/tests/Runtime/DirectUploadHandlerTest.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use \PHPUnit\Framework\TestCase; diff --git a/tests/Runtime/MailTest.php b/tests/Runtime/MailTest.php index 8efd3f9d..3175ec25 100644 --- a/tests/Runtime/MailTest.php +++ b/tests/Runtime/MailTest.php @@ -19,12 +19,12 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\base\VoidProto; use google\appengine\MailMessage; -use Google\Appengine\Runtime\Mail; -use Google\Appengine\Testing\ApiProxyTestBase; +use Google\AppEngine\Runtime\Mail; +use Google\AppEngine\Testing\ApiProxyTestBase; /** * @requires extension mailparse diff --git a/tests/Runtime/MemcacheTest.php b/tests/Runtime/MemcacheTest.php index bf5bee1a..8a03d3dd 100644 --- a/tests/Runtime/MemcacheTest.php +++ b/tests/Runtime/MemcacheTest.php @@ -19,7 +19,7 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -34,7 +34,7 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use Google\Appengine\Testing\ApiProxyTestBase; +use Google\AppEngine\Testing\ApiProxyTestBase; class MemcacheTest extends ApiProxyTestBase { diff --git a/tests/Runtime/MemcachedTest.php b/tests/Runtime/MemcachedTest.php index e248a6d7..ef888ae1 100644 --- a/tests/Runtime/MemcachedTest.php +++ b/tests/Runtime/MemcachedTest.php @@ -19,7 +19,7 @@ * */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\MemcacheDeleteRequest; use google\appengine\MemcacheDeleteResponse; @@ -34,7 +34,7 @@ use google\appengine\MemcacheSetRequest\SetPolicy; use google\appengine\MemcacheSetResponse; use google\appengine\MemcacheSetResponse\SetStatusCode; -use Google\Appengine\Testing\ApiProxyTestBase; +use Google\AppEngine\Testing\ApiProxyTestBase; class MemcachedTest extends ApiProxyTestBase { diff --git a/tests/Runtime/UnlinkUploadsTest.php b/tests/Runtime/UnlinkUploadsTest.php index 381a0b6e..6a35b9cf 100644 --- a/tests/Runtime/UnlinkUploadsTest.php +++ b/tests/Runtime/UnlinkUploadsTest.php @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use org\bovigo\vfs\vfsStream; use \PHPUnit\Framework\TestCase; diff --git a/tests/Runtime/VmApiProxyTest.php b/tests/Runtime/VmApiProxyTest.php index 133bb053..4bf3bdde 100644 --- a/tests/Runtime/VmApiProxyTest.php +++ b/tests/Runtime/VmApiProxyTest.php @@ -18,15 +18,15 @@ // File defines two classes and the funtion names are not CamelCase as they are // following the streamWrapper interface. -namespace Google\Appengine\Runtime; +namespace Google\AppEngine\Runtime; use google\appengine\ext\remote_api\Request; use google\appengine\ext\remote_api\Response; use google\appengine\ext\remote_api\RpcError\ErrorCode; use google\appengine\SignForAppRequest; use google\appengine\SignForAppResponse; -use Google\Appengine\Runtime\ApiProxy; -use Google\Appengine\Runtime\ApplicationError; +use Google\AppEngine\Runtime\ApiProxy; +use Google\AppEngine\Runtime\ApplicationError; use \PHPUnit\Framework\TestCase; @@ -266,7 +266,7 @@ public function testRpcException($error_code, $exception) { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('Google\Appengine\Runtime\\' . $exception); + $this->expectException('Google\AppEngine\Runtime\\' . $exception); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, @@ -305,7 +305,7 @@ public function testApplicationError() { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('Google\Appengine\Runtime\ApplicationError'); + $this->expectException('Google\AppEngine\Runtime\ApplicationError'); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, @@ -323,7 +323,7 @@ public function testGenericExceptionError() { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('Google\Appengine\Runtime\RPCFailedError'); + $this->expectException('Google\AppEngine\Runtime\RPCFailedError'); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, @@ -363,7 +363,7 @@ public function testFailedHttpConnection() { $this->expectRpc($expected_request, $expected_response, $options); - $this->expectException('Google\Appengine\Runtime\RPCFailedError'); + $this->expectException('Google\AppEngine\Runtime\RPCFailedError'); ApiProxy::makeSyncCall(self::PACKAGE_NAME, self::CALL_NAME, $expected_request, diff --git a/tests/Util/ArrayUtilTest.php b/tests/Util/ArrayUtilTest.php index f841eea9..b396d848 100644 --- a/tests/Util/ArrayUtilTest.php +++ b/tests/Util/ArrayUtilTest.php @@ -14,14 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -namespace Google\Appengine\Util; +namespace Google\AppEngine\Util; -use Google\Appengine\Util\ArrayUtil; +use Google\AppEngine\Util\ArrayUtil; use \PHPUnit\Framework\TestCase; class ArrayUtilTest extends TestCase { - private $merge_fn = "Google\Appengine\Util\ArrayUtil::arrayMergeIgnoreCase"; + private $merge_fn = "Google\AppEngine\Util\ArrayUtil::arrayMergeIgnoreCase"; /** * @dataProvider arrayMergeDataProvider */ From ddf093fdaf963c9a2470a8306488b9f35f57e46b Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Thu, 29 Apr 2021 16:21:25 -0700 Subject: [PATCH 03/10] update files --- src/Runtime/RemoteApiProxy.php | 6 +++--- tests/Api/AppIdentity/AppIdentityServiceTest.php | 2 +- tests/Runtime/CurlLiteStub.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Runtime/RemoteApiProxy.php b/src/Runtime/RemoteApiProxy.php index 3a353ebd..4d98ed81 100644 --- a/src/Runtime/RemoteApiProxy.php +++ b/src/Runtime/RemoteApiProxy.php @@ -16,9 +16,9 @@ */ namespace Google\AppEngine\Runtime; -use Google\Appengine\Ext\RemoteApi\Request; -use Google\Appengine\Ext\RemoteApi\Response; -use Google\Appengine\Runtime\RPCFailedError; +use Google\AppEngine\Ext\RemoteApi\Request; +use Google\AppEngine\Ext\RemoteApi\Response; +use Google\AppEngine\Runtime\RPCFailedError; class RemoteApiProxy extends ApiProxyBase{ diff --git a/tests/Api/AppIdentity/AppIdentityServiceTest.php b/tests/Api/AppIdentity/AppIdentityServiceTest.php index 8262bf49..b394c15b 100644 --- a/tests/Api/AppIdentity/AppIdentityServiceTest.php +++ b/tests/Api/AppIdentity/AppIdentityServiceTest.php @@ -405,7 +405,7 @@ private function executeServiceErrorTest($error, $expected_response) { $error, "not initialized"); $this->expectException( - '\Google\Appengine\Api\AppIdentity\AppIdentityException', + '\Google\AppEngine\Api\AppIdentity\AppIdentityException', $expected_response); self::expectGetAccessTokenRequest(array($scope), false, $exception); diff --git a/tests/Runtime/CurlLiteStub.php b/tests/Runtime/CurlLiteStub.php index 1c75d33c..4b8e8891 100644 --- a/tests/Runtime/CurlLiteStub.php +++ b/tests/Runtime/CurlLiteStub.php @@ -1294,8 +1294,8 @@ // Function Definitions -use Google\Appengine\Runtime\CurlLite; -use Roogle\Appengine\Runtime\CurlLiteMethodNotSupportedException; +use Google\AppEngine\Runtime\CurlLite; +use Google\AppEngine\Runtime\CurlLiteMethodNotSupportedException; if (!function_exists('curl_init')) { function curl_init($url = null) { From c1a41b7e1f468fe93fa2927c538ace6799e195ec Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Fri, 30 Apr 2021 16:21:22 -0700 Subject: [PATCH 04/10] AppIdentity proto class --- composer.json | 7 +- src/Api/AppIdentity/AppIdentityService.php | 22 +-- .../AppIdentity/AppIdentityServiceError.php | 31 +++ .../AppIdentityServiceError/ErrorCode.php | 96 ++++++++++ .../AppIdentityServiceError_ErrorCode.php | 16 ++ src/Api/AppIdentity/GetAccessTokenRequest.php | 176 ++++++++++++++++++ .../AppIdentity/GetAccessTokenResponse.php | 112 +++++++++++ .../GetDefaultGcsBucketNameRequest.php | 33 ++++ .../GetDefaultGcsBucketNameResponse.php | 75 ++++++++ .../GetPublicCertificateForAppRequest.php | 33 ++++ .../GetPublicCertificateForAppResponse.php | 95 ++++++++++ .../GetServiceAccountNameRequest.php | 33 ++++ .../GetServiceAccountNameResponse.php | 68 +++++++ src/Api/AppIdentity/PublicCertificate.php | 160 +++++++++------- src/Api/AppIdentity/SignForAppRequest.php | 75 ++++++++ src/Api/AppIdentity/SignForAppResponse.php | 105 +++++++++++ src/Testing/ApiCallArguments.php | 9 +- src/Testing/ApiProxyMock.php | 14 +- .../AppIdentity/AppIdentityServiceTest.php | 41 ++-- 19 files changed, 1105 insertions(+), 96 deletions(-) create mode 100644 src/Api/AppIdentity/AppIdentityServiceError.php create mode 100644 src/Api/AppIdentity/AppIdentityServiceError/ErrorCode.php create mode 100644 src/Api/AppIdentity/AppIdentityServiceError_ErrorCode.php create mode 100644 src/Api/AppIdentity/GetAccessTokenRequest.php create mode 100644 src/Api/AppIdentity/GetAccessTokenResponse.php create mode 100644 src/Api/AppIdentity/GetDefaultGcsBucketNameRequest.php create mode 100644 src/Api/AppIdentity/GetDefaultGcsBucketNameResponse.php create mode 100644 src/Api/AppIdentity/GetPublicCertificateForAppRequest.php create mode 100644 src/Api/AppIdentity/GetPublicCertificateForAppResponse.php create mode 100644 src/Api/AppIdentity/GetServiceAccountNameRequest.php create mode 100644 src/Api/AppIdentity/GetServiceAccountNameResponse.php create mode 100644 src/Api/AppIdentity/SignForAppRequest.php create mode 100644 src/Api/AppIdentity/SignForAppResponse.php diff --git a/composer.json b/composer.json index 5d704af8..22f06ed2 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ "forum": "https://groups.google.com/forum/#!forum/google-appengine" }, "require": { - "php": ">=5.4.0" + "php": ">=5.4.0", + "google/protobuf": "^3.15" }, "require-dev": { "mikey179/vfsstream": "~1", @@ -19,13 +20,13 @@ }, "autoload": { "psr-4": { - "Google\\AppEngine\\": "src" + "Google\\AppEngine\\": "src", + "GPBMetadata\\": "metadata" }, "classmap": [ "src/Api/api_base_pb.php", "src/Api/Memcache/memcache_service_pb.php", "src/Api/Urlfetch/urlfetch_service_pb.php", - "src/Api/AppIdentity/app_identity_service_pb.php", "src/Datastore/action_pb.php", "src/Datastore/datastore_v3_pb.php", "src/Datastore/datastore_v4_pb.php", diff --git a/src/Api/AppIdentity/AppIdentityService.php b/src/Api/AppIdentity/AppIdentityService.php index 982b6f75..f5c0d03e 100644 --- a/src/Api/AppIdentity/AppIdentityService.php +++ b/src/Api/AppIdentity/AppIdentityService.php @@ -20,15 +20,15 @@ namespace Google\AppEngine\Api\AppIdentity; -use google\appengine\AppIdentityServiceError\ErrorCode; -use google\appengine\GetAccessTokenRequest; -use google\appengine\GetAccessTokenResponse; -use google\appengine\GetPublicCertificateForAppRequest; -use google\appengine\GetPublicCertificateForAppResponse; -use google\appengine\GetServiceAccountNameRequest; -use google\appengine\GetServiceAccountNameResponse; -use google\appengine\SignForAppRequest; -use google\appengine\SignForAppResponse; +use Google\AppEngine\Api\AppIdentity\AppIdentityServiceError\ErrorCode; +use Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest; +use Google\AppEngine\Api\AppIdentity\GetAccessTokenResponse; +use Google\AppEngine\Api\AppIdentity\GetPublicCertificateForAppRequest; +use Google\AppEngine\Api\AppIdentity\GetPublicCertificateForAppResponse; +use Google\AppEngine\Api\AppIdentity\GetServiceAccountNameRequest; +use Google\AppEngine\Api\AppIdentity\GetServiceAccountNameResponse; +use Google\AppEngine\Api\AppIdentity\SignForAppRequest; +use Google\AppEngine\Api\AppIdentity\SignForAppResponse; use Google\AppEngine\Runtime\ApiProxy; use Google\AppEngine\Runtime\ApplicationError; use Google\AppEngine\Runtime\Memcache; @@ -137,7 +137,7 @@ public static function getPublicCertificates() { $result = []; - foreach ($resp->getPublicCertificateListList() as $cert) { + foreach ($resp->getPublicCertificateList() as $cert) { $result[] = new PublicCertificate($cert->getKeyName(), $cert->getX509CertificatePem()); } @@ -155,7 +155,7 @@ public static function getPublicCertificates() { * safe to cache and reuse until they expire. * * @param array $scopes The scopes to acquire the access token for. - * Can be either a single string or an array of strings. + * CagetPublicCertificateListn be either a single string or an array of strings. * * @throws \InvalidArgumentException If $scopes is not a string or an array of * strings. diff --git a/src/Api/AppIdentity/AppIdentityServiceError.php b/src/Api/AppIdentity/AppIdentityServiceError.php new file mode 100644 index 00000000..86b34ebc --- /dev/null +++ b/src/Api/AppIdentity/AppIdentityServiceError.php @@ -0,0 +1,31 @@ +google.appEngine.api.appIdentity.AppIdentityServiceError + */ +class AppIdentityServiceError extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/Api/AppIdentity/AppIdentityServiceError/ErrorCode.php b/src/Api/AppIdentity/AppIdentityServiceError/ErrorCode.php new file mode 100644 index 00000000..0b84a00e --- /dev/null +++ b/src/Api/AppIdentity/AppIdentityServiceError/ErrorCode.php @@ -0,0 +1,96 @@ +google.appEngine.api.appIdentity.AppIdentityServiceError.ErrorCode + */ +class ErrorCode +{ + /** + * Errors with low numbers are from gaiamintservice.proto. + * Only a few are copied here as this is visible externally. + * + * Generated from protobuf enum SUCCESS = 0; + */ + const SUCCESS = 0; + /** + * Generated from protobuf enum UNKNOWN_SCOPE = 9; + */ + const UNKNOWN_SCOPE = 9; + /** + * Errors 1000 and higher are unique to this service. + * + * Generated from protobuf enum BLOB_TOO_LARGE = 1000; + */ + const BLOB_TOO_LARGE = 1000; + /** + * Generated from protobuf enum DEADLINE_EXCEEDED = 1001; + */ + const DEADLINE_EXCEEDED = 1001; + /** + * Generated from protobuf enum NOT_A_VALID_APP = 1002; + */ + const NOT_A_VALID_APP = 1002; + /** + * Generated from protobuf enum UNKNOWN_ERROR = 1003; + */ + const UNKNOWN_ERROR = 1003; + /** + * Generated from protobuf enum GAIAMINT_NOT_INITIAILIZED = 1004; + */ + const GAIAMINT_NOT_INITIAILIZED = 1004; + /** + * Generated from protobuf enum NOT_ALLOWED = 1005; + */ + const NOT_ALLOWED = 1005; + /** + * Generated from protobuf enum NOT_IMPLEMENTED = 1006; + */ + const NOT_IMPLEMENTED = 1006; + + private static $valueToName = [ + self::SUCCESS => 'SUCCESS', + self::UNKNOWN_SCOPE => 'UNKNOWN_SCOPE', + self::BLOB_TOO_LARGE => 'BLOB_TOO_LARGE', + self::DEADLINE_EXCEEDED => 'DEADLINE_EXCEEDED', + self::NOT_A_VALID_APP => 'NOT_A_VALID_APP', + self::UNKNOWN_ERROR => 'UNKNOWN_ERROR', + self::GAIAMINT_NOT_INITIAILIZED => 'GAIAMINT_NOT_INITIAILIZED', + self::NOT_ALLOWED => 'NOT_ALLOWED', + self::NOT_IMPLEMENTED => 'NOT_IMPLEMENTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ErrorCode::class, \Google\AppEngine\Api\AppIdentity\AppIdentityServiceError_ErrorCode::class); + diff --git a/src/Api/AppIdentity/AppIdentityServiceError_ErrorCode.php b/src/Api/AppIdentity/AppIdentityServiceError_ErrorCode.php new file mode 100644 index 00000000..7260d033 --- /dev/null +++ b/src/Api/AppIdentity/AppIdentityServiceError_ErrorCode.php @@ -0,0 +1,16 @@ +google.appEngine.api.appIdentity.GetAccessTokenRequest + */ +class GetAccessTokenRequest extends \Google\Protobuf\Internal\Message +{ + /** + * At the moment the 'id' and 'name' fields are used only for superapps. + * However if/when we support multiple robot for a single app, they will + * will be used to select the appropriate account. + * + * Generated from protobuf field repeated string scope = 1; + */ + private $scope; + /** + * TODO(wlhe): reserve these two fields once all the depending codes + * are removed. + * + * Generated from protobuf field int64 service_account_id = 2; + */ + protected $service_account_id = null; + /** + * Service account name is superapp only, and only a refresh token of the + * form r:refresh token is supported. + * + * Generated from protobuf field string service_account_name = 3 [deprecated = true]; + * @deprecated + */ + protected $service_account_name = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $scope + * At the moment the 'id' and 'name' fields are used only for superapps. + * However if/when we support multiple robot for a single app, they will + * will be used to select the appropriate account. + * @type int|string $service_account_id + * TODO(wlhe): reserve these two fields once all the depending codes + * are removed. + * @type string $service_account_name + * Service account name is superapp only, and only a refresh token of the + * form r:refresh token is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * At the moment the 'id' and 'name' fields are used only for superapps. + * However if/when we support multiple robot for a single app, they will + * will be used to select the appropriate account. + * + * Generated from protobuf field repeated string scope = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScope() + { + return $this->scope; + } + + /** + * At the moment the 'id' and 'name' fields are used only for superapps. + * However if/when we support multiple robot for a single app, they will + * will be used to select the appropriate account. + * + * Generated from protobuf field repeated string scope = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScope($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->scope = $arr; + + return $this; + } + + /** + * TODO(wlhe): reserve these two fields once all the depending codes + * are removed. + * + * Generated from protobuf field int64 service_account_id = 2; + * @return int|string + */ + public function getServiceAccountId() + { + return isset($this->service_account_id) ? $this->service_account_id : 0; + } + + public function hasServiceAccountId() + { + return isset($this->service_account_id); + } + + public function clearServiceAccountId() + { + unset($this->service_account_id); + } + + /** + * TODO(wlhe): reserve these two fields once all the depending codes + * are removed. + * + * Generated from protobuf field int64 service_account_id = 2; + * @param int|string $var + * @return $this + */ + public function setServiceAccountId($var) + { + GPBUtil::checkInt64($var); + $this->service_account_id = $var; + + return $this; + } + + /** + * Service account name is superapp only, and only a refresh token of the + * form r:refresh token is supported. + * + * Generated from protobuf field string service_account_name = 3 [deprecated = true]; + * @return string + * @deprecated + */ + public function getServiceAccountName() + { + @trigger_error('service_account_name is deprecated.', E_USER_DEPRECATED); + return isset($this->service_account_name) ? $this->service_account_name : ''; + } + + public function hasServiceAccountName() + { + @trigger_error('service_account_name is deprecated.', E_USER_DEPRECATED); + return isset($this->service_account_name); + } + + public function clearServiceAccountName() + { + @trigger_error('service_account_name is deprecated.', E_USER_DEPRECATED); + unset($this->service_account_name); + } + + /** + * Service account name is superapp only, and only a refresh token of the + * form r:refresh token is supported. + * + * Generated from protobuf field string service_account_name = 3 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setServiceAccountName($var) + { + @trigger_error('service_account_name is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->service_account_name = $var; + + return $this; + } + +} + diff --git a/src/Api/AppIdentity/GetAccessTokenResponse.php b/src/Api/AppIdentity/GetAccessTokenResponse.php new file mode 100644 index 00000000..5d25db82 --- /dev/null +++ b/src/Api/AppIdentity/GetAccessTokenResponse.php @@ -0,0 +1,112 @@ +google.appEngine.api.appIdentity.GetAccessTokenResponse + */ +class GetAccessTokenResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string access_token = 1; + */ + protected $access_token = null; + /** + * Seconds since the epoch. + * + * Generated from protobuf field int64 expiration_time = 2; + */ + protected $expiration_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $access_token + * @type int|string $expiration_time + * Seconds since the epoch. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string access_token = 1; + * @return string + */ + public function getAccessToken() + { + return isset($this->access_token) ? $this->access_token : ''; + } + + public function hasAccessToken() + { + return isset($this->access_token); + } + + public function clearAccessToken() + { + unset($this->access_token); + } + + /** + * Generated from protobuf field string access_token = 1; + * @param string $var + * @return $this + */ + public function setAccessToken($var) + { + GPBUtil::checkString($var, True); + $this->access_token = $var; + + return $this; + } + + /** + * Seconds since the epoch. + * + * Generated from protobuf field int64 expiration_time = 2; + * @return int|string + */ + public function getExpirationTime() + { + return isset($this->expiration_time) ? $this->expiration_time : 0; + } + + public function hasExpirationTime() + { + return isset($this->expiration_time); + } + + public function clearExpirationTime() + { + unset($this->expiration_time); + } + + /** + * Seconds since the epoch. + * + * Generated from protobuf field int64 expiration_time = 2; + * @param int|string $var + * @return $this + */ + public function setExpirationTime($var) + { + GPBUtil::checkInt64($var); + $this->expiration_time = $var; + + return $this; + } + +} + diff --git a/src/Api/AppIdentity/GetDefaultGcsBucketNameRequest.php b/src/Api/AppIdentity/GetDefaultGcsBucketNameRequest.php new file mode 100644 index 00000000..d5bf59a8 --- /dev/null +++ b/src/Api/AppIdentity/GetDefaultGcsBucketNameRequest.php @@ -0,0 +1,33 @@ +google.appEngine.api.appIdentity.GetDefaultGcsBucketNameRequest + */ +class GetDefaultGcsBucketNameRequest extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/Api/AppIdentity/GetDefaultGcsBucketNameResponse.php b/src/Api/AppIdentity/GetDefaultGcsBucketNameResponse.php new file mode 100644 index 00000000..8f8bcda2 --- /dev/null +++ b/src/Api/AppIdentity/GetDefaultGcsBucketNameResponse.php @@ -0,0 +1,75 @@ +google.appEngine.api.appIdentity.GetDefaultGcsBucketNameResponse + */ +class GetDefaultGcsBucketNameResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The default google storage bucket name for the application. + * + * Generated from protobuf field string default_gcs_bucket_name = 1; + */ + protected $default_gcs_bucket_name = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $default_gcs_bucket_name + * The default google storage bucket name for the application. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * The default google storage bucket name for the application. + * + * Generated from protobuf field string default_gcs_bucket_name = 1; + * @return string + */ + public function getDefaultGcsBucketName() + { + return isset($this->default_gcs_bucket_name) ? $this->default_gcs_bucket_name : ''; + } + + public function hasDefaultGcsBucketName() + { + return isset($this->default_gcs_bucket_name); + } + + public function clearDefaultGcsBucketName() + { + unset($this->default_gcs_bucket_name); + } + + /** + * The default google storage bucket name for the application. + * + * Generated from protobuf field string default_gcs_bucket_name = 1; + * @param string $var + * @return $this + */ + public function setDefaultGcsBucketName($var) + { + GPBUtil::checkString($var, True); + $this->default_gcs_bucket_name = $var; + + return $this; + } + +} + diff --git a/src/Api/AppIdentity/GetPublicCertificateForAppRequest.php b/src/Api/AppIdentity/GetPublicCertificateForAppRequest.php new file mode 100644 index 00000000..78dc5e69 --- /dev/null +++ b/src/Api/AppIdentity/GetPublicCertificateForAppRequest.php @@ -0,0 +1,33 @@ +google.appEngine.api.appIdentity.GetPublicCertificateForAppRequest + */ +class GetPublicCertificateForAppRequest extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/Api/AppIdentity/GetPublicCertificateForAppResponse.php b/src/Api/AppIdentity/GetPublicCertificateForAppResponse.php new file mode 100644 index 00000000..8025c5da --- /dev/null +++ b/src/Api/AppIdentity/GetPublicCertificateForAppResponse.php @@ -0,0 +1,95 @@ +google.appEngine.api.appIdentity.GetPublicCertificateForAppResponse + */ +class GetPublicCertificateForAppResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .google.appEngine.api.appIdentity.PublicCertificate public_certificate_list = 1; + */ + private $public_certificate_list; + /** + * Generated from protobuf field int64 max_client_cache_time_in_second = 2; + */ + protected $max_client_cache_time_in_second = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\AppEngine\Api\AppIdentity\PublicCertificate[]|\Google\Protobuf\Internal\RepeatedField $public_certificate_list + * @type int|string $max_client_cache_time_in_second + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .google.appEngine.api.appIdentity.PublicCertificate public_certificate_list = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPublicCertificateList() + { + return $this->public_certificate_list; + } + + /** + * Generated from protobuf field repeated .google.appEngine.api.appIdentity.PublicCertificate public_certificate_list = 1; + * @param \Google\AppEngine\Api\AppIdentity\PublicCertificate[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPublicCertificateList($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\AppEngine\Api\AppIdentity\PublicCertificate::class); + $this->public_certificate_list = $arr; + + return $this; + } + + /** + * Generated from protobuf field int64 max_client_cache_time_in_second = 2; + * @return int|string + */ + public function getMaxClientCacheTimeInSecond() + { + return isset($this->max_client_cache_time_in_second) ? $this->max_client_cache_time_in_second : 0; + } + + public function hasMaxClientCacheTimeInSecond() + { + return isset($this->max_client_cache_time_in_second); + } + + public function clearMaxClientCacheTimeInSecond() + { + unset($this->max_client_cache_time_in_second); + } + + /** + * Generated from protobuf field int64 max_client_cache_time_in_second = 2; + * @param int|string $var + * @return $this + */ + public function setMaxClientCacheTimeInSecond($var) + { + GPBUtil::checkInt64($var); + $this->max_client_cache_time_in_second = $var; + + return $this; + } + +} + diff --git a/src/Api/AppIdentity/GetServiceAccountNameRequest.php b/src/Api/AppIdentity/GetServiceAccountNameRequest.php new file mode 100644 index 00000000..57764b56 --- /dev/null +++ b/src/Api/AppIdentity/GetServiceAccountNameRequest.php @@ -0,0 +1,33 @@ +google.appEngine.api.appIdentity.GetServiceAccountNameRequest + */ +class GetServiceAccountNameRequest extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/Api/AppIdentity/GetServiceAccountNameResponse.php b/src/Api/AppIdentity/GetServiceAccountNameResponse.php new file mode 100644 index 00000000..73aa2ff7 --- /dev/null +++ b/src/Api/AppIdentity/GetServiceAccountNameResponse.php @@ -0,0 +1,68 @@ +google.appEngine.api.appIdentity.GetServiceAccountNameResponse + */ +class GetServiceAccountNameResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string service_account_name = 1; + */ + protected $service_account_name = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_account_name + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string service_account_name = 1; + * @return string + */ + public function getServiceAccountName() + { + return isset($this->service_account_name) ? $this->service_account_name : ''; + } + + public function hasServiceAccountName() + { + return isset($this->service_account_name); + } + + public function clearServiceAccountName() + { + unset($this->service_account_name); + } + + /** + * Generated from protobuf field string service_account_name = 1; + * @param string $var + * @return $this + */ + public function setServiceAccountName($var) + { + GPBUtil::checkString($var, True); + $this->service_account_name = $var; + + return $this; + } + +} + diff --git a/src/Api/AppIdentity/PublicCertificate.php b/src/Api/AppIdentity/PublicCertificate.php index 91585292..6594c12d 100644 --- a/src/Api/AppIdentity/PublicCertificate.php +++ b/src/Api/AppIdentity/PublicCertificate.php @@ -1,71 +1,105 @@ google.appEngine.api.appIdentity.PublicCertificate */ -final class PublicCertificate { - - /** - * The name of the certificate. - * @var string - */ - private $certificate_name; - - /** - * The public certificate in X509 PEM format. - * @var string - */ - private $certificate; - - /** - * Creates a new public certificate. - * - * @param string $certificate_name The name of the certificate. - * @param string $certificate_in_pem_format The public certificate in X509 - * PEM format. - */ - public function __construct($certificate_name, - $certificate_in_pem_format) { - $this->certificate_name = $certificate_name; - $this->certificate = $certificate_in_pem_format; - } - - /** - * Returns the name of this public certificate. - * - * @return string The name of the certificate. - */ - public function getCertificateName() { - return $this->certificate_name; - } - - /** - * Returns the X509 Certificate in PEM format. - * - * @return string The public certificate in X509 PEM format. - */ - public function getX509CertificateInPemFormat() { - return $this->certificate; - } +class PublicCertificate extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string key_name = 1; + */ + protected $key_name = null; + /** + * Generated from protobuf field string x509_certificate_pem = 2; + */ + protected $x509_certificate_pem = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_name + * @type string $x509_certificate_pem + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string key_name = 1; + * @return string + */ + public function getKeyName() + { + return isset($this->key_name) ? $this->key_name : ''; + } + + public function hasKeyName() + { + return isset($this->key_name); + } + + public function clearKeyName() + { + unset($this->key_name); + } + + /** + * Generated from protobuf field string key_name = 1; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + + /** + * Generated from protobuf field string x509_certificate_pem = 2; + * @return string + */ + public function getX509CertificatePem() + { + return isset($this->x509_certificate_pem) ? $this->x509_certificate_pem : ''; + } + + public function hasX509CertificatePem() + { + return isset($this->x509_certificate_pem); + } + + public function clearX509CertificatePem() + { + unset($this->x509_certificate_pem); + } + + /** + * Generated from protobuf field string x509_certificate_pem = 2; + * @param string $var + * @return $this + */ + public function setX509CertificatePem($var) + { + GPBUtil::checkString($var, True); + $this->x509_certificate_pem = $var; + + return $this; + } + } diff --git a/src/Api/AppIdentity/SignForAppRequest.php b/src/Api/AppIdentity/SignForAppRequest.php new file mode 100644 index 00000000..cff68569 --- /dev/null +++ b/src/Api/AppIdentity/SignForAppRequest.php @@ -0,0 +1,75 @@ +google.appEngine.api.appIdentity.SignForAppRequest + */ +class SignForAppRequest extends \Google\Protobuf\Internal\Message +{ + /** + * optional string app_id = 2; + * + * Generated from protobuf field bytes bytes_to_sign = 1; + */ + protected $bytes_to_sign = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $bytes_to_sign + * optional string app_id = 2; + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * optional string app_id = 2; + * + * Generated from protobuf field bytes bytes_to_sign = 1; + * @return string + */ + public function getBytesToSign() + { + return isset($this->bytes_to_sign) ? $this->bytes_to_sign : ''; + } + + public function hasBytesToSign() + { + return isset($this->bytes_to_sign); + } + + public function clearBytesToSign() + { + unset($this->bytes_to_sign); + } + + /** + * optional string app_id = 2; + * + * Generated from protobuf field bytes bytes_to_sign = 1; + * @param string $var + * @return $this + */ + public function setBytesToSign($var) + { + GPBUtil::checkString($var, False); + $this->bytes_to_sign = $var; + + return $this; + } + +} + diff --git a/src/Api/AppIdentity/SignForAppResponse.php b/src/Api/AppIdentity/SignForAppResponse.php new file mode 100644 index 00000000..0fa4a80e --- /dev/null +++ b/src/Api/AppIdentity/SignForAppResponse.php @@ -0,0 +1,105 @@ +google.appEngine.api.appIdentity.SignForAppResponse + */ +class SignForAppResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string key_name = 1; + */ + protected $key_name = null; + /** + * Generated from protobuf field bytes signature_bytes = 2; + */ + protected $signature_bytes = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_name + * @type string $signature_bytes + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\AppIdentityService::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string key_name = 1; + * @return string + */ + public function getKeyName() + { + return isset($this->key_name) ? $this->key_name : ''; + } + + public function hasKeyName() + { + return isset($this->key_name); + } + + public function clearKeyName() + { + unset($this->key_name); + } + + /** + * Generated from protobuf field string key_name = 1; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + + /** + * Generated from protobuf field bytes signature_bytes = 2; + * @return string + */ + public function getSignatureBytes() + { + return isset($this->signature_bytes) ? $this->signature_bytes : ''; + } + + public function hasSignatureBytes() + { + return isset($this->signature_bytes); + } + + public function clearSignatureBytes() + { + unset($this->signature_bytes); + } + + /** + * Generated from protobuf field bytes signature_bytes = 2; + * @param string $var + * @return $this + */ + public function setSignatureBytes($var) + { + GPBUtil::checkString($var, False); + $this->signature_bytes = $var; + + return $this; + } + +} + diff --git a/src/Testing/ApiCallArguments.php b/src/Testing/ApiCallArguments.php index 11a990f3..8f4ffc25 100644 --- a/src/Testing/ApiCallArguments.php +++ b/src/Testing/ApiCallArguments.php @@ -31,7 +31,7 @@ public function isInputEqual($other) { return $this->package === $other->package && $this->call_name === $other->call_name - && $this->req->equals($other->req); + && $this->equals($this->req,$other->req); } public function toString() { @@ -39,5 +39,12 @@ public function toString() { . "Call: " . $this->call_name . "\n" . $this->req->shortDebugString(); } + + private function equals($a, $b) { + if ($a === $b) { return true; } + if (isset($a->bytes_to_sign) !== isset($b->bytes_to_sign)) return false; + if (isset($a->bytes_to_sign) && $a->bytes_to_sign !== $b->bytes_to_sign) return false; + return true; + } }; diff --git a/src/Testing/ApiProxyMock.php b/src/Testing/ApiProxyMock.php index b2b50e01..9e8d167b 100644 --- a/src/Testing/ApiProxyMock.php +++ b/src/Testing/ApiProxyMock.php @@ -47,12 +47,24 @@ public function makeSyncCall( if ($expectedCall->resp instanceof \Exception) { throw $expectedCall->resp; } else { - $resp->copyFrom($expectedCall->resp); + $this->copyFrom($resp, $expectedCall->resp); + } } public function verify() { $this->testcase->assertSame(array(), $this->expected); } + + /** + * Copies data from another protocol buffer pb2 to pb1. + */ + private function copyFrom($pb1, $pb2) { + if ($pb1 === $pb2) { + return; + } + $pb1->clear(); + $pb1->mergeFrom($pb2); + } } diff --git a/tests/Api/AppIdentity/AppIdentityServiceTest.php b/tests/Api/AppIdentity/AppIdentityServiceTest.php index b394c15b..234242f2 100644 --- a/tests/Api/AppIdentity/AppIdentityServiceTest.php +++ b/tests/Api/AppIdentity/AppIdentityServiceTest.php @@ -20,7 +20,8 @@ */ namespace Google\AppEngine\Api\AppIdentity; -use google\appengine\AppIdentityServiceError\ErrorCode; +use Google\AppEngine\Api\AppIdentity\AppIdentityServiceError\ErrorCode; +use Google\AppEngine\Api\AppIdentity\PublicCertificate; use Google\AppEngine\Api\AppIdentity\AppIdentityService; use Google\AppEngine\Testing\ApiProxyTestBase; @@ -77,10 +78,10 @@ public function testDown(): void { } public function testSignForApp() { - $req = new \google\appengine\SignForAppRequest(); + $req = new \Google\AppEngine\Api\AppIdentity\SignForAppRequest(); $req->setBytesToSign('these are the bytes'); - $resp = new \google\appengine\SignForAppResponse(); + $resp = new \Google\AppEngine\Api\AppIdentity\SignForAppResponse(); $resp->setSignatureBytes('signed bytes.'); $resp->setKeyName('the key_name'); @@ -102,15 +103,21 @@ public function testInvalidBytesToSign() { } public function testGetPublicCertificates() { - $req = new \google\appengine\GetPublicCertificateForAppRequest(); - $resp = new \google\appengine\GetPublicCertificateForAppResponse(); - - $cert = $resp->mutablePublicCertificateList(0); + $req = new \Google\AppEngine\Api\AppIdentity\GetPublicCertificateForAppRequest(); + $resp = new \Google\AppEngine\Api\AppIdentity\GetPublicCertificateForAppResponse(); + + $public_certificate_list = $resp->getPublicCertificateList(); + $cert = new PublicCertificate(); $cert->setKeyName('key1'); $cert->setX509CertificatePem('cert1'); - $cert = $resp->mutablePublicCertificateList(1); + $public_certificate_list[0] = $cert; + + $cert = new PublicCertificate(); $cert->setKeyName('key2'); $cert->setX509CertificatePem('cert2'); + $public_certificate_list[1] = $cert; + + $resp->setPublicCertificateList($public_certificate_list); $this->apiProxyMock->expectCall('app_identity_service', 'GetPublicCertificatesForApp', @@ -129,10 +136,10 @@ public function testGetPublicCertificates() { } public function testGetServiceAccountName() { - $req = new \google\appengine\GetServiceAccountNameRequest(); + $req = new \Google\AppEngine\Api\AppIdentity\GetServiceAccountNameRequest(); $service_account_result = 'foobar@gserviceaccount.google.com'; - $resp = new \google\appengine\GetServiceAccountNameResponse(); + $resp = new \Google\AppEngine\Api\AppIdentity\GetServiceAccountNameResponse(); $resp->setServiceAccountName($service_account_result); $this->apiProxyMock->expectCall('app_identity_service', @@ -172,13 +179,13 @@ private function expectGetAccessTokenRequest($scopes, $cached, if ($cached) { return; } - $req = new \google\appengine\GetAccessTokenRequest(); + $req = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest(); foreach ($scopes as $scope) { - $req->addScope($scope); + $req->setScope($scope); } if (is_null($exception)) { - $resp = new \google\appengine\GetAccessTokenResponse(); + $resp = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenResponse(); $resp->setAccessToken('foo token'); $resp->setExpirationTime(12345); } else { @@ -334,10 +341,10 @@ public function testGetAccessTokenInvalidScopeArray() { } public function testGetAccessTokenServiceInvalidScope() { - $req = new \google\appengine\GetAccessTokenRequest(); + $req = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest(); $scope = 'mail.google.com/invalid-scope'; - $req->addScope($scope); + $req->setScope($scope); $exception = new \Google\AppEngine\Runtime\ApplicationError( ErrorCode::UNKNOWN_SCOPE, "unknown scope"); @@ -396,10 +403,10 @@ public function testGetDefaultVersionHostname() { } private function executeServiceErrorTest($error, $expected_response) { - $req = new \google\appengine\GetAccessTokenRequest(); + $req = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest(); $scope = 'mail.google.com/invalid-scope'; - $req->addScope($scope); + $req->setScope($scope); $exception = new \Google\AppEngine\Runtime\ApplicationError( $error, "not initialized"); From 4397cd05f952c0b5530da009603d911c97c17ff8 Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Fri, 30 Apr 2021 16:21:22 -0700 Subject: [PATCH 05/10] AppIdentity proto class From 9bd4d4a73971404397d70ff16118c18a1608587b Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Fri, 30 Apr 2021 17:39:01 -0700 Subject: [PATCH 06/10] update branch From 9b09cd3f870c9db2cae28a0470a298df8fca145c Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Fri, 30 Apr 2021 19:01:53 -0700 Subject: [PATCH 07/10] Debug Appidentity tests/code --- metadata/AppIdentityService.php | Bin 0 -> 1898 bytes src/Api/AppIdentity/AppIdentityService.php | 17 ++++++++------ .../AppIdentity/AppIdentityServiceTest.php | 21 +++++++++--------- 3 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 metadata/AppIdentityService.php diff --git a/metadata/AppIdentityService.php b/metadata/AppIdentityService.php new file mode 100644 index 0000000000000000000000000000000000000000..70fef399b1971e28d338c38295033825ca5f9957 GIT binary patch literal 1898 zcmah~+iu%N5DjCrs>X3FGjZ$~sl8@gL;+HvXwZi$bqh*j6r!>yNJ>+*1{Tz6ByUZT zEO!~$E&SfE=m!=3jH2lM8@jw$k)h>L_TnIz~BdQSzkxFi)G%@ewI!8mrX>k%vS^G0tWuBtjWS{*zR9LU1v? zN|k;1InQ;N!{IdTQ`P?R6qtlPfZqUimiJvJ{2T`>3vXa(CHo<97|V7Ta${ zQ4krwXi!YA>cJ58RVehH*XvfVSGuNez}oZnmu=@ooA&BX$0`-|TX3`1a%!~iIJ9MU zn^x(Mf_?`!8kX5;*=>tjU)L?GVKqvB7WCV&t}H}N`jy$T8`SJ{N`Dn}{S~X#?K<7k z-vxaa?lw)^JhIz;nuOSGyKkFz%l<|&{Zr6Ou$nTpTFwjg9Llbv&=gHw0`fAeQObhudeLeDo=0ugGYKlT=jk*`lZ|*rcxuFn-m*c$2ieEq&O^ zPVbeB9v4z|X{EgS@#D(d%vo71?h))w+%w8NuJ#ONE;~Ug`2^KoP%DQ8{xB_QB^#ju zguVrC?7}@&O}=(a#)8BF4Ay{*w23p{lX@vZHPmKJSHE(#zLjjGr~wRO~7( z3egWv(Z6)&8oVP|5GIydDHruU(B}#GY^nMOOH`~V&lPLex3z4&wf&3pZ4`O13&XO81=g@hs%(bD|b-I-Yzesms=3Eosy=GPVC4-XO56@-}ef#-404 zQH$9rUYQGny`_j;;sI<8GX^?lf(}xSh2iYLHeCW6yqkW$9zU3F-ACCnpV|FO_kN1Z KR{RBA0Q?UxlvPmx literal 0 HcmV?d00001 diff --git a/src/Api/AppIdentity/AppIdentityService.php b/src/Api/AppIdentity/AppIdentityService.php index f5c0d03e..cc86a332 100644 --- a/src/Api/AppIdentity/AppIdentityService.php +++ b/src/Api/AppIdentity/AppIdentityService.php @@ -138,8 +138,12 @@ public static function getPublicCertificates() { $result = []; foreach ($resp->getPublicCertificateList() as $cert) { - $result[] = new PublicCertificate($cert->getKeyName(), - $cert->getX509CertificatePem()); + $pub_cert = new PublicCertificate(); + $pub_cert->setKeyName($cert->getKeyName()); + $pub_cert->setX509CertificatePem($cert->getX509CertificatePem()); + $result[] = $pub_cert; + // $result[] = new PublicCertificate($cert->getKeyName(), + // $cert->getX509CertificatePem()); } return $result; @@ -155,7 +159,7 @@ public static function getPublicCertificates() { * safe to cache and reuse until they expire. * * @param array $scopes The scopes to acquire the access token for. - * CagetPublicCertificateListn be either a single string or an array of strings. + * Can be either a single string or an array of strings. * * @throws \InvalidArgumentException If $scopes is not a string or an array of * strings. @@ -212,16 +216,15 @@ private static function getAccessTokenUncached($scopes) { $resp = new GetAccessTokenResponse(); if (is_string($scopes)) { - $req->addScope($scopes); + $req->setScope([$scopes]); } else if (is_array($scopes)) { foreach($scopes as $scope) { - if (is_string($scope)) { - $req->addScope($scope); - } else { + if (!is_string($scope)) { throw new \InvalidArgumentException( 'Invalid scope ' . htmlspecialchars($scope)); } } + $req->setScope($scopes); } else { throw new \InvalidArgumentException( 'Invalid scope ' . htmlspecialchars($scopes)); diff --git a/tests/Api/AppIdentity/AppIdentityServiceTest.php b/tests/Api/AppIdentity/AppIdentityServiceTest.php index 234242f2..c3715d6d 100644 --- a/tests/Api/AppIdentity/AppIdentityServiceTest.php +++ b/tests/Api/AppIdentity/AppIdentityServiceTest.php @@ -106,7 +106,8 @@ public function testGetPublicCertificates() { $req = new \Google\AppEngine\Api\AppIdentity\GetPublicCertificateForAppRequest(); $resp = new \Google\AppEngine\Api\AppIdentity\GetPublicCertificateForAppResponse(); - $public_certificate_list = $resp->getPublicCertificateList(); + // $public_certificate_list = $resp->getPublicCertificateList(); + $public_certificate_list = []; $cert = new PublicCertificate(); $cert->setKeyName('key1'); $cert->setX509CertificatePem('cert1'); @@ -127,11 +128,11 @@ public function testGetPublicCertificates() { $certs = AppIdentityService::getPublicCertificates(); $cert = $certs[0]; - $this->assertEquals($cert->getCertificateName(), 'key1'); - $this->assertEquals($cert->getX509CertificateInPemFormat(), 'cert1'); + $this->assertEquals($cert->getKeyName(), 'key1'); + $this->assertEquals($cert->getX509CertificatePem(), 'cert1'); $cert = $certs[1]; - $this->assertEquals($cert->getCertificateName(), 'key2'); - $this->assertEquals($cert->getX509CertificateInPemFormat(), 'cert2'); + $this->assertEquals($cert->getKeyName(), 'key2'); + $this->assertEquals($cert->getX509CertificatePem(), 'cert2'); $this->apiProxyMock->verify(); } @@ -180,9 +181,7 @@ private function expectGetAccessTokenRequest($scopes, $cached, return; } $req = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest(); - foreach ($scopes as $scope) { - $req->setScope($scope); - } + $req->setScope($scopes); if (is_null($exception)) { $resp = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenResponse(); @@ -334,7 +333,7 @@ private function expectMemcacheGetRequest($scopes) { } public function testGetAccessTokenInvalidScopeArray() { - $scopes = ["foo", 1]; + $scopes = ['foo', 1]; self::expectMemcacheGetRequest($scopes); $this->expectException('\InvalidArgumentException'); $sign_result = AppIdentityService::getAccessToken($scopes); @@ -344,7 +343,7 @@ public function testGetAccessTokenServiceInvalidScope() { $req = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest(); $scope = 'mail.google.com/invalid-scope'; - $req->setScope($scope); + $req->setScope([$scope]); $exception = new \Google\AppEngine\Runtime\ApplicationError( ErrorCode::UNKNOWN_SCOPE, "unknown scope"); @@ -406,7 +405,7 @@ private function executeServiceErrorTest($error, $expected_response) { $req = new \Google\AppEngine\Api\AppIdentity\GetAccessTokenRequest(); $scope = 'mail.google.com/invalid-scope'; - $req->setScope($scope); + $req->setScope([$scope]); $exception = new \Google\AppEngine\Runtime\ApplicationError( $error, "not initialized"); From 50075b92230410e5766f720b7fd99071bc77cf6c Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Fri, 30 Apr 2021 19:18:58 -0700 Subject: [PATCH 08/10] Debug VmApiProxy --- src/Runtime/VmApiProxy.php | 2 +- tests/Runtime/VmApiProxyTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Runtime/VmApiProxy.php b/src/Runtime/VmApiProxy.php index 480dc59d..e27f1720 100644 --- a/src/Runtime/VmApiProxy.php +++ b/src/Runtime/VmApiProxy.php @@ -205,7 +205,7 @@ public function makeSyncCall( $call_name); } - $response->parseFromString($remote_response->getResponse()); + $response->mergeFromString($remote_response->getResponse()); } /** diff --git a/tests/Runtime/VmApiProxyTest.php b/tests/Runtime/VmApiProxyTest.php index 4bf3bdde..cad9d554 100644 --- a/tests/Runtime/VmApiProxyTest.php +++ b/tests/Runtime/VmApiProxyTest.php @@ -23,8 +23,8 @@ use google\appengine\ext\remote_api\Request; use google\appengine\ext\remote_api\Response; use google\appengine\ext\remote_api\RpcError\ErrorCode; -use google\appengine\SignForAppRequest; -use google\appengine\SignForAppResponse; +use Google\AppEngine\Api\AppIdentity\SignForAppRequest; +use Google\AppEngine\Api\AppIdentity\SignForAppResponse; use Google\AppEngine\Runtime\ApiProxy; use Google\AppEngine\Runtime\ApplicationError; use \PHPUnit\Framework\TestCase; From bf67abc53e232c842205105877b7705c0d7920b0 Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Tue, 4 May 2021 15:09:39 -0700 Subject: [PATCH 09/10] remove deprecated appidentity proto class --- .../AppIdentity/app_identity_service_pb.php | 1077 ----------------- 1 file changed, 1077 deletions(-) delete mode 100644 src/Api/AppIdentity/app_identity_service_pb.php diff --git a/src/Api/AppIdentity/app_identity_service_pb.php b/src/Api/AppIdentity/app_identity_service_pb.php deleted file mode 100644 index b53ff1e3..00000000 --- a/src/Api/AppIdentity/app_identity_service_pb.php +++ /dev/null @@ -1,1077 +0,0 @@ -avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - } - public function equals($x) { - if ($x === $this) { return true; } - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - return $res; - } - } -} -namespace google\appengine { - class SignForAppRequest extends \google\net\ProtocolMessage { - public function getBytesToSign() { - if (!isset($this->bytes_to_sign)) { - return ''; - } - return $this->bytes_to_sign; - } - public function setBytesToSign($val) { - $this->bytes_to_sign = $val; - return $this; - } - public function clearBytesToSign() { - unset($this->bytes_to_sign); - return $this; - } - public function hasBytesToSign() { - return isset($this->bytes_to_sign); - } - public function clear() { - $this->clearBytesToSign(); - } - public function byteSizePartial() { - $res = 0; - if (isset($this->bytes_to_sign)) { - $res += 1; - $res += $this->lengthString(strlen($this->bytes_to_sign)); - } - return $res; - } - public function outputPartial($out) { - if (isset($this->bytes_to_sign)) { - $out->putVarInt32(10); - $out->putPrefixedString($this->bytes_to_sign); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->setBytesToSign(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - if ($x->hasBytesToSign()) { - $this->setBytesToSign($x->getBytesToSign()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (isset($this->bytes_to_sign) !== isset($x->bytes_to_sign)) return false; - if (isset($this->bytes_to_sign) && $this->bytes_to_sign !== $x->bytes_to_sign) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - if (isset($this->bytes_to_sign)) { - $res .= $prefix . "bytes_to_sign: " . $this->debugFormatString($this->bytes_to_sign) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class SignForAppResponse extends \google\net\ProtocolMessage { - public function getKeyName() { - if (!isset($this->key_name)) { - return ''; - } - return $this->key_name; - } - public function setKeyName($val) { - $this->key_name = $val; - return $this; - } - public function clearKeyName() { - unset($this->key_name); - return $this; - } - public function hasKeyName() { - return isset($this->key_name); - } - public function getSignatureBytes() { - if (!isset($this->signature_bytes)) { - return ''; - } - return $this->signature_bytes; - } - public function setSignatureBytes($val) { - $this->signature_bytes = $val; - return $this; - } - public function clearSignatureBytes() { - unset($this->signature_bytes); - return $this; - } - public function hasSignatureBytes() { - return isset($this->signature_bytes); - } - public function clear() { - $this->clearKeyName(); - $this->clearSignatureBytes(); - } - public function byteSizePartial() { - $res = 0; - if (isset($this->key_name)) { - $res += 1; - $res += $this->lengthString(strlen($this->key_name)); - } - if (isset($this->signature_bytes)) { - $res += 1; - $res += $this->lengthString(strlen($this->signature_bytes)); - } - return $res; - } - public function outputPartial($out) { - if (isset($this->key_name)) { - $out->putVarInt32(10); - $out->putPrefixedString($this->key_name); - } - if (isset($this->signature_bytes)) { - $out->putVarInt32(18); - $out->putPrefixedString($this->signature_bytes); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->setKeyName(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 18: - $length = $d->getVarInt32(); - $this->setSignatureBytes(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - if ($x->hasKeyName()) { - $this->setKeyName($x->getKeyName()); - } - if ($x->hasSignatureBytes()) { - $this->setSignatureBytes($x->getSignatureBytes()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (isset($this->key_name) !== isset($x->key_name)) return false; - if (isset($this->key_name) && $this->key_name !== $x->key_name) return false; - if (isset($this->signature_bytes) !== isset($x->signature_bytes)) return false; - if (isset($this->signature_bytes) && $this->signature_bytes !== $x->signature_bytes) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - if (isset($this->key_name)) { - $res .= $prefix . "key_name: " . $this->debugFormatString($this->key_name) . "\n"; - } - if (isset($this->signature_bytes)) { - $res .= $prefix . "signature_bytes: " . $this->debugFormatString($this->signature_bytes) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class GetPublicCertificateForAppRequest extends \google\net\ProtocolMessage { - public function clear() { - } - public function byteSizePartial() { - $res = 0; - return $res; - } - public function outputPartial($out) { - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - } - public function equals($x) { - if ($x === $this) { return true; } - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - return $res; - } - } -} -namespace google\appengine { - class PublicCertificate extends \google\net\ProtocolMessage { - public function getKeyName() { - if (!isset($this->key_name)) { - return ''; - } - return $this->key_name; - } - public function setKeyName($val) { - $this->key_name = $val; - return $this; - } - public function clearKeyName() { - unset($this->key_name); - return $this; - } - public function hasKeyName() { - return isset($this->key_name); - } - public function getX509CertificatePem() { - if (!isset($this->x509_certificate_pem)) { - return ''; - } - return $this->x509_certificate_pem; - } - public function setX509CertificatePem($val) { - $this->x509_certificate_pem = $val; - return $this; - } - public function clearX509CertificatePem() { - unset($this->x509_certificate_pem); - return $this; - } - public function hasX509CertificatePem() { - return isset($this->x509_certificate_pem); - } - public function clear() { - $this->clearKeyName(); - $this->clearX509CertificatePem(); - } - public function byteSizePartial() { - $res = 0; - if (isset($this->key_name)) { - $res += 1; - $res += $this->lengthString(strlen($this->key_name)); - } - if (isset($this->x509_certificate_pem)) { - $res += 1; - $res += $this->lengthString(strlen($this->x509_certificate_pem)); - } - return $res; - } - public function outputPartial($out) { - if (isset($this->key_name)) { - $out->putVarInt32(10); - $out->putPrefixedString($this->key_name); - } - if (isset($this->x509_certificate_pem)) { - $out->putVarInt32(18); - $out->putPrefixedString($this->x509_certificate_pem); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->setKeyName(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 18: - $length = $d->getVarInt32(); - $this->setX509CertificatePem(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - if ($x->hasKeyName()) { - $this->setKeyName($x->getKeyName()); - } - if ($x->hasX509CertificatePem()) { - $this->setX509CertificatePem($x->getX509CertificatePem()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (isset($this->key_name) !== isset($x->key_name)) return false; - if (isset($this->key_name) && $this->key_name !== $x->key_name) return false; - if (isset($this->x509_certificate_pem) !== isset($x->x509_certificate_pem)) return false; - if (isset($this->x509_certificate_pem) && $this->x509_certificate_pem !== $x->x509_certificate_pem) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - if (isset($this->key_name)) { - $res .= $prefix . "key_name: " . $this->debugFormatString($this->key_name) . "\n"; - } - if (isset($this->x509_certificate_pem)) { - $res .= $prefix . "x509_certificate_pem: " . $this->debugFormatString($this->x509_certificate_pem) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class GetPublicCertificateForAppResponse extends \google\net\ProtocolMessage { - private $public_certificate_list = array(); - public function getPublicCertificateListSize() { - return sizeof($this->public_certificate_list); - } - public function getPublicCertificateListList() { - return $this->public_certificate_list; - } - public function mutablePublicCertificateList($idx) { - if (!isset($this->public_certificate_list[$idx])) { - $val = new \google\appengine\PublicCertificate(); - $this->public_certificate_list[$idx] = $val; - return $val; - } - return $this->public_certificate_list[$idx]; - } - public function getPublicCertificateList($idx) { - if (isset($this->public_certificate_list[$idx])) { - return $this->public_certificate_list[$idx]; - } - if ($idx >= end(array_keys($this->public_certificate_list))) { - throw new \OutOfRangeException('index out of range: ' + $idx); - } - return new \google\appengine\PublicCertificate(); - } - public function addPublicCertificateList() { - $val = new \google\appengine\PublicCertificate(); - $this->public_certificate_list[] = $val; - return $val; - } - public function clearPublicCertificateList() { - $this->public_certificate_list = array(); - } - public function getMaxClientCacheTimeInSecond() { - if (!isset($this->max_client_cache_time_in_second)) { - return "0"; - } - return $this->max_client_cache_time_in_second; - } - public function setMaxClientCacheTimeInSecond($val) { - if (is_double($val)) { - $this->max_client_cache_time_in_second = sprintf('%0.0F', $val); - } else { - $this->max_client_cache_time_in_second = $val; - } - return $this; - } - public function clearMaxClientCacheTimeInSecond() { - unset($this->max_client_cache_time_in_second); - return $this; - } - public function hasMaxClientCacheTimeInSecond() { - return isset($this->max_client_cache_time_in_second); - } - public function clear() { - $this->clearPublicCertificateList(); - $this->clearMaxClientCacheTimeInSecond(); - } - public function byteSizePartial() { - $res = 0; - $this->checkProtoArray($this->public_certificate_list); - $res += 1 * sizeof($this->public_certificate_list); - foreach ($this->public_certificate_list as $value) { - $res += $this->lengthString($value->byteSizePartial()); - } - if (isset($this->max_client_cache_time_in_second)) { - $res += 1; - $res += $this->lengthVarInt64($this->max_client_cache_time_in_second); - } - return $res; - } - public function outputPartial($out) { - $this->checkProtoArray($this->public_certificate_list); - foreach ($this->public_certificate_list as $value) { - $out->putVarInt32(10); - $out->putVarInt32($value->byteSizePartial()); - $value->outputPartial($out); - } - if (isset($this->max_client_cache_time_in_second)) { - $out->putVarInt32(16); - $out->putVarInt64($this->max_client_cache_time_in_second); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $tmp = new \google\net\Decoder($d->buffer(), $d->pos(), $d->pos() + $length); - $d->skip($length); - $this->addPublicCertificateList()->tryMerge($tmp); - break; - case 16: - $this->setMaxClientCacheTimeInSecond($d->getVarInt64()); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - foreach ($this->public_certificate_list as $value) { - if (!$value->isInitialized()) return 'public_certificate_list'; - } - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - foreach ($x->getPublicCertificateListList() as $v) { - $this->addPublicCertificateList()->copyFrom($v); - } - if ($x->hasMaxClientCacheTimeInSecond()) { - $this->setMaxClientCacheTimeInSecond($x->getMaxClientCacheTimeInSecond()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (sizeof($this->public_certificate_list) !== sizeof($x->public_certificate_list)) return false; - foreach (array_map(null, $this->public_certificate_list, $x->public_certificate_list) as $v) { - if (!$v[0]->equals($v[1])) return false; - } - if (isset($this->max_client_cache_time_in_second) !== isset($x->max_client_cache_time_in_second)) return false; - if (isset($this->max_client_cache_time_in_second) && !$this->integerEquals($this->max_client_cache_time_in_second, $x->max_client_cache_time_in_second)) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - foreach ($this->public_certificate_list as $value) { - $res .= $prefix . "public_certificate_list <\n" . $value->shortDebugString($prefix . " ") . $prefix . ">\n"; - } - if (isset($this->max_client_cache_time_in_second)) { - $res .= $prefix . "max_client_cache_time_in_second: " . $this->debugFormatInt64($this->max_client_cache_time_in_second) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class GetServiceAccountNameRequest extends \google\net\ProtocolMessage { - public function clear() { - } - public function byteSizePartial() { - $res = 0; - return $res; - } - public function outputPartial($out) { - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - } - public function equals($x) { - if ($x === $this) { return true; } - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - return $res; - } - } -} -namespace google\appengine { - class GetServiceAccountNameResponse extends \google\net\ProtocolMessage { - public function getServiceAccountName() { - if (!isset($this->service_account_name)) { - return ''; - } - return $this->service_account_name; - } - public function setServiceAccountName($val) { - $this->service_account_name = $val; - return $this; - } - public function clearServiceAccountName() { - unset($this->service_account_name); - return $this; - } - public function hasServiceAccountName() { - return isset($this->service_account_name); - } - public function clear() { - $this->clearServiceAccountName(); - } - public function byteSizePartial() { - $res = 0; - if (isset($this->service_account_name)) { - $res += 1; - $res += $this->lengthString(strlen($this->service_account_name)); - } - return $res; - } - public function outputPartial($out) { - if (isset($this->service_account_name)) { - $out->putVarInt32(10); - $out->putPrefixedString($this->service_account_name); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->setServiceAccountName(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - if ($x->hasServiceAccountName()) { - $this->setServiceAccountName($x->getServiceAccountName()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (isset($this->service_account_name) !== isset($x->service_account_name)) return false; - if (isset($this->service_account_name) && $this->service_account_name !== $x->service_account_name) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - if (isset($this->service_account_name)) { - $res .= $prefix . "service_account_name: " . $this->debugFormatString($this->service_account_name) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class GetAccessTokenRequest extends \google\net\ProtocolMessage { - private $scope = array(); - public function getScopeSize() { - return sizeof($this->scope); - } - public function getScopeList() { - return $this->scope; - } - public function getScope($idx) { - return $this->scope[$idx]; - } - public function setScope($idx, $val) { - $this->scope[$idx] = $val; - return $this; - } - public function addScope($val) { - $this->scope[] = $val; - return $this; - } - public function clearScope() { - $this->scope = array(); - } - public function getServiceAccountId() { - if (!isset($this->service_account_id)) { - return "0"; - } - return $this->service_account_id; - } - public function setServiceAccountId($val) { - if (is_double($val)) { - $this->service_account_id = sprintf('%0.0F', $val); - } else { - $this->service_account_id = $val; - } - return $this; - } - public function clearServiceAccountId() { - unset($this->service_account_id); - return $this; - } - public function hasServiceAccountId() { - return isset($this->service_account_id); - } - public function getServiceAccountName() { - if (!isset($this->service_account_name)) { - return ''; - } - return $this->service_account_name; - } - public function setServiceAccountName($val) { - $this->service_account_name = $val; - return $this; - } - public function clearServiceAccountName() { - unset($this->service_account_name); - return $this; - } - public function hasServiceAccountName() { - return isset($this->service_account_name); - } - public function clear() { - $this->clearScope(); - $this->clearServiceAccountId(); - $this->clearServiceAccountName(); - } - public function byteSizePartial() { - $res = 0; - $this->checkProtoArray($this->scope); - $res += 1 * sizeof($this->scope); - foreach ($this->scope as $value) { - $res += $this->lengthString(strlen($value)); - } - if (isset($this->service_account_id)) { - $res += 1; - $res += $this->lengthVarInt64($this->service_account_id); - } - if (isset($this->service_account_name)) { - $res += 1; - $res += $this->lengthString(strlen($this->service_account_name)); - } - return $res; - } - public function outputPartial($out) { - $this->checkProtoArray($this->scope); - foreach ($this->scope as $value) { - $out->putVarInt32(10); - $out->putPrefixedString($value); - } - if (isset($this->service_account_id)) { - $out->putVarInt32(16); - $out->putVarInt64($this->service_account_id); - } - if (isset($this->service_account_name)) { - $out->putVarInt32(26); - $out->putPrefixedString($this->service_account_name); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->addScope(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 16: - $this->setServiceAccountId($d->getVarInt64()); - break; - case 26: - $length = $d->getVarInt32(); - $this->setServiceAccountName(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - foreach ($x->getScopeList() as $v) { - $this->addScope($v); - } - if ($x->hasServiceAccountId()) { - $this->setServiceAccountId($x->getServiceAccountId()); - } - if ($x->hasServiceAccountName()) { - $this->setServiceAccountName($x->getServiceAccountName()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (sizeof($this->scope) !== sizeof($x->scope)) return false; - foreach (array_map(null, $this->scope, $x->scope) as $v) { - if ($v[0] !== $v[1]) return false; - } - if (isset($this->service_account_id) !== isset($x->service_account_id)) return false; - if (isset($this->service_account_id) && !$this->integerEquals($this->service_account_id, $x->service_account_id)) return false; - if (isset($this->service_account_name) !== isset($x->service_account_name)) return false; - if (isset($this->service_account_name) && $this->service_account_name !== $x->service_account_name) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - foreach ($this->scope as $value) { - $res .= $prefix . "scope: " . $this->debugFormatString($value) . "\n"; - } - if (isset($this->service_account_id)) { - $res .= $prefix . "service_account_id: " . $this->debugFormatInt64($this->service_account_id) . "\n"; - } - if (isset($this->service_account_name)) { - $res .= $prefix . "service_account_name: " . $this->debugFormatString($this->service_account_name) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class GetAccessTokenResponse extends \google\net\ProtocolMessage { - public function getAccessToken() { - if (!isset($this->access_token)) { - return ''; - } - return $this->access_token; - } - public function setAccessToken($val) { - $this->access_token = $val; - return $this; - } - public function clearAccessToken() { - unset($this->access_token); - return $this; - } - public function hasAccessToken() { - return isset($this->access_token); - } - public function getExpirationTime() { - if (!isset($this->expiration_time)) { - return "0"; - } - return $this->expiration_time; - } - public function setExpirationTime($val) { - if (is_double($val)) { - $this->expiration_time = sprintf('%0.0F', $val); - } else { - $this->expiration_time = $val; - } - return $this; - } - public function clearExpirationTime() { - unset($this->expiration_time); - return $this; - } - public function hasExpirationTime() { - return isset($this->expiration_time); - } - public function clear() { - $this->clearAccessToken(); - $this->clearExpirationTime(); - } - public function byteSizePartial() { - $res = 0; - if (isset($this->access_token)) { - $res += 1; - $res += $this->lengthString(strlen($this->access_token)); - } - if (isset($this->expiration_time)) { - $res += 1; - $res += $this->lengthVarInt64($this->expiration_time); - } - return $res; - } - public function outputPartial($out) { - if (isset($this->access_token)) { - $out->putVarInt32(10); - $out->putPrefixedString($this->access_token); - } - if (isset($this->expiration_time)) { - $out->putVarInt32(16); - $out->putVarInt64($this->expiration_time); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->setAccessToken(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 16: - $this->setExpirationTime($d->getVarInt64()); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - if ($x->hasAccessToken()) { - $this->setAccessToken($x->getAccessToken()); - } - if ($x->hasExpirationTime()) { - $this->setExpirationTime($x->getExpirationTime()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (isset($this->access_token) !== isset($x->access_token)) return false; - if (isset($this->access_token) && $this->access_token !== $x->access_token) return false; - if (isset($this->expiration_time) !== isset($x->expiration_time)) return false; - if (isset($this->expiration_time) && !$this->integerEquals($this->expiration_time, $x->expiration_time)) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - if (isset($this->access_token)) { - $res .= $prefix . "access_token: " . $this->debugFormatString($this->access_token) . "\n"; - } - if (isset($this->expiration_time)) { - $res .= $prefix . "expiration_time: " . $this->debugFormatInt64($this->expiration_time) . "\n"; - } - return $res; - } - } -} -namespace google\appengine { - class GetDefaultGcsBucketNameRequest extends \google\net\ProtocolMessage { - public function clear() { - } - public function byteSizePartial() { - $res = 0; - return $res; - } - public function outputPartial($out) { - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - } - public function equals($x) { - if ($x === $this) { return true; } - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - return $res; - } - } -} -namespace google\appengine { - class GetDefaultGcsBucketNameResponse extends \google\net\ProtocolMessage { - public function getDefaultGcsBucketName() { - if (!isset($this->default_gcs_bucket_name)) { - return ''; - } - return $this->default_gcs_bucket_name; - } - public function setDefaultGcsBucketName($val) { - $this->default_gcs_bucket_name = $val; - return $this; - } - public function clearDefaultGcsBucketName() { - unset($this->default_gcs_bucket_name); - return $this; - } - public function hasDefaultGcsBucketName() { - return isset($this->default_gcs_bucket_name); - } - public function clear() { - $this->clearDefaultGcsBucketName(); - } - public function byteSizePartial() { - $res = 0; - if (isset($this->default_gcs_bucket_name)) { - $res += 1; - $res += $this->lengthString(strlen($this->default_gcs_bucket_name)); - } - return $res; - } - public function outputPartial($out) { - if (isset($this->default_gcs_bucket_name)) { - $out->putVarInt32(10); - $out->putPrefixedString($this->default_gcs_bucket_name); - } - } - public function tryMerge($d) { - while($d->avail() > 0) { - $tt = $d->getVarInt32(); - switch ($tt) { - case 10: - $length = $d->getVarInt32(); - $this->setDefaultGcsBucketName(substr($d->buffer(), $d->pos(), $length)); - $d->skip($length); - break; - case 0: - throw new \google\net\ProtocolBufferDecodeError(); - break; - default: - $d->skipData($tt); - } - }; - } - public function checkInitialized() { - return null; - } - public function mergeFrom($x) { - if ($x === $this) { throw new \IllegalArgumentException('Cannot copy message to itself'); } - if ($x->hasDefaultGcsBucketName()) { - $this->setDefaultGcsBucketName($x->getDefaultGcsBucketName()); - } - } - public function equals($x) { - if ($x === $this) { return true; } - if (isset($this->default_gcs_bucket_name) !== isset($x->default_gcs_bucket_name)) return false; - if (isset($this->default_gcs_bucket_name) && $this->default_gcs_bucket_name !== $x->default_gcs_bucket_name) return false; - return true; - } - public function shortDebugString($prefix = "") { - $res = ''; - if (isset($this->default_gcs_bucket_name)) { - $res .= $prefix . "default_gcs_bucket_name: " . $this->debugFormatString($this->default_gcs_bucket_name) . "\n"; - } - return $res; - } - } -} From 386804136291bcd61ed7f0163a32e74760a88f06 Mon Sep 17 00:00:00 2001 From: Zachary Luna Date: Tue, 4 May 2021 15:19:31 -0700 Subject: [PATCH 10/10] nit change --- composer.json | 1 - src/Testing/ApiCallArguments.php | 1 - tests/Api/AppIdentity/AppIdentityServiceTest.php | 2 -- 3 files changed, 4 deletions(-) diff --git a/composer.json b/composer.json index 4d120544..1fd79c59 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,6 @@ "src/Api/api_base_pb.php", "src/Api/Memcache/memcache_service_pb.php", "src/Api/Urlfetch/urlfetch_service_pb.php", - "src/Api/AppIdentity/app_identity_service_pb.php", "src/Datastore/action_pb.php", "src/Datastore/datastore_v3_pb.php", "src/Datastore/datastore_v4_pb.php", diff --git a/src/Testing/ApiCallArguments.php b/src/Testing/ApiCallArguments.php index 6f385660..8b481018 100644 --- a/src/Testing/ApiCallArguments.php +++ b/src/Testing/ApiCallArguments.php @@ -31,7 +31,6 @@ public function isInputEqual($other) { return $this->package === $other->package && $this->call_name === $other->call_name - && $this->equals($this->req,$other->req); } diff --git a/tests/Api/AppIdentity/AppIdentityServiceTest.php b/tests/Api/AppIdentity/AppIdentityServiceTest.php index 8cc7f1b5..c3715d6d 100644 --- a/tests/Api/AppIdentity/AppIdentityServiceTest.php +++ b/tests/Api/AppIdentity/AppIdentityServiceTest.php @@ -137,7 +137,6 @@ public function testGetPublicCertificates() { } public function testGetServiceAccountName() { - $req = new \Google\AppEngine\Api\AppIdentity\GetServiceAccountNameRequest(); $service_account_result = 'foobar@gserviceaccount.google.com'; @@ -335,7 +334,6 @@ private function expectMemcacheGetRequest($scopes) { public function testGetAccessTokenInvalidScopeArray() { $scopes = ['foo', 1]; - self::expectMemcacheGetRequest($scopes); $this->expectException('\InvalidArgumentException'); $sign_result = AppIdentityService::getAccessToken($scopes);