diff --git a/src/php/tests/generated_code/GPBMetadata/Math.php b/src/php/tests/generated_code/GPBMetadata/Math.php new file mode 100644 index 00000000000..07c886701b7 --- /dev/null +++ b/src/php/tests/generated_code/GPBMetadata/Math.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile(hex2bin( + "0ae9020a0a6d6174682e70726f746f12046d617468222c0a074469764172" . + "677312100a086469766964656e64180120012803120f0a0764697669736f" . + "72180220012803222f0a084469765265706c7912100a0871756f7469656e" . + "7418012001280312110a0972656d61696e64657218022001280322180a07" . + "46696241726773120d0a056c696d697418012001280322120a034e756d12" . + "0b0a036e756d18012001280322190a084669625265706c79120d0a05636f" . + "756e7418012001280332a4010a044d61746812260a03446976120d2e6d61" . + "74682e446976417267731a0e2e6d6174682e4469765265706c792200122e" . + "0a074469764d616e79120d2e6d6174682e446976417267731a0e2e6d6174" . + "682e4469765265706c7922002801300112230a03466962120d2e6d617468" . + "2e466962417267731a092e6d6174682e4e756d22003001121f0a0353756d" . + "12092e6d6174682e4e756d1a092e6d6174682e4e756d2200280162067072" . + "6f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/generated_code/Math/DivArgs.php b/src/php/tests/generated_code/Math/DivArgs.php new file mode 100644 index 00000000000..21fb1d7252f --- /dev/null +++ b/src/php/tests/generated_code/Math/DivArgs.php @@ -0,0 +1,85 @@ +math.DivArgs + */ +class DivArgs extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 dividend = 1; + */ + protected $dividend = 0; + /** + * Generated from protobuf field int64 divisor = 2; + */ + protected $divisor = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $dividend + * @type int|string $divisor + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 dividend = 1; + * @return int|string + */ + public function getDividend() + { + return $this->dividend; + } + + /** + * Generated from protobuf field int64 dividend = 1; + * @param int|string $var + * @return $this + */ + public function setDividend($var) + { + GPBUtil::checkInt64($var); + $this->dividend = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 divisor = 2; + * @return int|string + */ + public function getDivisor() + { + return $this->divisor; + } + + /** + * Generated from protobuf field int64 divisor = 2; + * @param int|string $var + * @return $this + */ + public function setDivisor($var) + { + GPBUtil::checkInt64($var); + $this->divisor = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/DivReply.php b/src/php/tests/generated_code/Math/DivReply.php new file mode 100644 index 00000000000..c4d7575b209 --- /dev/null +++ b/src/php/tests/generated_code/Math/DivReply.php @@ -0,0 +1,85 @@ +math.DivReply + */ +class DivReply extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 quotient = 1; + */ + protected $quotient = 0; + /** + * Generated from protobuf field int64 remainder = 2; + */ + protected $remainder = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $quotient + * @type int|string $remainder + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 quotient = 1; + * @return int|string + */ + public function getQuotient() + { + return $this->quotient; + } + + /** + * Generated from protobuf field int64 quotient = 1; + * @param int|string $var + * @return $this + */ + public function setQuotient($var) + { + GPBUtil::checkInt64($var); + $this->quotient = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 remainder = 2; + * @return int|string + */ + public function getRemainder() + { + return $this->remainder; + } + + /** + * Generated from protobuf field int64 remainder = 2; + * @param int|string $var + * @return $this + */ + public function setRemainder($var) + { + GPBUtil::checkInt64($var); + $this->remainder = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/FibArgs.php b/src/php/tests/generated_code/Math/FibArgs.php new file mode 100644 index 00000000000..39bb4fad2f9 --- /dev/null +++ b/src/php/tests/generated_code/Math/FibArgs.php @@ -0,0 +1,58 @@ +math.FibArgs + */ +class FibArgs extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 limit = 1; + */ + protected $limit = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $limit + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 limit = 1; + * @return int|string + */ + public function getLimit() + { + return $this->limit; + } + + /** + * Generated from protobuf field int64 limit = 1; + * @param int|string $var + * @return $this + */ + public function setLimit($var) + { + GPBUtil::checkInt64($var); + $this->limit = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/FibReply.php b/src/php/tests/generated_code/Math/FibReply.php new file mode 100644 index 00000000000..d9ad9cd41be --- /dev/null +++ b/src/php/tests/generated_code/Math/FibReply.php @@ -0,0 +1,58 @@ +math.FibReply + */ +class FibReply extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 count = 1; + */ + protected $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $count + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 count = 1; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Generated from protobuf field int64 count = 1; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/MathClient.php b/src/php/tests/generated_code/Math/MathClient.php new file mode 100644 index 00000000000..92c980afe16 --- /dev/null +++ b/src/php/tests/generated_code/Math/MathClient.php @@ -0,0 +1,91 @@ +_simpleRequest('/math.Math/Div', + $argument, + ['\Math\DivReply', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param array $metadata metadata + * @param array $options call options + */ + public function DivMany($metadata = [], $options = []) { + return $this->_bidiRequest('/math.Math/DivMany', + ['\Math\DivReply','decode'], + $metadata, $options); + } + + /** + * Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib + * generates up to limit numbers; otherwise it continues until the call is + * canceled. Unlike Fib above, Fib has no final FibReply. + * @param \Math\FibArgs $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Fib(\Math\FibArgs $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/math.Math/Fib', + $argument, + ['\Math\Num', 'decode'], + $metadata, $options); + } + + /** + * Sum sums a stream of numbers, returning the final result once the stream + * is closed. + * @param array $metadata metadata + * @param array $options call options + */ + public function Sum($metadata = [], $options = []) { + return $this->_clientStreamRequest('/math.Math/Sum', + ['\Math\Num','decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/generated_code/Math/Num.php b/src/php/tests/generated_code/Math/Num.php new file mode 100644 index 00000000000..356b328b2cc --- /dev/null +++ b/src/php/tests/generated_code/Math/Num.php @@ -0,0 +1,58 @@ +math.Num + */ +class Num extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 num = 1; + */ + protected $num = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $num + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 num = 1; + * @return int|string + */ + public function getNum() + { + return $this->num; + } + + /** + * Generated from protobuf field int64 num = 1; + * @param int|string $var + * @return $this + */ + public function setNum($var) + { + GPBUtil::checkInt64($var); + $this->num = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php new file mode 100644 index 00000000000..72c17046a24 --- /dev/null +++ b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php @@ -0,0 +1,86 @@ +internalAddGeneratedFile(hex2bin( + "0ad70e0a257372632f70726f746f2f677270632f74657374696e672f6d65" . + "7373616765732e70726f746f120c677270632e74657374696e67221a0a09" . + "426f6f6c56616c7565120d0a0576616c756518012001280822400a075061" . + "796c6f616412270a047479706518012001280e32192e677270632e746573" . + "74696e672e5061796c6f616454797065120c0a04626f647918022001280c" . + "222b0a0a4563686f537461747573120c0a04636f6465180120012805120f" . + "0a076d6573736167651802200128092286030a0d53696d706c6552657175" . + "65737412300a0d726573706f6e73655f7479706518012001280e32192e67" . + "7270632e74657374696e672e5061796c6f61645479706512150a0d726573" . + "706f6e73655f73697a6518022001280512260a077061796c6f6164180320" . + "01280b32152e677270632e74657374696e672e5061796c6f616412150a0d" . + "66696c6c5f757365726e616d6518042001280812180a1066696c6c5f6f61" . + "7574685f73636f706518052001280812340a13726573706f6e73655f636f" . + "6d7072657373656418062001280b32172e677270632e74657374696e672e" . + "426f6f6c56616c756512310a0f726573706f6e73655f7374617475731807" . + "2001280b32182e677270632e74657374696e672e4563686f537461747573" . + "12320a116578706563745f636f6d7072657373656418082001280b32172e" . + "677270632e74657374696e672e426f6f6c56616c756512160a0e66696c6c" . + "5f7365727665725f6964180920012808121e0a1666696c6c5f677270636c" . + "625f726f7574655f74797065180a2001280822be010a0e53696d706c6552" . + "6573706f6e736512260a077061796c6f616418012001280b32152e677270" . + "632e74657374696e672e5061796c6f616412100a08757365726e616d6518" . + "022001280912130a0b6f617574685f73636f706518032001280912110a09" . + "7365727665725f696418042001280912380a11677270636c625f726f7574" . + "655f7479706518052001280e321d2e677270632e74657374696e672e4772" . + "70636c62526f7574655479706512100a08686f73746e616d651806200128" . + "0922770a1953747265616d696e67496e70757443616c6c52657175657374" . + "12260a077061796c6f616418012001280b32152e677270632e7465737469" . + "6e672e5061796c6f616412320a116578706563745f636f6d707265737365" . + "6418022001280b32172e677270632e74657374696e672e426f6f6c56616c" . + "7565223d0a1a53747265616d696e67496e70757443616c6c526573706f6e" . + "7365121f0a17616767726567617465645f7061796c6f61645f73697a6518" . + "012001280522640a12526573706f6e7365506172616d6574657273120c0a" . + "0473697a6518012001280512130a0b696e74657276616c5f757318022001" . + "2805122b0a0a636f6d7072657373656418032001280b32172e677270632e" . + "74657374696e672e426f6f6c56616c756522e8010a1a53747265616d696e" . + "674f757470757443616c6c5265717565737412300a0d726573706f6e7365" . + "5f7479706518012001280e32192e677270632e74657374696e672e506179" . + "6c6f616454797065123d0a13726573706f6e73655f706172616d65746572" . + "7318022003280b32202e677270632e74657374696e672e526573706f6e73" . + "65506172616d657465727312260a077061796c6f616418032001280b3215" . + "2e677270632e74657374696e672e5061796c6f616412310a0f726573706f" . + "6e73655f73746174757318072001280b32182e677270632e74657374696e" . + "672e4563686f53746174757322450a1b53747265616d696e674f75747075" . + "7443616c6c526573706f6e736512260a077061796c6f616418012001280b" . + "32152e677270632e74657374696e672e5061796c6f616422330a0f526563" . + "6f6e6e656374506172616d7312200a186d61785f7265636f6e6e6563745f" . + "6261636b6f66665f6d7318012001280522330a0d5265636f6e6e65637449" . + "6e666f120e0a0670617373656418012001280812120a0a6261636b6f6666" . + "5f6d7318022003280522410a184c6f616442616c616e6365725374617473" . + "5265717565737412100a086e756d5f7270637318012001280512130a0b74" . + "696d656f75745f73656318022001280522b3010a194c6f616442616c616e" . + "6365725374617473526573706f6e7365124d0a0c727063735f62795f7065" . + "657218012003280b32372e677270632e74657374696e672e4c6f61644261" . + "6c616e6365725374617473526573706f6e73652e52706373427950656572" . + "456e74727912140a0c6e756d5f6661696c757265731802200128051a310a" . + "0f52706373427950656572456e747279120b0a036b657918012001280912" . + "0d0a0576616c75651802200128053a0238012a1f0a0b5061796c6f616454" . + "79706512100a0c434f4d505245535341424c4510002a6f0a0f477270636c" . + "62526f75746554797065121d0a19475250434c425f524f5554455f545950" . + "455f554e4b4e4f574e1000121e0a1a475250434c425f524f5554455f5459" . + "50455f46414c4c4241434b1001121d0a19475250434c425f524f5554455f" . + "545950455f4241434b454e441002620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php new file mode 100644 index 00000000000..6118c2609c0 --- /dev/null +++ b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php @@ -0,0 +1,26 @@ +internalAddGeneratedFile(hex2bin( + "0a4a0a227372632f70726f746f2f677270632f74657374696e672f656d70" . + "74792e70726f746f120c677270632e74657374696e67220e0a0c456d7074" . + "794d657373616765620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php new file mode 100644 index 00000000000..c3063340d00 --- /dev/null +++ b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php @@ -0,0 +1,66 @@ +internalAddGeneratedFile(hex2bin( + "0aca090a217372632f70726f746f2f677270632f74657374696e672f7465" . + "73742e70726f746f120c677270632e74657374696e671a257372632f7072" . + "6f746f2f677270632f74657374696e672f6d657373616765732e70726f74" . + "6f32e7050a0b546573745365727669636512430a09456d70747943616c6c" . + "121a2e677270632e74657374696e672e456d7074794d6573736167651a1a" . + "2e677270632e74657374696e672e456d7074794d65737361676512460a09" . + "556e61727943616c6c121b2e677270632e74657374696e672e53696d706c" . + "65526571756573741a1c2e677270632e74657374696e672e53696d706c65" . + "526573706f6e7365124f0a12436163686561626c65556e61727943616c6c" . + "121b2e677270632e74657374696e672e53696d706c65526571756573741a" . + "1c2e677270632e74657374696e672e53696d706c65526573706f6e736512" . + "6c0a1353747265616d696e674f757470757443616c6c12282e677270632e" . + "74657374696e672e53747265616d696e674f757470757443616c6c526571" . + "756573741a292e677270632e74657374696e672e53747265616d696e674f" . + "757470757443616c6c526573706f6e7365300112690a1253747265616d69" . + "6e67496e70757443616c6c12272e677270632e74657374696e672e537472" . + "65616d696e67496e70757443616c6c526571756573741a282e677270632e" . + "74657374696e672e53747265616d696e67496e70757443616c6c52657370" . + "6f6e7365280112690a0e46756c6c4475706c657843616c6c12282e677270" . + "632e74657374696e672e53747265616d696e674f757470757443616c6c52" . + "6571756573741a292e677270632e74657374696e672e53747265616d696e" . + "674f757470757443616c6c526573706f6e73652801300112690a0e48616c" . + "664475706c657843616c6c12282e677270632e74657374696e672e537472" . + "65616d696e674f757470757443616c6c526571756573741a292e67727063" . + "2e74657374696e672e53747265616d696e674f757470757443616c6c5265" . + "73706f6e736528013001124b0a11556e696d706c656d656e74656443616c" . + "6c121a2e677270632e74657374696e672e456d7074794d6573736167651a" . + "1a2e677270632e74657374696e672e456d7074794d65737361676532630a" . + "14556e696d706c656d656e74656453657276696365124b0a11556e696d70" . + "6c656d656e74656443616c6c121a2e677270632e74657374696e672e456d" . + "7074794d6573736167651a1a2e677270632e74657374696e672e456d7074" . + "794d6573736167653297010a105265636f6e6e6563745365727669636512" . + "420a055374617274121d2e677270632e74657374696e672e5265636f6e6e" . + "656374506172616d731a1a2e677270632e74657374696e672e456d707479" . + "4d657373616765123f0a0453746f70121a2e677270632e74657374696e67" . + "2e456d7074794d6573736167651a1b2e677270632e74657374696e672e52" . + "65636f6e6e656374496e666f327f0a184c6f616442616c616e6365725374" . + "6174735365727669636512630a0e476574436c69656e7453746174731226" . + "2e677270632e74657374696e672e4c6f616442616c616e63657253746174" . + "73526571756573741a272e677270632e74657374696e672e4c6f61644261" . + "6c616e6365725374617473526573706f6e73652200620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/interop/Grpc/Testing/BoolValue.php b/src/php/tests/interop/Grpc/Testing/BoolValue.php new file mode 100644 index 00000000000..a1fd08d674d --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/BoolValue.php @@ -0,0 +1,69 @@ +grpc.testing.BoolValue + */ +class BoolValue extends \Google\Protobuf\Internal\Message +{ + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + */ + protected $value = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $value + * The bool value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + * @return bool + */ + public function getValue() + { + return $this->value; + } + + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + * @param bool $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkBool($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/EchoStatus.php b/src/php/tests/interop/Grpc/Testing/EchoStatus.php new file mode 100644 index 00000000000..31fd6dd8995 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/EchoStatus.php @@ -0,0 +1,88 @@ +grpc.testing.EchoStatus + */ +class EchoStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 code = 1; + */ + protected $code = 0; + /** + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * @type string $message + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Generated from protobuf field int32 code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkInt32($var); + $this->code = $var; + + return $this; + } + + /** + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/EmptyMessage.php b/src/php/tests/interop/Grpc/Testing/EmptyMessage.php new file mode 100644 index 00000000000..66e49ab07d2 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/EmptyMessage.php @@ -0,0 +1,38 @@ +grpc.testing.EmptyMessage + */ +class EmptyMessage extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php b/src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php new file mode 100644 index 00000000000..678b6ca9b22 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php @@ -0,0 +1,38 @@ +grpc.testing.EmptyMessageMessage + */ +class EmptyMessageMessage extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php b/src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php new file mode 100644 index 00000000000..f8bff1cb695 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php @@ -0,0 +1,66 @@ +grpc.testing.GrpclbRouteType + */ +class GrpclbRouteType +{ + /** + * Server didn't detect the route that a client took to reach it. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + */ + const GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + /** + * Indicates that a client reached a server via gRPCLB fallback. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_FALLBACK = 1; + */ + const GRPCLB_ROUTE_TYPE_FALLBACK = 1; + /** + * Indicates that a client reached a server as a gRPCLB-given backend. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_BACKEND = 2; + */ + const GRPCLB_ROUTE_TYPE_BACKEND = 2; + + private static $valueToName = [ + self::GRPCLB_ROUTE_TYPE_UNKNOWN => 'GRPCLB_ROUTE_TYPE_UNKNOWN', + self::GRPCLB_ROUTE_TYPE_FALLBACK => 'GRPCLB_ROUTE_TYPE_FALLBACK', + self::GRPCLB_ROUTE_TYPE_BACKEND => 'GRPCLB_ROUTE_TYPE_BACKEND', + ]; + + 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); + } +} + diff --git a/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php new file mode 100644 index 00000000000..02a15306688 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php @@ -0,0 +1,99 @@ +grpc.testing.LoadBalancerStatsRequest + */ +class LoadBalancerStatsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + */ + protected $num_rpcs = 0; + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + */ + protected $timeout_sec = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $num_rpcs + * Request stats for the next num_rpcs sent by client. + * @type int $timeout_sec + * If num_rpcs have not completed within timeout_sec, return partial results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + * @return int + */ + public function getNumRpcs() + { + return $this->num_rpcs; + } + + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + * @param int $var + * @return $this + */ + public function setNumRpcs($var) + { + GPBUtil::checkInt32($var); + $this->num_rpcs = $var; + + return $this; + } + + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + * @return int + */ + public function getTimeoutSec() + { + return $this->timeout_sec; + } + + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + * @param int $var + * @return $this + */ + public function setTimeoutSec($var) + { + GPBUtil::checkInt32($var); + $this->timeout_sec = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php new file mode 100644 index 00000000000..270189e1871 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php @@ -0,0 +1,99 @@ +grpc.testing.LoadBalancerStatsResponse + */ +class LoadBalancerStatsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + */ + private $rpcs_by_peer; + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + */ + protected $num_failures = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $rpcs_by_peer + * The number of completed RPCs for each peer. + * @type int $num_failures + * The number of RPCs that failed to record a remote peer. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRpcsByPeer() + { + return $this->rpcs_by_peer; + } + + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRpcsByPeer($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32); + $this->rpcs_by_peer = $arr; + + return $this; + } + + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + * @return int + */ + public function getNumFailures() + { + return $this->num_failures; + } + + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + * @param int $var + * @return $this + */ + public function setNumFailures($var) + { + GPBUtil::checkInt32($var); + $this->num_failures = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php new file mode 100644 index 00000000000..129776d8a30 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php @@ -0,0 +1,52 @@ +_simpleRequest('/grpc.testing.LoadBalancerStatsService/GetClientStats', + $argument, + ['\Grpc\Testing\LoadBalancerStatsResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/interop/Grpc/Testing/Payload.php b/src/php/tests/interop/Grpc/Testing/Payload.php new file mode 100644 index 00000000000..65a007e119e --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/Payload.php @@ -0,0 +1,101 @@ +grpc.testing.Payload + */ +class Payload extends \Google\Protobuf\Internal\Message +{ + /** + * The type of data in body. + * + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + */ + protected $type = 0; + /** + * Primary contents of payload. + * + * Generated from protobuf field bytes body = 2; + */ + protected $body = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The type of data in body. + * @type string $body + * Primary contents of payload. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The type of data in body. + * + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of data in body. + * + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class); + $this->type = $var; + + return $this; + } + + /** + * Primary contents of payload. + * + * Generated from protobuf field bytes body = 2; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * Primary contents of payload. + * + * Generated from protobuf field bytes body = 2; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, False); + $this->body = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/PayloadType.php b/src/php/tests/interop/Grpc/Testing/PayloadType.php new file mode 100644 index 00000000000..dc246b37891 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/PayloadType.php @@ -0,0 +1,47 @@ +grpc.testing.PayloadType + */ +class PayloadType +{ + /** + * Compressable text format. + * + * Generated from protobuf enum COMPRESSABLE = 0; + */ + const COMPRESSABLE = 0; + + private static $valueToName = [ + self::COMPRESSABLE => 'COMPRESSABLE', + ]; + + 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); + } +} + diff --git a/src/php/tests/interop/Grpc/Testing/ReconnectInfo.php b/src/php/tests/interop/Grpc/Testing/ReconnectInfo.php new file mode 100644 index 00000000000..58ac838a859 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ReconnectInfo.php @@ -0,0 +1,89 @@ +grpc.testing.ReconnectInfo + */ +class ReconnectInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field bool passed = 1; + */ + protected $passed = false; + /** + * Generated from protobuf field repeated int32 backoff_ms = 2; + */ + private $backoff_ms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $passed + * @type int[]|\Google\Protobuf\Internal\RepeatedField $backoff_ms + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field bool passed = 1; + * @return bool + */ + public function getPassed() + { + return $this->passed; + } + + /** + * Generated from protobuf field bool passed = 1; + * @param bool $var + * @return $this + */ + public function setPassed($var) + { + GPBUtil::checkBool($var); + $this->passed = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated int32 backoff_ms = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackoffMs() + { + return $this->backoff_ms; + } + + /** + * Generated from protobuf field repeated int32 backoff_ms = 2; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackoffMs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->backoff_ms = $arr; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/ReconnectParams.php b/src/php/tests/interop/Grpc/Testing/ReconnectParams.php new file mode 100644 index 00000000000..599b13db1d6 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ReconnectParams.php @@ -0,0 +1,61 @@ +grpc.testing.ReconnectParams + */ +class ReconnectParams extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + */ + protected $max_reconnect_backoff_ms = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_reconnect_backoff_ms + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + * @return int + */ + public function getMaxReconnectBackoffMs() + { + return $this->max_reconnect_backoff_ms; + } + + /** + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + * @param int $var + * @return $this + */ + public function setMaxReconnectBackoffMs($var) + { + GPBUtil::checkInt32($var); + $this->max_reconnect_backoff_ms = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php b/src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php new file mode 100644 index 00000000000..50beca20e00 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php @@ -0,0 +1,64 @@ +_simpleRequest('/grpc.testing.ReconnectService/Start', + $argument, + ['\Grpc\Testing\EmptyMessage', 'decode'], + $metadata, $options); + } + + /** + * @param \Grpc\Testing\EmptyMessage $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Stop(\Grpc\Testing\EmptyMessage $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.ReconnectService/Stop', + $argument, + ['\Grpc\Testing\ReconnectInfo', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/interop/Grpc/Testing/ResponseParameters.php b/src/php/tests/interop/Grpc/Testing/ResponseParameters.php new file mode 100644 index 00000000000..470349325c4 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ResponseParameters.php @@ -0,0 +1,151 @@ +grpc.testing.ResponseParameters + */ +class ResponseParameters extends \Google\Protobuf\Internal\Message +{ + /** + * Desired payload sizes in responses from the server. + * + * Generated from protobuf field int32 size = 1; + */ + protected $size = 0; + /** + * Desired interval between consecutive responses in the response stream in + * microseconds. + * + * Generated from protobuf field int32 interval_us = 2; + */ + protected $interval_us = 0; + /** + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + */ + protected $compressed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $size + * Desired payload sizes in responses from the server. + * @type int $interval_us + * Desired interval between consecutive responses in the response stream in + * microseconds. + * @type \Grpc\Testing\BoolValue $compressed + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Desired payload sizes in responses from the server. + * + * Generated from protobuf field int32 size = 1; + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Desired payload sizes in responses from the server. + * + * Generated from protobuf field int32 size = 1; + * @param int $var + * @return $this + */ + public function setSize($var) + { + GPBUtil::checkInt32($var); + $this->size = $var; + + return $this; + } + + /** + * Desired interval between consecutive responses in the response stream in + * microseconds. + * + * Generated from protobuf field int32 interval_us = 2; + * @return int + */ + public function getIntervalUs() + { + return $this->interval_us; + } + + /** + * Desired interval between consecutive responses in the response stream in + * microseconds. + * + * Generated from protobuf field int32 interval_us = 2; + * @param int $var + * @return $this + */ + public function setIntervalUs($var) + { + GPBUtil::checkInt32($var); + $this->interval_us = $var; + + return $this; + } + + /** + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + * @return \Grpc\Testing\BoolValue + */ + public function getCompressed() + { + return $this->compressed; + } + + /** + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->compressed = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/SimpleRequest.php b/src/php/tests/interop/Grpc/Testing/SimpleRequest.php new file mode 100644 index 00000000000..95393659811 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/SimpleRequest.php @@ -0,0 +1,389 @@ +grpc.testing.SimpleRequest + */ +class SimpleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + */ + protected $response_type = 0; + /** + * Desired payload size in the response from the server. + * + * Generated from protobuf field int32 response_size = 2; + */ + protected $response_size = 0; + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + */ + protected $payload = null; + /** + * Whether SimpleResponse should include username. + * + * Generated from protobuf field bool fill_username = 4; + */ + protected $fill_username = false; + /** + * Whether SimpleResponse should include OAuth scope. + * + * Generated from protobuf field bool fill_oauth_scope = 5; + */ + protected $fill_oauth_scope = false; + /** + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + */ + protected $response_compressed = null; + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + */ + protected $response_status = null; + /** + * Whether the server should expect this request to be compressed. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + */ + protected $expect_compressed = null; + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + */ + protected $fill_server_id = false; + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + */ + protected $fill_grpclb_route_type = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * @type int $response_size + * Desired payload size in the response from the server. + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type bool $fill_username + * Whether SimpleResponse should include username. + * @type bool $fill_oauth_scope + * Whether SimpleResponse should include OAuth scope. + * @type \Grpc\Testing\BoolValue $response_compressed + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * @type \Grpc\Testing\EchoStatus $response_status + * Whether server should return a given status + * @type \Grpc\Testing\BoolValue $expect_compressed + * Whether the server should expect this request to be compressed. + * @type bool $fill_server_id + * Whether SimpleResponse should include server_id. + * @type bool $fill_grpclb_route_type + * Whether SimpleResponse should include grpclb_route_type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @param int $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class); + $this->response_type = $var; + + return $this; + } + + /** + * Desired payload size in the response from the server. + * + * Generated from protobuf field int32 response_size = 2; + * @return int + */ + public function getResponseSize() + { + return $this->response_size; + } + + /** + * Desired payload size in the response from the server. + * + * Generated from protobuf field int32 response_size = 2; + * @param int $var + * @return $this + */ + public function setResponseSize($var) + { + GPBUtil::checkInt32($var); + $this->response_size = $var; + + return $this; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include username. + * + * Generated from protobuf field bool fill_username = 4; + * @return bool + */ + public function getFillUsername() + { + return $this->fill_username; + } + + /** + * Whether SimpleResponse should include username. + * + * Generated from protobuf field bool fill_username = 4; + * @param bool $var + * @return $this + */ + public function setFillUsername($var) + { + GPBUtil::checkBool($var); + $this->fill_username = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include OAuth scope. + * + * Generated from protobuf field bool fill_oauth_scope = 5; + * @return bool + */ + public function getFillOauthScope() + { + return $this->fill_oauth_scope; + } + + /** + * Whether SimpleResponse should include OAuth scope. + * + * Generated from protobuf field bool fill_oauth_scope = 5; + * @param bool $var + * @return $this + */ + public function setFillOauthScope($var) + { + GPBUtil::checkBool($var); + $this->fill_oauth_scope = $var; + + return $this; + } + + /** + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + * @return \Grpc\Testing\BoolValue + */ + public function getResponseCompressed() + { + return $this->response_compressed; + } + + /** + * Whether to request the server to compress the response. This field is + * "nullable" in order to interoperate seamlessly with clients not able to + * implement the full compression tests by introspecting the call to verify + * the response's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setResponseCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->response_compressed = $var; + + return $this; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @return \Grpc\Testing\EchoStatus + */ + public function getResponseStatus() + { + return $this->response_status; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @param \Grpc\Testing\EchoStatus $var + * @return $this + */ + public function setResponseStatus($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class); + $this->response_status = $var; + + return $this; + } + + /** + * Whether the server should expect this request to be compressed. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + * @return \Grpc\Testing\BoolValue + */ + public function getExpectCompressed() + { + return $this->expect_compressed; + } + + /** + * Whether the server should expect this request to be compressed. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setExpectCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->expect_compressed = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + * @return bool + */ + public function getFillServerId() + { + return $this->fill_server_id; + } + + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + * @param bool $var + * @return $this + */ + public function setFillServerId($var) + { + GPBUtil::checkBool($var); + $this->fill_server_id = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + * @return bool + */ + public function getFillGrpclbRouteType() + { + return $this->fill_grpclb_route_type; + } + + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + * @param bool $var + * @return $this + */ + public function setFillGrpclbRouteType($var) + { + GPBUtil::checkBool($var); + $this->fill_grpclb_route_type = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/SimpleResponse.php b/src/php/tests/interop/Grpc/Testing/SimpleResponse.php new file mode 100644 index 00000000000..7121fc215ec --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/SimpleResponse.php @@ -0,0 +1,245 @@ +grpc.testing.SimpleResponse + */ +class SimpleResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Payload to increase message size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + */ + protected $payload = null; + /** + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * + * Generated from protobuf field string username = 2; + */ + protected $username = ''; + /** + * OAuth scope. + * + * Generated from protobuf field string oauth_scope = 3; + */ + protected $oauth_scope = ''; + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + */ + protected $server_id = ''; + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + */ + protected $grpclb_route_type = 0; + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + */ + protected $hostname = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Payload to increase message size. + * @type string $username + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * @type string $oauth_scope + * OAuth scope. + * @type string $server_id + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * @type int $grpclb_route_type + * gRPCLB Path. + * @type string $hostname + * Server hostname. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Payload to increase message size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Payload to increase message size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + + /** + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * + * Generated from protobuf field string username = 2; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * + * Generated from protobuf field string username = 2; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * OAuth scope. + * + * Generated from protobuf field string oauth_scope = 3; + * @return string + */ + public function getOauthScope() + { + return $this->oauth_scope; + } + + /** + * OAuth scope. + * + * Generated from protobuf field string oauth_scope = 3; + * @param string $var + * @return $this + */ + public function setOauthScope($var) + { + GPBUtil::checkString($var, True); + $this->oauth_scope = $var; + + return $this; + } + + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + * @return string + */ + public function getServerId() + { + return $this->server_id; + } + + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + * @param string $var + * @return $this + */ + public function setServerId($var) + { + GPBUtil::checkString($var, True); + $this->server_id = $var; + + return $this; + } + + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + * @return int + */ + public function getGrpclbRouteType() + { + return $this->grpclb_route_type; + } + + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + * @param int $var + * @return $this + */ + public function setGrpclbRouteType($var) + { + GPBUtil::checkEnum($var, \Grpc\Testing\GrpclbRouteType::class); + $this->grpclb_route_type = $var; + + return $this; + } + + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php b/src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php new file mode 100644 index 00000000000..00c754b946b --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php @@ -0,0 +1,113 @@ +grpc.testing.StreamingInputCallRequest + */ +class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + */ + protected $payload = null; + /** + * Whether the server should expect this request to be compressed. This field + * is "nullable" in order to interoperate seamlessly with servers not able to + * implement the full compression tests by introspecting the call to verify + * the request's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + */ + protected $expect_compressed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type \Grpc\Testing\BoolValue $expect_compressed + * Whether the server should expect this request to be compressed. This field + * is "nullable" in order to interoperate seamlessly with servers not able to + * implement the full compression tests by introspecting the call to verify + * the request's compression status. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + + /** + * Whether the server should expect this request to be compressed. This field + * is "nullable" in order to interoperate seamlessly with servers not able to + * implement the full compression tests by introspecting the call to verify + * the request's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + * @return \Grpc\Testing\BoolValue + */ + public function getExpectCompressed() + { + return $this->expect_compressed; + } + + /** + * Whether the server should expect this request to be compressed. This field + * is "nullable" in order to interoperate seamlessly with servers not able to + * implement the full compression tests by introspecting the call to verify + * the request's compression status. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setExpectCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->expect_compressed = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php b/src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php new file mode 100644 index 00000000000..f7ff87c1fb1 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php @@ -0,0 +1,67 @@ +grpc.testing.StreamingInputCallResponse + */ +class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Aggregated size of payloads received from the client. + * + * Generated from protobuf field int32 aggregated_payload_size = 1; + */ + protected $aggregated_payload_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $aggregated_payload_size + * Aggregated size of payloads received from the client. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Aggregated size of payloads received from the client. + * + * Generated from protobuf field int32 aggregated_payload_size = 1; + * @return int + */ + public function getAggregatedPayloadSize() + { + return $this->aggregated_payload_size; + } + + /** + * Aggregated size of payloads received from the client. + * + * Generated from protobuf field int32 aggregated_payload_size = 1; + * @param int $var + * @return $this + */ + public function setAggregatedPayloadSize($var) + { + GPBUtil::checkInt32($var); + $this->aggregated_payload_size = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingOutputCallRequest.php b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallRequest.php new file mode 100644 index 00000000000..552e96d7ae2 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallRequest.php @@ -0,0 +1,181 @@ +grpc.testing.StreamingOutputCallRequest + */ +class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message +{ + /** + * 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. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + */ + protected $response_type = 0; + /** + * Configuration for each expected response message. + * + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + */ + private $response_parameters; + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + */ + protected $payload = null; + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + */ + protected $response_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * 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. + * @type \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $response_parameters + * Configuration for each expected response message. + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type \Grpc\Testing\EchoStatus $response_status + * Whether server should return a given status + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * 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. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * 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. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @param int $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class); + $this->response_type = $var; + + return $this; + } + + /** + * Configuration for each expected response message. + * + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponseParameters() + { + return $this->response_parameters; + } + + /** + * Configuration for each expected response message. + * + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + * @param \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponseParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ResponseParameters::class); + $this->response_parameters = $arr; + + return $this; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @return \Grpc\Testing\EchoStatus + */ + public function getResponseStatus() + { + return $this->response_status; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @param \Grpc\Testing\EchoStatus $var + * @return $this + */ + public function setResponseStatus($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class); + $this->response_status = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php new file mode 100644 index 00000000000..b28b906ce93 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php @@ -0,0 +1,67 @@ +grpc.testing.StreamingOutputCallResponse + */ +class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Payload to increase response size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + */ + protected $payload = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Payload to increase response size. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Payload to increase response size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Payload to increase response size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/TestServiceClient.php b/src/php/tests/interop/Grpc/Testing/TestServiceClient.php new file mode 100644 index 00000000000..e6fef125b8b --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/TestServiceClient.php @@ -0,0 +1,152 @@ +_simpleRequest('/grpc.testing.TestService/EmptyCall', + $argument, + ['\Grpc\Testing\EmptyMessage', 'decode'], + $metadata, $options); + } + + /** + * One request followed by one response. + * @param \Grpc\Testing\SimpleRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnaryCall(\Grpc\Testing\SimpleRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/UnaryCall', + $argument, + ['\Grpc\Testing\SimpleResponse', 'decode'], + $metadata, $options); + } + + /** + * One request followed by one response. Response has cache control + * headers set such that a caching HTTP proxy (such as GFE) can + * satisfy subsequent requests. + * @param \Grpc\Testing\SimpleRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CacheableUnaryCall(\Grpc\Testing\SimpleRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/CacheableUnaryCall', + $argument, + ['\Grpc\Testing\SimpleResponse', 'decode'], + $metadata, $options); + } + + /** + * One request followed by a sequence of responses (streamed download). + * The server returns the payload with client desired type and sizes. + * @param \Grpc\Testing\StreamingOutputCallRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingOutputCall(\Grpc\Testing\StreamingOutputCallRequest $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', + $argument, + ['\Grpc\Testing\StreamingOutputCallResponse', 'decode'], + $metadata, $options); + } + + /** + * A sequence of requests followed by one response (streamed upload). + * The server returns the aggregated size of client payload as the result. + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingInputCall($metadata = [], $options = []) { + return $this->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', + ['\Grpc\Testing\StreamingInputCallResponse','decode'], + $metadata, $options); + } + + /** + * 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. + * @param array $metadata metadata + * @param array $options call options + */ + public function FullDuplexCall($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', + ['\Grpc\Testing\StreamingOutputCallResponse','decode'], + $metadata, $options); + } + + /** + * 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. + * @param array $metadata metadata + * @param array $options call options + */ + public function HalfDuplexCall($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', + ['\Grpc\Testing\StreamingOutputCallResponse','decode'], + $metadata, $options); + } + + /** + * The test server will not implement this method. It will be used + * to test the behavior when clients call unimplemented methods. + * @param \Grpc\Testing\EmptyMessage $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnimplementedCall(\Grpc\Testing\EmptyMessage $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/UnimplementedCall', + $argument, + ['\Grpc\Testing\EmptyMessage', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/interop/Grpc/Testing/UnimplementedServiceClient.php b/src/php/tests/interop/Grpc/Testing/UnimplementedServiceClient.php new file mode 100644 index 00000000000..2c1d921bfcc --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/UnimplementedServiceClient.php @@ -0,0 +1,53 @@ +_simpleRequest('/grpc.testing.UnimplementedService/UnimplementedCall', + $argument, + ['\Grpc\Testing\EmptyMessage', 'decode'], + $metadata, $options); + } + +}