From a60dd3b7d5a355521e2641efe07aae55e3336a38 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 17:53:18 -0700 Subject: [PATCH 1/4] Added proto files --- src/php/tests/generated_code/math.proto | 80 ++++++++++++++ src/php/tests/interop/empty.proto | 43 ++++++++ src/php/tests/interop/messages.proto | 132 ++++++++++++++++++++++++ src/php/tests/interop/test.proto | 72 +++++++++++++ 4 files changed, 327 insertions(+) create mode 100644 src/php/tests/generated_code/math.proto create mode 100644 src/php/tests/interop/empty.proto create mode 100644 src/php/tests/interop/messages.proto create mode 100644 src/php/tests/interop/test.proto diff --git a/src/php/tests/generated_code/math.proto b/src/php/tests/generated_code/math.proto new file mode 100644 index 00000000000..e34ad5e9672 --- /dev/null +++ b/src/php/tests/generated_code/math.proto @@ -0,0 +1,80 @@ + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package math; + +message DivArgs { + optional int64 dividend = 1; + optional int64 divisor = 2; +} + +message DivReply { + optional int64 quotient = 1; + optional int64 remainder = 2; +} + +message FibArgs { + optional int64 limit = 1; +} + +message Num { + optional int64 num = 1; +} + +message FibReply { + optional int64 count = 1; +} + +service Math { + // Div divides args.dividend by args.divisor and returns the quotient and + // remainder. + rpc Div (DivArgs) returns (DivReply) { + } + + // DivMany accepts an arbitrary number of division args from the client stream + // and sends back the results in the reply stream. The stream continues until + // the client closes its end; the server does the same after sending all the + // replies. The stream ends immediately if either end aborts. + rpc DivMany (stream DivArgs) returns (stream DivReply) { + } + + // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + // generates up to limit numbers; otherwise it continues until the call is + // canceled. Unlike Fib above, Fib has no final FibReply. + rpc Fib (FibArgs) returns (stream Num) { + } + + // Sum sums a stream of numbers, returning the final result once the stream + // is closed. + rpc Sum (stream Num) returns (Num) { + } +} diff --git a/src/php/tests/interop/empty.proto b/src/php/tests/interop/empty.proto new file mode 100644 index 00000000000..4295a0a960c --- /dev/null +++ b/src/php/tests/interop/empty.proto @@ -0,0 +1,43 @@ + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; + +package grpc.testing; + +// An empty message that you can re-use to avoid defining duplicated empty +// messages in your project. A typical example is to use it as argument or the +// return value of a service API. For instance: +// +// service Foo { +// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; +// }; +// +message Empty {} diff --git a/src/php/tests/interop/messages.proto b/src/php/tests/interop/messages.proto new file mode 100644 index 00000000000..de0b1a23205 --- /dev/null +++ b/src/php/tests/interop/messages.proto @@ -0,0 +1,132 @@ + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Message definitions to be used by integration test service definitions. + +syntax = "proto2"; + +package grpc.testing; + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; + + // Uncompressable binary format. + UNCOMPRESSABLE = 1; + + // Randomly chosen from all other formats defined in this enum. + RANDOM = 2; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + optional PayloadType type = 1 [default = COMPRESSABLE]; + // Primary contents of payload. + optional bytes body = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + optional PayloadType response_type = 1 [default = COMPRESSABLE]; + + // Desired payload size in the response from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 response_size = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; + + // Whether SimpleResponse should include username. + optional bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + optional bool fill_oauth_scope = 5; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + optional Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + optional string username = 2; + // OAuth scope. + optional string oauth_scope = 3; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + optional Payload payload = 1; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + optional int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + optional int32 interval_us = 2; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + optional PayloadType response_type = 1 [default = COMPRESSABLE]; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + optional Payload payload = 1; +} diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto new file mode 100644 index 00000000000..927a3a83aa2 --- /dev/null +++ b/src/php/tests/interop/test.proto @@ -0,0 +1,72 @@ + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto2"; + +import "empty.proto"; +import "messages.proto"; + +package grpc.testing; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); + + // One request followed by one response. + // TODO(Issue 527): Describe required server behavior. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. + rpc StreamingOutputCall(StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. + rpc StreamingInputCall(stream StreamingInputCallRequest) + returns (StreamingInputCallResponse); + + // A sequence of requests with each request served by the server immediately. + // As one request could lead to multiple responses, this interface + // demonstrates the idea of full duplexing. + rpc FullDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by a sequence of responses. + // The server buffers all the client requests and then serves them in order. A + // stream of responses are returned to the client when the server starts with + // first request. + rpc HalfDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); +} From 65dda6ca3129613eb1be819cc735617144f5ccf5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 18:04:14 -0700 Subject: [PATCH 2/4] Updated generated code to match protos --- src/php/tests/generated_code/math.php | 106 +++++++-------- src/php/tests/interop/empty.php | 5 +- src/php/tests/interop/empty.proto | 4 +- src/php/tests/interop/messages.php | 181 +++++++++++++------------- src/php/tests/interop/test.php | 4 +- src/php/tests/interop/test.proto | 2 +- 6 files changed, 154 insertions(+), 148 deletions(-) diff --git a/src/php/tests/generated_code/math.php b/src/php/tests/generated_code/math.php index e97a5cf97eb..875f719e9ed 100755 --- a/src/php/tests/generated_code/math.php +++ b/src/php/tests/generated_code/math.php @@ -1,7 +1,7 @@ number = 1; $f->name = "dividend"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); - // REQUIRED INT64 divisor = 2 + // OPTIONAL INT64 divisor = 2 $f = new \DrSlump\Protobuf\Field(); $f->number = 2; $f->name = "divisor"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -52,7 +52,7 @@ namespace math { public function hasDividend(){ return $this->_has(1); } - + /** * Clear value * @@ -61,7 +61,7 @@ namespace math { public function clearDividend(){ return $this->_clear(1); } - + /** * Get value * @@ -70,7 +70,7 @@ namespace math { public function getDividend(){ return $this->_get(1); } - + /** * Set value * @@ -80,7 +80,7 @@ namespace math { public function setDividend( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -89,7 +89,7 @@ namespace math { public function hasDivisor(){ return $this->_has(2); } - + /** * Clear value * @@ -98,7 +98,7 @@ namespace math { public function clearDivisor(){ return $this->_clear(2); } - + /** * Get value * @@ -107,7 +107,7 @@ namespace math { public function getDivisor(){ return $this->_get(2); } - + /** * Set value * @@ -126,10 +126,10 @@ namespace math { /** @var int */ public $quotient = null; - + /** @var int */ public $remainder = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -138,20 +138,20 @@ namespace math { { $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.DivReply'); - // REQUIRED INT64 quotient = 1 + // OPTIONAL INT64 quotient = 1 $f = new \DrSlump\Protobuf\Field(); $f->number = 1; $f->name = "quotient"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); - // REQUIRED INT64 remainder = 2 + // OPTIONAL INT64 remainder = 2 $f = new \DrSlump\Protobuf\Field(); $f->number = 2; $f->name = "remainder"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -169,7 +169,7 @@ namespace math { public function hasQuotient(){ return $this->_has(1); } - + /** * Clear value * @@ -178,7 +178,7 @@ namespace math { public function clearQuotient(){ return $this->_clear(1); } - + /** * Get value * @@ -187,7 +187,7 @@ namespace math { public function getQuotient(){ return $this->_get(1); } - + /** * Set value * @@ -197,7 +197,7 @@ namespace math { public function setQuotient( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -206,7 +206,7 @@ namespace math { public function hasRemainder(){ return $this->_has(2); } - + /** * Clear value * @@ -215,7 +215,7 @@ namespace math { public function clearRemainder(){ return $this->_clear(2); } - + /** * Get value * @@ -224,7 +224,7 @@ namespace math { public function getRemainder(){ return $this->_get(2); } - + /** * Set value * @@ -243,7 +243,7 @@ namespace math { /** @var int */ public $limit = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -275,7 +275,7 @@ namespace math { public function hasLimit(){ return $this->_has(1); } - + /** * Clear value * @@ -284,7 +284,7 @@ namespace math { public function clearLimit(){ return $this->_clear(1); } - + /** * Get value * @@ -293,7 +293,7 @@ namespace math { public function getLimit(){ return $this->_get(1); } - + /** * Set value * @@ -312,7 +312,7 @@ namespace math { /** @var int */ public $num = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -321,12 +321,12 @@ namespace math { { $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.Num'); - // REQUIRED INT64 num = 1 + // OPTIONAL INT64 num = 1 $f = new \DrSlump\Protobuf\Field(); $f->number = 1; $f->name = "num"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -344,7 +344,7 @@ namespace math { public function hasNum(){ return $this->_has(1); } - + /** * Clear value * @@ -353,7 +353,7 @@ namespace math { public function clearNum(){ return $this->_clear(1); } - + /** * Get value * @@ -362,7 +362,7 @@ namespace math { public function getNum(){ return $this->_get(1); } - + /** * Set value * @@ -381,7 +381,7 @@ namespace math { /** @var int */ public $count = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -390,12 +390,12 @@ namespace math { { $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.FibReply'); - // REQUIRED INT64 count = 1 + // OPTIONAL INT64 count = 1 $f = new \DrSlump\Protobuf\Field(); $f->number = 1; $f->name = "count"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -413,7 +413,7 @@ namespace math { public function hasCount(){ return $this->_has(1); } - + /** * Clear value * @@ -422,7 +422,7 @@ namespace math { public function clearCount(){ return $this->_clear(1); } - + /** * Get value * @@ -431,7 +431,7 @@ namespace math { public function getCount(){ return $this->_get(1); } - + /** * Set value * @@ -446,34 +446,36 @@ namespace math { namespace math { - class MathClient extends \Grpc\BaseStub { + class MathClient{ + + private $rpc_impl; + + public function __construct($rpc_impl) { + $this->rpc_impl = $rpc_impl; + } /** * @param math\DivArgs $input - * @return math\DivReply */ public function Div(\math\DivArgs $argument, $metadata = array()) { - return $this->_simpleRequest('/Math/Div', $argument, '\math\DivReply::deserialize', $metadata); + return $this->rpc_impl->_simpleRequest('/math.Math/Div', $argument, '\math\DivReply::deserialize', $metadata); } /** * @param math\DivArgs $input - * @return math\DivReply */ public function DivMany($metadata = array()) { - return $this->_bidiRequest('/Math/DivMany', '\math\DivReply::deserialize', $metadata); + return $this->rpc_impl->_bidiRequest('/math.Math/DivMany', '\math\DivReply::deserialize', $metadata); } /** * @param math\FibArgs $input - * @return math\Num */ public function Fib($argument, $metadata = array()) { - return $this->_serverStreamRequest('/Math/Fib', $argument, '\math\Num::deserialize', $metadata); + return $this->rpc_impl->_serverStreamRequest('/math.Math/Fib', $argument, '\math\Num::deserialize', $metadata); } /** * @param math\Num $input - * @return math\Num */ public function Sum($arguments, $metadata = array()) { - return $this->_clientStreamRequest('/Math/Sum', $arguments, '\math\Num::deserialize', $metadata); + return $this->rpc_impl->_clientStreamRequest('/math.Math/Sum', $arguments, '\math\Num::deserialize', $metadata); } } } diff --git a/src/php/tests/interop/empty.php b/src/php/tests/interop/empty.php index 22b11803b67..0004e309531 100755 --- a/src/php/tests/interop/empty.php +++ b/src/php/tests/interop/empty.php @@ -1,7 +1,7 @@ type = \DrSlump\Protobuf::TYPE_ENUM; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->reference = '\grpc\testing\PayloadType'; + $f->default = \grpc\testing\PayloadType::COMPRESSABLE; $descriptor->addField($f); // OPTIONAL BYTES body = 2 @@ -61,7 +62,7 @@ namespace grpc\testing { public function hasType(){ return $this->_has(1); } - + /** * Clear value * @@ -70,7 +71,7 @@ namespace grpc\testing { public function clearType(){ return $this->_clear(1); } - + /** * Get value * @@ -79,7 +80,7 @@ namespace grpc\testing { public function getType(){ return $this->_get(1); } - + /** * Set value * @@ -89,7 +90,7 @@ namespace grpc\testing { public function setType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -98,7 +99,7 @@ namespace grpc\testing { public function hasBody(){ return $this->_has(2); } - + /** * Clear value * @@ -107,7 +108,7 @@ namespace grpc\testing { public function clearBody(){ return $this->_clear(2); } - + /** * Get value * @@ -116,7 +117,7 @@ namespace grpc\testing { public function getBody(){ return $this->_get(2); } - + /** * Set value * @@ -134,20 +135,20 @@ namespace grpc\testing { class SimpleRequest extends \DrSlump\Protobuf\Message { /** @var int - \grpc\testing\PayloadType */ - public $response_type = null; - + public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; + /** @var int */ public $response_size = null; - + /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var boolean */ public $fill_username = null; - + /** @var boolean */ public $fill_oauth_scope = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -163,6 +164,7 @@ namespace grpc\testing { $f->type = \DrSlump\Protobuf::TYPE_ENUM; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->reference = '\grpc\testing\PayloadType'; + $f->default = \grpc\testing\PayloadType::COMPRESSABLE; $descriptor->addField($f); // OPTIONAL INT32 response_size = 2 @@ -213,7 +215,7 @@ namespace grpc\testing { public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -222,7 +224,7 @@ namespace grpc\testing { public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -231,7 +233,7 @@ namespace grpc\testing { public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -241,7 +243,7 @@ namespace grpc\testing { public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -250,7 +252,7 @@ namespace grpc\testing { public function hasResponseSize(){ return $this->_has(2); } - + /** * Clear value * @@ -259,7 +261,7 @@ namespace grpc\testing { public function clearResponseSize(){ return $this->_clear(2); } - + /** * Get value * @@ -268,7 +270,7 @@ namespace grpc\testing { public function getResponseSize(){ return $this->_get(2); } - + /** * Set value * @@ -278,7 +280,7 @@ namespace grpc\testing { public function setResponseSize( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -287,7 +289,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -296,7 +298,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -305,7 +307,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -315,7 +317,7 @@ namespace grpc\testing { public function setPayload(\grpc\testing\Payload $value){ return $this->_set(3, $value); } - + /** * Check if has a value * @@ -324,7 +326,7 @@ namespace grpc\testing { public function hasFillUsername(){ return $this->_has(4); } - + /** * Clear value * @@ -333,7 +335,7 @@ namespace grpc\testing { public function clearFillUsername(){ return $this->_clear(4); } - + /** * Get value * @@ -342,7 +344,7 @@ namespace grpc\testing { public function getFillUsername(){ return $this->_get(4); } - + /** * Set value * @@ -352,7 +354,7 @@ namespace grpc\testing { public function setFillUsername( $value){ return $this->_set(4, $value); } - + /** * Check if has a value * @@ -361,7 +363,7 @@ namespace grpc\testing { public function hasFillOauthScope(){ return $this->_has(5); } - + /** * Clear value * @@ -370,7 +372,7 @@ namespace grpc\testing { public function clearFillOauthScope(){ return $this->_clear(5); } - + /** * Get value * @@ -379,7 +381,7 @@ namespace grpc\testing { public function getFillOauthScope(){ return $this->_get(5); } - + /** * Set value * @@ -398,13 +400,13 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var string */ public $username = null; - + /** @var string */ public $oauth_scope = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -453,7 +455,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -462,7 +464,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -471,7 +473,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -481,7 +483,7 @@ namespace grpc\testing { public function setPayload(\grpc\testing\Payload $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -490,7 +492,7 @@ namespace grpc\testing { public function hasUsername(){ return $this->_has(2); } - + /** * Clear value * @@ -499,7 +501,7 @@ namespace grpc\testing { public function clearUsername(){ return $this->_clear(2); } - + /** * Get value * @@ -508,7 +510,7 @@ namespace grpc\testing { public function getUsername(){ return $this->_get(2); } - + /** * Set value * @@ -518,7 +520,7 @@ namespace grpc\testing { public function setUsername( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -527,7 +529,7 @@ namespace grpc\testing { public function hasOauthScope(){ return $this->_has(3); } - + /** * Clear value * @@ -536,7 +538,7 @@ namespace grpc\testing { public function clearOauthScope(){ return $this->_clear(3); } - + /** * Get value * @@ -545,7 +547,7 @@ namespace grpc\testing { public function getOauthScope(){ return $this->_get(3); } - + /** * Set value * @@ -564,7 +566,7 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -597,7 +599,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -606,7 +608,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -615,7 +617,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -634,7 +636,7 @@ namespace grpc\testing { /** @var int */ public $aggregated_payload_size = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -666,7 +668,7 @@ namespace grpc\testing { public function hasAggregatedPayloadSize(){ return $this->_has(1); } - + /** * Clear value * @@ -675,7 +677,7 @@ namespace grpc\testing { public function clearAggregatedPayloadSize(){ return $this->_clear(1); } - + /** * Get value * @@ -684,7 +686,7 @@ namespace grpc\testing { public function getAggregatedPayloadSize(){ return $this->_get(1); } - + /** * Set value * @@ -703,10 +705,10 @@ namespace grpc\testing { /** @var int */ public $size = null; - + /** @var int */ public $interval_us = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -746,7 +748,7 @@ namespace grpc\testing { public function hasSize(){ return $this->_has(1); } - + /** * Clear value * @@ -755,7 +757,7 @@ namespace grpc\testing { public function clearSize(){ return $this->_clear(1); } - + /** * Get value * @@ -764,7 +766,7 @@ namespace grpc\testing { public function getSize(){ return $this->_get(1); } - + /** * Set value * @@ -774,7 +776,7 @@ namespace grpc\testing { public function setSize( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -783,7 +785,7 @@ namespace grpc\testing { public function hasIntervalUs(){ return $this->_has(2); } - + /** * Clear value * @@ -792,7 +794,7 @@ namespace grpc\testing { public function clearIntervalUs(){ return $this->_clear(2); } - + /** * Get value * @@ -801,7 +803,7 @@ namespace grpc\testing { public function getIntervalUs(){ return $this->_get(2); } - + /** * Set value * @@ -819,14 +821,14 @@ namespace grpc\testing { class StreamingOutputCallRequest extends \DrSlump\Protobuf\Message { /** @var int - \grpc\testing\PayloadType */ - public $response_type = null; - + public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; + /** @var \grpc\testing\ResponseParameters[] */ public $response_parameters = array(); - + /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -842,6 +844,7 @@ namespace grpc\testing { $f->type = \DrSlump\Protobuf::TYPE_ENUM; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->reference = '\grpc\testing\PayloadType'; + $f->default = \grpc\testing\PayloadType::COMPRESSABLE; $descriptor->addField($f); // REPEATED MESSAGE response_parameters = 2 @@ -877,7 +880,7 @@ namespace grpc\testing { public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -886,7 +889,7 @@ namespace grpc\testing { public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -895,7 +898,7 @@ namespace grpc\testing { public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -905,7 +908,7 @@ namespace grpc\testing { public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -914,7 +917,7 @@ namespace grpc\testing { public function hasResponseParameters(){ return $this->_has(2); } - + /** * Clear value * @@ -923,7 +926,7 @@ namespace grpc\testing { public function clearResponseParameters(){ return $this->_clear(2); } - + /** * Get value * @@ -933,7 +936,7 @@ namespace grpc\testing { public function getResponseParameters($idx = NULL){ return $this->_get(2, $idx); } - + /** * Set value * @@ -943,7 +946,7 @@ namespace grpc\testing { public function setResponseParameters(\grpc\testing\ResponseParameters $value, $idx = NULL){ return $this->_set(2, $value, $idx); } - + /** * Get all elements of * @@ -952,7 +955,7 @@ namespace grpc\testing { public function getResponseParametersList(){ return $this->_get(2); } - + /** * Add a new element to * @@ -962,7 +965,7 @@ namespace grpc\testing { public function addResponseParameters(\grpc\testing\ResponseParameters $value){ return $this->_add(2, $value); } - + /** * Check if has a value * @@ -971,7 +974,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -980,7 +983,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -989,7 +992,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -1008,7 +1011,7 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -1041,7 +1044,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -1050,7 +1053,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -1059,7 +1062,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * diff --git a/src/php/tests/interop/test.php b/src/php/tests/interop/test.php index 014bbc9517a..8a6cf768574 100755 --- a/src/php/tests/interop/test.php +++ b/src/php/tests/interop/test.php @@ -1,7 +1,7 @@ Date: Tue, 31 Mar 2015 18:17:36 -0700 Subject: [PATCH 3/4] Removed generated code files --- src/php/tests/generated_code/math.php | 481 ----------- src/php/tests/interop/empty.php | 26 - src/php/tests/interop/message_set.php | 26 - src/php/tests/interop/messages.php | 1077 ------------------------- src/php/tests/interop/test.php | 52 -- 5 files changed, 1662 deletions(-) delete mode 100755 src/php/tests/generated_code/math.php delete mode 100755 src/php/tests/interop/empty.php delete mode 100755 src/php/tests/interop/message_set.php delete mode 100755 src/php/tests/interop/messages.php delete mode 100755 src/php/tests/interop/test.php diff --git a/src/php/tests/generated_code/math.php b/src/php/tests/generated_code/math.php deleted file mode 100755 index 875f719e9ed..00000000000 --- a/src/php/tests/generated_code/math.php +++ /dev/null @@ -1,481 +0,0 @@ -number = 1; - $f->name = "dividend"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL INT64 divisor = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "divisor"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasDividend(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\DivArgs - */ - public function clearDividend(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getDividend(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivArgs - */ - public function setDividend( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasDivisor(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \math\DivArgs - */ - public function clearDivisor(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getDivisor(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivArgs - */ - public function setDivisor( $value){ - return $this->_set(2, $value); - } - } -} - -namespace math { - - class DivReply extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $quotient = null; - - /** @var int */ - public $remainder = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.DivReply'); - - // OPTIONAL INT64 quotient = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "quotient"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL INT64 remainder = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "remainder"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasQuotient(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\DivReply - */ - public function clearQuotient(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getQuotient(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivReply - */ - public function setQuotient( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasRemainder(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \math\DivReply - */ - public function clearRemainder(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getRemainder(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivReply - */ - public function setRemainder( $value){ - return $this->_set(2, $value); - } - } -} - -namespace math { - - class FibArgs extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $limit = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.FibArgs'); - - // OPTIONAL INT64 limit = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "limit"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasLimit(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\FibArgs - */ - public function clearLimit(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getLimit(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\FibArgs - */ - public function setLimit( $value){ - return $this->_set(1, $value); - } - } -} - -namespace math { - - class Num extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $num = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.Num'); - - // OPTIONAL INT64 num = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "num"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasNum(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\Num - */ - public function clearNum(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getNum(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\Num - */ - public function setNum( $value){ - return $this->_set(1, $value); - } - } -} - -namespace math { - - class FibReply extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $count = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.FibReply'); - - // OPTIONAL INT64 count = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "count"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasCount(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\FibReply - */ - public function clearCount(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getCount(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\FibReply - */ - public function setCount( $value){ - return $this->_set(1, $value); - } - } -} - -namespace math { - - class MathClient{ - - private $rpc_impl; - - public function __construct($rpc_impl) { - $this->rpc_impl = $rpc_impl; - } - /** - * @param math\DivArgs $input - */ - public function Div(\math\DivArgs $argument, $metadata = array()) { - return $this->rpc_impl->_simpleRequest('/math.Math/Div', $argument, '\math\DivReply::deserialize', $metadata); - } - /** - * @param math\DivArgs $input - */ - public function DivMany($metadata = array()) { - return $this->rpc_impl->_bidiRequest('/math.Math/DivMany', '\math\DivReply::deserialize', $metadata); - } - /** - * @param math\FibArgs $input - */ - public function Fib($argument, $metadata = array()) { - return $this->rpc_impl->_serverStreamRequest('/math.Math/Fib', $argument, '\math\Num::deserialize', $metadata); - } - /** - * @param math\Num $input - */ - public function Sum($arguments, $metadata = array()) { - return $this->rpc_impl->_clientStreamRequest('/math.Math/Sum', $arguments, '\math\Num::deserialize', $metadata); - } - } -} diff --git a/src/php/tests/interop/empty.php b/src/php/tests/interop/empty.php deleted file mode 100755 index 0004e309531..00000000000 --- a/src/php/tests/interop/empty.php +++ /dev/null @@ -1,26 +0,0 @@ -addField($cb(), true); - } - - return $descriptor; - } - } -} - diff --git a/src/php/tests/interop/message_set.php b/src/php/tests/interop/message_set.php deleted file mode 100755 index c35c6d74b24..00000000000 --- a/src/php/tests/interop/message_set.php +++ /dev/null @@ -1,26 +0,0 @@ -addField($cb(), true); - } - - return $descriptor; - } - } -} - diff --git a/src/php/tests/interop/messages.php b/src/php/tests/interop/messages.php deleted file mode 100755 index 5a3dff2c59c..00000000000 --- a/src/php/tests/interop/messages.php +++ /dev/null @@ -1,1077 +0,0 @@ -number = 1; - $f->name = "type"; - $f->type = \DrSlump\Protobuf::TYPE_ENUM; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\PayloadType'; - $f->default = \grpc\testing\PayloadType::COMPRESSABLE; - $descriptor->addField($f); - - // OPTIONAL BYTES body = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "body"; - $f->type = \DrSlump\Protobuf::TYPE_BYTES; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasType(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\Payload - */ - public function clearType(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - \grpc\testing\PayloadType - */ - public function getType(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int - \grpc\testing\PayloadType $value - * @return \grpc\testing\Payload - */ - public function setType( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasBody(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\Payload - */ - public function clearBody(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return string - */ - public function getBody(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param string $value - * @return \grpc\testing\Payload - */ - public function setBody( $value){ - return $this->_set(2, $value); - } - } -} - -namespace grpc\testing { - - class SimpleRequest extends \DrSlump\Protobuf\Message { - - /** @var int - \grpc\testing\PayloadType */ - public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; - - /** @var int */ - public $response_size = null; - - /** @var \grpc\testing\Payload */ - public $payload = null; - - /** @var boolean */ - public $fill_username = null; - - /** @var boolean */ - public $fill_oauth_scope = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.SimpleRequest'); - - // OPTIONAL ENUM response_type = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "response_type"; - $f->type = \DrSlump\Protobuf::TYPE_ENUM; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\PayloadType'; - $f->default = \grpc\testing\PayloadType::COMPRESSABLE; - $descriptor->addField($f); - - // OPTIONAL INT32 response_size = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "response_size"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL MESSAGE payload = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - // OPTIONAL BOOL fill_username = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "fill_username"; - $f->type = \DrSlump\Protobuf::TYPE_BOOL; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL BOOL fill_oauth_scope = 5 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 5; - $f->name = "fill_oauth_scope"; - $f->type = \DrSlump\Protobuf::TYPE_BOOL; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseType(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearResponseType(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - \grpc\testing\PayloadType - */ - public function getResponseType(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int - \grpc\testing\PayloadType $value - * @return \grpc\testing\SimpleRequest - */ - public function setResponseType( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseSize(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearResponseSize(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getResponseSize(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\SimpleRequest - */ - public function setResponseSize( $value){ - return $this->_set(2, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(3); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearPayload(){ - return $this->_clear(3); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(3); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\SimpleRequest - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(3, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasFillUsername(){ - return $this->_has(4); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearFillUsername(){ - return $this->_clear(4); - } - - /** - * Get value - * - * @return boolean - */ - public function getFillUsername(){ - return $this->_get(4); - } - - /** - * Set value - * - * @param boolean $value - * @return \grpc\testing\SimpleRequest - */ - public function setFillUsername( $value){ - return $this->_set(4, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasFillOauthScope(){ - return $this->_has(5); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearFillOauthScope(){ - return $this->_clear(5); - } - - /** - * Get value - * - * @return boolean - */ - public function getFillOauthScope(){ - return $this->_get(5); - } - - /** - * Set value - * - * @param boolean $value - * @return \grpc\testing\SimpleRequest - */ - public function setFillOauthScope( $value){ - return $this->_set(5, $value); - } - } -} - -namespace grpc\testing { - - class SimpleResponse extends \DrSlump\Protobuf\Message { - - /** @var \grpc\testing\Payload */ - public $payload = null; - - /** @var string */ - public $username = null; - - /** @var string */ - public $oauth_scope = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.SimpleResponse'); - - // OPTIONAL MESSAGE payload = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - // OPTIONAL STRING username = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "username"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL STRING oauth_scope = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "oauth_scope"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleResponse - */ - public function clearPayload(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\SimpleResponse - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasUsername(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleResponse - */ - public function clearUsername(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return string - */ - public function getUsername(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param string $value - * @return \grpc\testing\SimpleResponse - */ - public function setUsername( $value){ - return $this->_set(2, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasOauthScope(){ - return $this->_has(3); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleResponse - */ - public function clearOauthScope(){ - return $this->_clear(3); - } - - /** - * Get value - * - * @return string - */ - public function getOauthScope(){ - return $this->_get(3); - } - - /** - * Set value - * - * @param string $value - * @return \grpc\testing\SimpleResponse - */ - public function setOauthScope( $value){ - return $this->_set(3, $value); - } - } -} - -namespace grpc\testing { - - class StreamingInputCallRequest extends \DrSlump\Protobuf\Message { - - /** @var \grpc\testing\Payload */ - public $payload = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingInputCallRequest'); - - // OPTIONAL MESSAGE payload = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingInputCallRequest - */ - public function clearPayload(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\StreamingInputCallRequest - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(1, $value); - } - } -} - -namespace grpc\testing { - - class StreamingInputCallResponse extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $aggregated_payload_size = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingInputCallResponse'); - - // OPTIONAL INT32 aggregated_payload_size = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "aggregated_payload_size"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasAggregatedPayloadSize(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingInputCallResponse - */ - public function clearAggregatedPayloadSize(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getAggregatedPayloadSize(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\StreamingInputCallResponse - */ - public function setAggregatedPayloadSize( $value){ - return $this->_set(1, $value); - } - } -} - -namespace grpc\testing { - - class ResponseParameters extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $size = null; - - /** @var int */ - public $interval_us = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.ResponseParameters'); - - // OPTIONAL INT32 size = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "size"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL INT32 interval_us = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "interval_us"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasSize(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\ResponseParameters - */ - public function clearSize(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getSize(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\ResponseParameters - */ - public function setSize( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasIntervalUs(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\ResponseParameters - */ - public function clearIntervalUs(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getIntervalUs(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\ResponseParameters - */ - public function setIntervalUs( $value){ - return $this->_set(2, $value); - } - } -} - -namespace grpc\testing { - - class StreamingOutputCallRequest extends \DrSlump\Protobuf\Message { - - /** @var int - \grpc\testing\PayloadType */ - public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; - - /** @var \grpc\testing\ResponseParameters[] */ - public $response_parameters = array(); - - /** @var \grpc\testing\Payload */ - public $payload = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingOutputCallRequest'); - - // OPTIONAL ENUM response_type = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "response_type"; - $f->type = \DrSlump\Protobuf::TYPE_ENUM; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\PayloadType'; - $f->default = \grpc\testing\PayloadType::COMPRESSABLE; - $descriptor->addField($f); - - // REPEATED MESSAGE response_parameters = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "response_parameters"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_REPEATED; - $f->reference = '\grpc\testing\ResponseParameters'; - $descriptor->addField($f); - - // OPTIONAL MESSAGE payload = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseType(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function clearResponseType(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - \grpc\testing\PayloadType - */ - public function getResponseType(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int - \grpc\testing\PayloadType $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function setResponseType( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseParameters(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function clearResponseParameters(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @param int $idx - * @return \grpc\testing\ResponseParameters - */ - public function getResponseParameters($idx = NULL){ - return $this->_get(2, $idx); - } - - /** - * Set value - * - * @param \grpc\testing\ResponseParameters $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function setResponseParameters(\grpc\testing\ResponseParameters $value, $idx = NULL){ - return $this->_set(2, $value, $idx); - } - - /** - * Get all elements of - * - * @return \grpc\testing\ResponseParameters[] - */ - public function getResponseParametersList(){ - return $this->_get(2); - } - - /** - * Add a new element to - * - * @param \grpc\testing\ResponseParameters $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function addResponseParameters(\grpc\testing\ResponseParameters $value){ - return $this->_add(2, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(3); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function clearPayload(){ - return $this->_clear(3); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(3); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(3, $value); - } - } -} - -namespace grpc\testing { - - class StreamingOutputCallResponse extends \DrSlump\Protobuf\Message { - - /** @var \grpc\testing\Payload */ - public $payload = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingOutputCallResponse'); - - // OPTIONAL MESSAGE payload = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallResponse - */ - public function clearPayload(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\StreamingOutputCallResponse - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(1, $value); - } - } -} - diff --git a/src/php/tests/interop/test.php b/src/php/tests/interop/test.php deleted file mode 100755 index 8a6cf768574..00000000000 --- a/src/php/tests/interop/test.php +++ /dev/null @@ -1,52 +0,0 @@ -rpc_impl = $rpc_impl; - } - /** - * @param grpc\testing\EmptyMessage $input - */ - public function EmptyCall(\grpc\testing\EmptyMessage $argument, $metadata = array()) { - return $this->rpc_impl->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, '\grpc\testing\EmptyMessage::deserialize', $metadata); - } - /** - * @param grpc\testing\SimpleRequest $input - */ - public function UnaryCall(\grpc\testing\SimpleRequest $argument, $metadata = array()) { - return $this->rpc_impl->_simpleRequest('/grpc.testing.TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingOutputCallRequest $input - */ - public function StreamingOutputCall($argument, $metadata = array()) { - return $this->rpc_impl->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingInputCallRequest $input - */ - public function StreamingInputCall($arguments, $metadata = array()) { - return $this->rpc_impl->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingOutputCallRequest $input - */ - public function FullDuplexCall($metadata = array()) { - return $this->rpc_impl->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingOutputCallRequest $input - */ - public function HalfDuplexCall($metadata = array()) { - return $this->rpc_impl->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); - } - } -} From 081cccc145edafb242575ed7dcda3b9780db1722 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 18:20:04 -0700 Subject: [PATCH 4/4] Re-added overzealously removed file --- src/php/tests/interop/message_set.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 src/php/tests/interop/message_set.php diff --git a/src/php/tests/interop/message_set.php b/src/php/tests/interop/message_set.php new file mode 100755 index 00000000000..c35c6d74b24 --- /dev/null +++ b/src/php/tests/interop/message_set.php @@ -0,0 +1,26 @@ +addField($cb(), true); + } + + return $descriptor; + } + } +} +