diff options
author | kpayson64 <kpayson@google.com> | 2018-05-11 12:20:11 -0700 |
---|---|---|
committer | kpayson64 <kpayson@google.com> | 2018-05-11 12:20:11 -0700 |
commit | 4fad281ce8affe27fb7428f264d2c3b9dfc45f2f (patch) | |
tree | ca96c9efd69afec56aa2e5fe072a9f758247d0a3 /src/php/tests | |
parent | ec445cc2bb270ed4acb1c710c3533fca14a50019 (diff) | |
parent | 61fdb46ac456027c79841949272ec540f66d2317 (diff) |
Merge remote-tracking branch 'upstream/master' into fork_exec_ctx_check
Diffstat (limited to 'src/php/tests')
38 files changed, 2755 insertions, 89 deletions
diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php new file mode 100644 index 0000000000..906f6a2d84 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php @@ -0,0 +1,41 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/benchmark_service.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class BenchmarkService +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + $pool->internalAddGeneratedFile(hex2bin( + "0aef030a2e7372632f70726f746f2f677270632f74657374696e672f6265" . + "6e63686d61726b5f736572766963652e70726f746f120c677270632e7465" . + "7374696e6732a6030a1042656e63686d61726b5365727669636512460a09" . + "556e61727943616c6c121b2e677270632e74657374696e672e53696d706c" . + "65526571756573741a1c2e677270632e74657374696e672e53696d706c65" . + "526573706f6e7365124e0a0d53747265616d696e6743616c6c121b2e6772" . + "70632e74657374696e672e53696d706c65526571756573741a1c2e677270" . + "632e74657374696e672e53696d706c65526573706f6e7365280130011252" . + "0a1353747265616d696e6746726f6d436c69656e74121b2e677270632e74" . + "657374696e672e53696d706c65526571756573741a1c2e677270632e7465" . + "7374696e672e53696d706c65526573706f6e7365280112520a1353747265" . + "616d696e6746726f6d536572766572121b2e677270632e74657374696e67" . + "2e53696d706c65526571756573741a1c2e677270632e74657374696e672e" . + "53696d706c65526573706f6e7365300112520a1153747265616d696e6742" . + "6f746857617973121b2e677270632e74657374696e672e53696d706c6552" . + "6571756573741a1c2e677270632e74657374696e672e53696d706c655265" . + "73706f6e736528013001620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php new file mode 100644 index 0000000000..2c4fe92f05 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php @@ -0,0 +1,37 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/compiler_test.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class CompilerTest +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + $pool->internalAddGeneratedFile(hex2bin( + "0aa1030a2a7372632f70726f746f2f677270632f74657374696e672f636f" . + "6d70696c65725f746573742e70726f746f120c677270632e74657374696e" . + "6722090a0752657175657374220a0a08526573706f6e736532fe010a0853" . + "6572766963654112390a084d6574686f64413112152e677270632e746573" . + "74696e672e526571756573741a162e677270632e74657374696e672e5265" . + "73706f6e7365123b0a084d6574686f64413212152e677270632e74657374" . + "696e672e526571756573741a162e677270632e74657374696e672e526573" . + "706f6e73652801123b0a084d6574686f64413312152e677270632e746573" . + "74696e672e526571756573741a162e677270632e74657374696e672e5265" . + "73706f6e73653001123d0a084d6574686f64413412152e677270632e7465" . + "7374696e672e526571756573741a162e677270632e74657374696e672e52" . + "6573706f6e73652801300132450a08536572766963654212390a084d6574" . + "686f64423112152e677270632e74657374696e672e526571756573741a16" . + "2e677270632e74657374696e672e526573706f6e7365620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php index 9b3a7529ec..2319bcd021 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php @@ -17,7 +17,7 @@ class Control \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0aa21a0a247372632f70726f746f2f677270632f74657374696e672f636f" . + "0abc1a0a247372632f70726f746f2f677270632f74657374696e672f636f" . "6e74726f6c2e70726f746f120c677270632e74657374696e671a22737263" . "2f70726f746f2f677270632f74657374696e672f73746174732e70726f74" . "6f22250a0d506f6973736f6e506172616d7312140a0c6f6666657265645f" . @@ -31,7 +31,7 @@ class Control "6f7665727269646518022001280912110a09637265645f74797065180320" . "012809224d0a0a4368616e6e656c417267120c0a046e616d651801200128" . "0912130a097374725f76616c7565180220012809480012130a09696e745f" . - "76616c7565180320012805480042070a0576616c756522d5040a0c436c69" . + "76616c7565180320012805480042070a0576616c756522ef040a0c436c69" . "656e74436f6e66696712160a0e7365727665725f74617267657473180120" . "032809122d0a0b636c69656e745f7479706518022001280e32182e677270" . "632e74657374696e672e436c69656e745479706512350a0f736563757269" . @@ -51,85 +51,86 @@ class Control "745f617069180f20012809122e0a0c6368616e6e656c5f61726773181020" . "03280b32182e677270632e74657374696e672e4368616e6e656c41726712" . "160a0e746872656164735f7065725f6371181120012805121b0a136d6573" . - "73616765735f7065725f73747265616d18122001280522380a0c436c6965" . - "6e7453746174757312280a05737461747318012001280b32192e67727063" . - "2e74657374696e672e436c69656e74537461747322150a044d61726b120d" . - "0a05726573657418012001280822680a0a436c69656e7441726773122b0a" . - "05736574757018012001280b321a2e677270632e74657374696e672e436c" . - "69656e74436f6e666967480012220a046d61726b18022001280b32122e67" . - "7270632e74657374696e672e4d61726b480042090a076172677479706522" . - "fd020a0c536572766572436f6e666967122d0a0b7365727665725f747970" . - "6518012001280e32182e677270632e74657374696e672e53657276657254" . - "79706512350a0f73656375726974795f706172616d7318022001280b321c" . - "2e677270632e74657374696e672e5365637572697479506172616d73120c" . - "0a04706f7274180420012805121c0a146173796e635f7365727665725f74" . - "68726561647318072001280512120a0a636f72655f6c696d697418082001" . - "280512330a0e7061796c6f61645f636f6e66696718092001280b321b2e67" . - "7270632e74657374696e672e5061796c6f6164436f6e66696712110a0963" . - "6f72655f6c697374180a2003280512180a106f746865725f736572766572" . - "5f617069180b2001280912160a0e746872656164735f7065725f6371180c" . - "20012805121c0a137265736f757263655f71756f74615f73697a6518e907" . - "20012805122f0a0c6368616e6e656c5f6172677318ea072003280b32182e" . - "677270632e74657374696e672e4368616e6e656c41726722680a0a536572" . - "76657241726773122b0a05736574757018012001280b321a2e677270632e" . - "74657374696e672e536572766572436f6e666967480012220a046d61726b" . - "18022001280b32122e677270632e74657374696e672e4d61726b48004209" . - "0a076172677479706522550a0c53657276657253746174757312280a0573" . - "7461747318012001280b32192e677270632e74657374696e672e53657276" . - "65725374617473120c0a04706f7274180220012805120d0a05636f726573" . - "180320012805220d0a0b436f726552657175657374221d0a0c436f726552" . - "6573706f6e7365120d0a05636f72657318012001280522060a04566f6964" . - "22fd010a085363656e6172696f120c0a046e616d6518012001280912310a" . - "0d636c69656e745f636f6e66696718022001280b321a2e677270632e7465" . - "7374696e672e436c69656e74436f6e66696712130a0b6e756d5f636c6965" . - "6e747318032001280512310a0d7365727665725f636f6e66696718042001" . - "280b321a2e677270632e74657374696e672e536572766572436f6e666967" . - "12130a0b6e756d5f7365727665727318052001280512160a0e7761726d75" . - "705f7365636f6e647318062001280512190a1162656e63686d61726b5f73" . - "65636f6e647318072001280512200a18737061776e5f6c6f63616c5f776f" . - "726b65725f636f756e7418082001280522360a095363656e6172696f7312" . - "290a097363656e6172696f7318012003280b32162e677270632e74657374" . - "696e672e5363656e6172696f2284040a155363656e6172696f526573756c" . - "7453756d6d617279120b0a03717073180120012801121b0a137170735f70" . - "65725f7365727665725f636f7265180220012801121a0a12736572766572" . - "5f73797374656d5f74696d6518032001280112180a107365727665725f75" . - "7365725f74696d65180420012801121a0a12636c69656e745f7379737465" . - "6d5f74696d6518052001280112180a10636c69656e745f757365725f7469" . - "6d6518062001280112120a0a6c6174656e63795f35301807200128011212" . - "0a0a6c6174656e63795f393018082001280112120a0a6c6174656e63795f" . - "393518092001280112120a0a6c6174656e63795f3939180a200128011213" . - "0a0b6c6174656e63795f393939180b2001280112180a107365727665725f" . - "6370755f7573616765180c2001280112260a1e7375636365737366756c5f" . - "72657175657374735f7065725f7365636f6e64180d2001280112220a1a66" . - "61696c65645f72657175657374735f7065725f7365636f6e64180e200128" . - "0112200a18636c69656e745f706f6c6c735f7065725f7265717565737418" . - "0f2001280112200a187365727665725f706f6c6c735f7065725f72657175" . - "65737418102001280112220a1a7365727665725f717565726965735f7065" . - "725f6370755f73656318112001280112220a1a636c69656e745f71756572" . - "6965735f7065725f6370755f7365631812200128012283030a0e5363656e" . - "6172696f526573756c7412280a087363656e6172696f18012001280b3216" . - "2e677270632e74657374696e672e5363656e6172696f122e0a096c617465" . - "6e6369657318022001280b321b2e677270632e74657374696e672e486973" . - "746f6772616d44617461122f0a0c636c69656e745f737461747318032003" . - "280b32192e677270632e74657374696e672e436c69656e74537461747312" . - "2f0a0c7365727665725f737461747318042003280b32192e677270632e74" . - "657374696e672e536572766572537461747312140a0c7365727665725f63" . - "6f72657318052003280512340a0773756d6d61727918062001280b32232e" . - "677270632e74657374696e672e5363656e6172696f526573756c7453756d" . - "6d61727912160a0e636c69656e745f737563636573731807200328081216" . - "0a0e7365727665725f7375636365737318082003280812390a0f72657175" . - "6573745f726573756c747318092003280b32202e677270632e7465737469" . - "6e672e52657175657374526573756c74436f756e742a410a0a436c69656e" . - "7454797065120f0a0b53594e435f434c49454e54100012100a0c4153594e" . - "435f434c49454e54100112100a0c4f544845525f434c49454e5410022a5b" . - "0a0a53657276657254797065120f0a0b53594e435f534552564552100012" . - "100a0c4153594e435f534552564552100112180a144153594e435f47454e" . - "455249435f534552564552100212100a0c4f544845525f53455256455210" . - "032a720a075270635479706512090a05554e4152591000120d0a09535452" . - "45414d494e47100112190a1553545245414d494e475f46524f4d5f434c49" . - "454e54100212190a1553545245414d494e475f46524f4d5f534552564552" . - "100312170a1353545245414d494e475f424f54485f574159531004620670" . - "726f746f33" + "73616765735f7065725f73747265616d18122001280512180a107573655f" . + "636f616c657363655f61706918132001280822380a0c436c69656e745374" . + "6174757312280a05737461747318012001280b32192e677270632e746573" . + "74696e672e436c69656e74537461747322150a044d61726b120d0a057265" . + "73657418012001280822680a0a436c69656e7441726773122b0a05736574" . + "757018012001280b321a2e677270632e74657374696e672e436c69656e74" . + "436f6e666967480012220a046d61726b18022001280b32122e677270632e" . + "74657374696e672e4d61726b480042090a076172677479706522fd020a0c" . + "536572766572436f6e666967122d0a0b7365727665725f74797065180120" . + "01280e32182e677270632e74657374696e672e5365727665725479706512" . + "350a0f73656375726974795f706172616d7318022001280b321c2e677270" . + "632e74657374696e672e5365637572697479506172616d73120c0a04706f" . + "7274180420012805121c0a146173796e635f7365727665725f7468726561" . + "647318072001280512120a0a636f72655f6c696d69741808200128051233" . + "0a0e7061796c6f61645f636f6e66696718092001280b321b2e677270632e" . + "74657374696e672e5061796c6f6164436f6e66696712110a09636f72655f" . + "6c697374180a2003280512180a106f746865725f7365727665725f617069" . + "180b2001280912160a0e746872656164735f7065725f6371180c20012805" . + "121c0a137265736f757263655f71756f74615f73697a6518e90720012805" . + "122f0a0c6368616e6e656c5f6172677318ea072003280b32182e67727063" . + "2e74657374696e672e4368616e6e656c41726722680a0a53657276657241" . + "726773122b0a05736574757018012001280b321a2e677270632e74657374" . + "696e672e536572766572436f6e666967480012220a046d61726b18022001" . + "280b32122e677270632e74657374696e672e4d61726b480042090a076172" . + "677479706522550a0c53657276657253746174757312280a057374617473" . + "18012001280b32192e677270632e74657374696e672e5365727665725374" . + "617473120c0a04706f7274180220012805120d0a05636f72657318032001" . + "2805220d0a0b436f726552657175657374221d0a0c436f7265526573706f" . + "6e7365120d0a05636f72657318012001280522060a04566f696422fd010a" . + "085363656e6172696f120c0a046e616d6518012001280912310a0d636c69" . + "656e745f636f6e66696718022001280b321a2e677270632e74657374696e" . + "672e436c69656e74436f6e66696712130a0b6e756d5f636c69656e747318" . + "032001280512310a0d7365727665725f636f6e66696718042001280b321a" . + "2e677270632e74657374696e672e536572766572436f6e66696712130a0b" . + "6e756d5f7365727665727318052001280512160a0e7761726d75705f7365" . + "636f6e647318062001280512190a1162656e63686d61726b5f7365636f6e" . + "647318072001280512200a18737061776e5f6c6f63616c5f776f726b6572" . + "5f636f756e7418082001280522360a095363656e6172696f7312290a0973" . + "63656e6172696f7318012003280b32162e677270632e74657374696e672e" . + "5363656e6172696f2284040a155363656e6172696f526573756c7453756d" . + "6d617279120b0a03717073180120012801121b0a137170735f7065725f73" . + "65727665725f636f7265180220012801121a0a127365727665725f737973" . + "74656d5f74696d6518032001280112180a107365727665725f757365725f" . + "74696d65180420012801121a0a12636c69656e745f73797374656d5f7469" . + "6d6518052001280112180a10636c69656e745f757365725f74696d651806" . + "2001280112120a0a6c6174656e63795f353018072001280112120a0a6c61" . + "74656e63795f393018082001280112120a0a6c6174656e63795f39351809" . + "2001280112120a0a6c6174656e63795f3939180a2001280112130a0b6c61" . + "74656e63795f393939180b2001280112180a107365727665725f6370755f" . + "7573616765180c2001280112260a1e7375636365737366756c5f72657175" . + "657374735f7065725f7365636f6e64180d2001280112220a1a6661696c65" . + "645f72657175657374735f7065725f7365636f6e64180e2001280112200a" . + "18636c69656e745f706f6c6c735f7065725f72657175657374180f200128" . + "0112200a187365727665725f706f6c6c735f7065725f7265717565737418" . + "102001280112220a1a7365727665725f717565726965735f7065725f6370" . + "755f73656318112001280112220a1a636c69656e745f717565726965735f" . + "7065725f6370755f7365631812200128012283030a0e5363656e6172696f" . + "526573756c7412280a087363656e6172696f18012001280b32162e677270" . + "632e74657374696e672e5363656e6172696f122e0a096c6174656e636965" . + "7318022001280b321b2e677270632e74657374696e672e486973746f6772" . + "616d44617461122f0a0c636c69656e745f737461747318032003280b3219" . + "2e677270632e74657374696e672e436c69656e745374617473122f0a0c73" . + "65727665725f737461747318042003280b32192e677270632e7465737469" . + "6e672e536572766572537461747312140a0c7365727665725f636f726573" . + "18052003280512340a0773756d6d61727918062001280b32232e67727063" . + "2e74657374696e672e5363656e6172696f526573756c7453756d6d617279" . + "12160a0e636c69656e745f7375636365737318072003280812160a0e7365" . + "727665725f7375636365737318082003280812390a0f726571756573745f" . + "726573756c747318092003280b32202e677270632e74657374696e672e52" . + "657175657374526573756c74436f756e742a410a0a436c69656e74547970" . + "65120f0a0b53594e435f434c49454e54100012100a0c4153594e435f434c" . + "49454e54100112100a0c4f544845525f434c49454e5410022a5b0a0a5365" . + "7276657254797065120f0a0b53594e435f534552564552100012100a0c41" . + "53594e435f534552564552100112180a144153594e435f47454e45524943" . + "5f534552564552100212100a0c4f544845525f53455256455210032a720a" . + "075270635479706512090a05554e4152591000120d0a0953545245414d49" . + "4e47100112190a1553545245414d494e475f46524f4d5f434c49454e5410" . + "0212190a1553545245414d494e475f46524f4d5f53455256455210031217" . + "0a1353545245414d494e475f424f54485f574159531004620670726f746f" . + "33" )); static::$is_initialized = true; diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Echo.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Echo.php new file mode 100644 index 0000000000..77c5230f45 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Echo.php @@ -0,0 +1,43 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class Echo +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + $pool->internalAddGeneratedFile(hex2bin( + "0aa6040a217372632f70726f746f2f677270632f74657374696e672f6563" . + "686f2e70726f746f120c677270632e74657374696e6732f6020a0f456368" . + "6f5465737453657276696365123d0a044563686f12192e677270632e7465" . + "7374696e672e4563686f526571756573741a1a2e677270632e7465737469" . + "6e672e4563686f526573706f6e736512480a0d5265717565737453747265" . + "616d12192e677270632e74657374696e672e4563686f526571756573741a" . + "1a2e677270632e74657374696e672e4563686f526573706f6e7365280112" . + "490a0e526573706f6e736553747265616d12192e677270632e7465737469" . + "6e672e4563686f526571756573741a1a2e677270632e74657374696e672e" . + "4563686f526573706f6e7365300112470a0a4269646953747265616d1219" . + "2e677270632e74657374696e672e4563686f526571756573741a1a2e6772" . + "70632e74657374696e672e4563686f526573706f6e73652801300112460a" . + "0d556e696d706c656d656e74656412192e677270632e74657374696e672e" . + "4563686f526571756573741a1a2e677270632e74657374696e672e456368" . + "6f526573706f6e736532620a18556e696d706c656d656e7465644563686f" . + "5365727669636512460a0d556e696d706c656d656e74656412192e677270" . + "632e74657374696e672e4563686f526571756573741a1a2e677270632e74" . + "657374696e672e4563686f526573706f6e7365320e0a0c4e6f5270635365" . + "7276696365620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php new file mode 100644 index 0000000000..4bac8a2906 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class EchoMessages +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + $pool->internalAddGeneratedFile(hex2bin( + "0a8f070a2a7372632f70726f746f2f677270632f74657374696e672f6563" . + "686f5f6d657373616765732e70726f746f120c677270632e74657374696e" . + "6722320a094465627567496e666f12150a0d737461636b5f656e74726965" . + "73180120032809120e0a0664657461696c18022001280922500a0b457272" . + "6f72537461747573120c0a04636f646518012001280512150a0d6572726f" . + "725f6d657373616765180220012809121c0a1462696e6172795f6572726f" . + "725f64657461696c7318032001280922e2030a0d52657175657374506172" . + "616d7312150a0d6563686f5f646561646c696e65180120012808121e0a16" . + "636c69656e745f63616e63656c5f61667465725f7573180220012805121e" . + "0a167365727665725f63616e63656c5f61667465725f7573180320012805" . + "12150a0d6563686f5f6d65746164617461180420012808121a0a12636865" . + "636b5f617574685f636f6e74657874180520012808121f0a17726573706f" . + "6e73655f6d6573736167655f6c656e67746818062001280512110a096563" . + "686f5f7065657218072001280812200a1865787065637465645f636c6965" . + "6e745f6964656e74697479180820012809121c0a14736b69705f63616e63" . + "656c6c65645f636865636b18092001280812280a2065787065637465645f" . + "7472616e73706f72745f73656375726974795f74797065180a2001280912" . + "2b0a0a64656275675f696e666f180b2001280b32172e677270632e746573" . + "74696e672e4465627567496e666f12120a0a7365727665725f646965180c" . + "20012808121c0a1462696e6172795f6572726f725f64657461696c73180d" . + "2001280912310a0e65787065637465645f6572726f72180e2001280b3219" . + "2e677270632e74657374696e672e4572726f7253746174757312170a0f73" . + "65727665725f736c6565705f7573180f20012805224a0a0b4563686f5265" . + "7175657374120f0a076d657373616765180120012809122a0a0570617261" . + "6d18022001280b321b2e677270632e74657374696e672e52657175657374" . + "506172616d7322460a0e526573706f6e7365506172616d7312180a107265" . + "71756573745f646561646c696e65180120012803120c0a04686f73741802" . + "20012809120c0a0470656572180320012809224c0a0c4563686f52657370" . + "6f6e7365120f0a076d657373616765180120012809122b0a05706172616d" . + "18022001280b321c2e677270632e74657374696e672e526573706f6e7365" . + "506172616d73620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/GPBEmpty.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/GPBEmpty.php new file mode 100644 index 0000000000..7198f7da0c --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/GPBEmpty.php @@ -0,0 +1,26 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/empty.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class GPBEmpty +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + $pool->internalAddGeneratedFile(hex2bin( + "0a430a227372632f70726f746f2f677270632f74657374696e672f656d70" . + "74792e70726f746f120c677270632e74657374696e6722070a05456d7074" . + "79620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Metrics.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Metrics.php new file mode 100644 index 0000000000..7ac739fb54 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Metrics.php @@ -0,0 +1,36 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/metrics.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class Metrics +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + $pool->internalAddGeneratedFile(hex2bin( + "0afb020a247372632f70726f746f2f677270632f74657374696e672f6d65" . + "74726963732e70726f746f120c677270632e74657374696e67226c0a0d47" . + "61756765526573706f6e7365120c0a046e616d6518012001280912140a0a" . + "6c6f6e675f76616c7565180220012803480012160a0c646f75626c655f76" . + "616c7565180320012801480012160a0c737472696e675f76616c75651804" . + "20012809480042070a0576616c7565221c0a0c4761756765526571756573" . + "74120c0a046e616d65180120012809220e0a0c456d7074794d6573736167" . + "6532a0010a0e4d6574726963735365727669636512490a0c476574416c6c" . + "476175676573121a2e677270632e74657374696e672e456d7074794d6573" . + "736167651a1b2e677270632e74657374696e672e4761756765526573706f" . + "6e7365300112430a084765744761756765121a2e677270632e7465737469" . + "6e672e4761756765526571756573741a1b2e677270632e74657374696e67" . + "2e4761756765526573706f6e7365620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php new file mode 100644 index 0000000000..35a1fb4acb --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php @@ -0,0 +1,30 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/report_qps_scenario_service.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class ReportQpsScenarioService +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); + $pool->internalAddGeneratedFile(hex2bin( + "0ab0010a387372632f70726f746f2f677270632f74657374696e672f7265" . + "706f72745f7170735f7363656e6172696f5f736572766963652e70726f74" . + "6f120c677270632e74657374696e67325e0a185265706f72745170735363" . + "656e6172696f5365727669636512420a0e5265706f72745363656e617269" . + "6f121c2e677270632e74657374696e672e5363656e6172696f526573756c" . + "741a122e677270632e74657374696e672e566f6964620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php new file mode 100644 index 0000000000..54628cfa37 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php @@ -0,0 +1,60 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/test.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class Test +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + \GPBMetadata\Src\Proto\Grpc\Testing\GPBEmpty::initOnce(); + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + $pool->internalAddGeneratedFile(hex2bin( + "0a91080a217372632f70726f746f2f677270632f74657374696e672f7465" . + "73742e70726f746f120c677270632e74657374696e671a257372632f7072" . + "6f746f2f677270632f74657374696e672f6d657373616765732e70726f74" . + "6f32cb050a0b546573745365727669636512350a09456d70747943616c6c" . + "12132e677270632e74657374696e672e456d7074791a132e677270632e74" . + "657374696e672e456d70747912460a09556e61727943616c6c121b2e6772" . + "70632e74657374696e672e53696d706c65526571756573741a1c2e677270" . + "632e74657374696e672e53696d706c65526573706f6e7365124f0a124361" . + "63686561626c65556e61727943616c6c121b2e677270632e74657374696e" . + "672e53696d706c65526571756573741a1c2e677270632e74657374696e67" . + "2e53696d706c65526573706f6e7365126c0a1353747265616d696e674f75" . + "7470757443616c6c12282e677270632e74657374696e672e53747265616d" . + "696e674f757470757443616c6c526571756573741a292e677270632e7465" . + "7374696e672e53747265616d696e674f757470757443616c6c526573706f" . + "6e7365300112690a1253747265616d696e67496e70757443616c6c12272e" . + "677270632e74657374696e672e53747265616d696e67496e70757443616c" . + "6c526571756573741a282e677270632e74657374696e672e53747265616d" . + "696e67496e70757443616c6c526573706f6e7365280112690a0e46756c6c" . + "4475706c657843616c6c12282e677270632e74657374696e672e53747265" . + "616d696e674f757470757443616c6c526571756573741a292e677270632e" . + "74657374696e672e53747265616d696e674f757470757443616c6c526573" . + "706f6e73652801300112690a0e48616c664475706c657843616c6c12282e" . + "677270632e74657374696e672e53747265616d696e674f75747075744361" . + "6c6c526571756573741a292e677270632e74657374696e672e5374726561" . + "6d696e674f757470757443616c6c526573706f6e736528013001123d0a11" . + "556e696d706c656d656e74656443616c6c12132e677270632e7465737469" . + "6e672e456d7074791a132e677270632e74657374696e672e456d70747932" . + "550a14556e696d706c656d656e74656453657276696365123d0a11556e69" . + "6d706c656d656e74656443616c6c12132e677270632e74657374696e672e" . + "456d7074791a132e677270632e74657374696e672e456d7074793289010a" . + "105265636f6e6e65637453657276696365123b0a055374617274121d2e67" . + "7270632e74657374696e672e5265636f6e6e656374506172616d731a132e" . + "677270632e74657374696e672e456d70747912380a0453746f7012132e67" . + "7270632e74657374696e672e456d7074791a1b2e677270632e7465737469" . + "6e672e5265636f6e6e656374496e666f620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php new file mode 100644 index 0000000000..a8a863df19 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php @@ -0,0 +1,36 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/worker_service.proto + +namespace GPBMetadata\Src\Proto\Grpc\Testing; + +class WorkerService +{ + public static $is_initialized = false; + + public static function initOnce() { + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); + + if (static::$is_initialized == true) { + return; + } + \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); + $pool->internalAddGeneratedFile(hex2bin( + "0add020a2b7372632f70726f746f2f677270632f74657374696e672f776f" . + "726b65725f736572766963652e70726f746f120c677270632e7465737469" . + "6e673297020a0d576f726b65725365727669636512450a0952756e536572" . + "76657212182e677270632e74657374696e672e536572766572417267731a" . + "1a2e677270632e74657374696e672e536572766572537461747573280130" . + "0112450a0952756e436c69656e7412182e677270632e74657374696e672e" . + "436c69656e74417267731a1a2e677270632e74657374696e672e436c6965" . + "6e745374617475732801300112420a09436f7265436f756e7412192e6772" . + "70632e74657374696e672e436f7265526571756573741a1a2e677270632e" . + "74657374696e672e436f7265526573706f6e736512340a0a51756974576f" . + "726b657212122e677270632e74657374696e672e566f69641a122e677270" . + "632e74657374696e672e566f6964620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php index f7bc21587c..0dd3072f18 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php @@ -97,6 +97,12 @@ class ClientConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>int32 messages_per_stream = 18;</code> */ private $messages_per_stream = 0; + /** + * Use coalescing API when possible. + * + * Generated from protobuf field <code>bool use_coalesce_api = 19;</code> + */ + private $use_coalesce_api = false; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); @@ -495,5 +501,31 @@ class ClientConfig extends \Google\Protobuf\Internal\Message return $this; } + /** + * Use coalescing API when possible. + * + * Generated from protobuf field <code>bool use_coalesce_api = 19;</code> + * @return bool + */ + public function getUseCoalesceApi() + { + return $this->use_coalesce_api; + } + + /** + * Use coalescing API when possible. + * + * Generated from protobuf field <code>bool use_coalesce_api = 19;</code> + * @param bool $var + * @return $this + */ + public function setUseCoalesceApi($var) + { + GPBUtil::checkBool($var); + $this->use_coalesce_api = $var; + + return $this; + } + } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php b/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php new file mode 100644 index 0000000000..805b629b0d --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php @@ -0,0 +1,77 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Message to be echoed back serialized in trailer. + * + * Generated from protobuf message <code>grpc.testing.DebugInfo</code> + */ +class DebugInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>repeated string stack_entries = 1;</code> + */ + private $stack_entries; + /** + * Generated from protobuf field <code>string detail = 2;</code> + */ + private $detail = ''; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>repeated string stack_entries = 1;</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStackEntries() + { + return $this->stack_entries; + } + + /** + * Generated from protobuf field <code>repeated string stack_entries = 1;</code> + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStackEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->stack_entries = $arr; + + return $this; + } + + /** + * Generated from protobuf field <code>string detail = 2;</code> + * @return string + */ + public function getDetail() + { + return $this->detail; + } + + /** + * Generated from protobuf field <code>string detail = 2;</code> + * @param string $var + * @return $this + */ + public function setDetail($var) + { + GPBUtil::checkString($var, True); + $this->detail = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php new file mode 100644 index 0000000000..9aadfc5dee --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php @@ -0,0 +1,75 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.EchoRequest</code> + */ +class EchoRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>string message = 1;</code> + */ + private $message = ''; + /** + * Generated from protobuf field <code>.grpc.testing.RequestParams param = 2;</code> + */ + private $param = null; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>string message = 1;</code> + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Generated from protobuf field <code>string message = 1;</code> + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>.grpc.testing.RequestParams param = 2;</code> + * @return \Grpc\Testing\RequestParams + */ + public function getParam() + { + return $this->param; + } + + /** + * Generated from protobuf field <code>.grpc.testing.RequestParams param = 2;</code> + * @param \Grpc\Testing\RequestParams $var + * @return $this + */ + public function setParam($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\RequestParams::class); + $this->param = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php new file mode 100644 index 0000000000..c4a9db35ab --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php @@ -0,0 +1,75 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.EchoResponse</code> + */ +class EchoResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>string message = 1;</code> + */ + private $message = ''; + /** + * Generated from protobuf field <code>.grpc.testing.ResponseParams param = 2;</code> + */ + private $param = null; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>string message = 1;</code> + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Generated from protobuf field <code>string message = 1;</code> + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>.grpc.testing.ResponseParams param = 2;</code> + * @return \Grpc\Testing\ResponseParams + */ + public function getParam() + { + return $this->param; + } + + /** + * Generated from protobuf field <code>.grpc.testing.ResponseParams param = 2;</code> + * @param \Grpc\Testing\ResponseParams $var + * @return $this + */ + public function setParam($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\ResponseParams::class); + $this->param = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EchoTestServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/EchoTestServiceClient.php new file mode 100644 index 0000000000..b3dcf5b7af --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoTestServiceClient.php @@ -0,0 +1,93 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +namespace Grpc\Testing; + +/** + */ +class EchoTestServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * @param \Grpc\Testing\EchoRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Echo(\Grpc\Testing\EchoRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.EchoTestService/Echo', + $argument, + ['\Grpc\Testing\EchoResponse', 'decode'], + $metadata, $options); + } + + /** + * @param array $metadata metadata + * @param array $options call options + */ + public function RequestStream($metadata = [], $options = []) { + return $this->_clientStreamRequest('/grpc.testing.EchoTestService/RequestStream', + ['\Grpc\Testing\EchoResponse','decode'], + $metadata, $options); + } + + /** + * @param \Grpc\Testing\EchoRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ResponseStream(\Grpc\Testing\EchoRequest $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/grpc.testing.EchoTestService/ResponseStream', + $argument, + ['\Grpc\Testing\EchoResponse', 'decode'], + $metadata, $options); + } + + /** + * @param array $metadata metadata + * @param array $options call options + */ + public function BidiStream($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.EchoTestService/BidiStream', + ['\Grpc\Testing\EchoResponse','decode'], + $metadata, $options); + } + + /** + * @param \Grpc\Testing\EchoRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Unimplemented(\Grpc\Testing\EchoRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.EchoTestService/Unimplemented', + $argument, + ['\Grpc\Testing\EchoResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php b/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php new file mode 100644 index 0000000000..3da163e7c0 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php @@ -0,0 +1,23 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/metrics.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.EmptyMessage</code> + */ +class EmptyMessage extends \Google\Protobuf\Internal\Message +{ + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\Metrics::initOnce(); + parent::__construct(); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php b/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php new file mode 100644 index 0000000000..cc378756c7 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php @@ -0,0 +1,103 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Error status client expects to see. + * + * Generated from protobuf message <code>grpc.testing.ErrorStatus</code> + */ +class ErrorStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>int32 code = 1;</code> + */ + private $code = 0; + /** + * Generated from protobuf field <code>string error_message = 2;</code> + */ + private $error_message = ''; + /** + * Generated from protobuf field <code>string binary_error_details = 3;</code> + */ + private $binary_error_details = ''; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>int32 code = 1;</code> + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Generated from protobuf field <code>int32 code = 1;</code> + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkInt32($var); + $this->code = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>string error_message = 2;</code> + * @return string + */ + public function getErrorMessage() + { + return $this->error_message; + } + + /** + * Generated from protobuf field <code>string error_message = 2;</code> + * @param string $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkString($var, True); + $this->error_message = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>string binary_error_details = 3;</code> + * @return string + */ + public function getBinaryErrorDetails() + { + return $this->binary_error_details; + } + + /** + * Generated from protobuf field <code>string binary_error_details = 3;</code> + * @param string $var + * @return $this + */ + public function setBinaryErrorDetails($var) + { + GPBUtil::checkString($var, True); + $this->binary_error_details = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/GaugeRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/GaugeRequest.php new file mode 100644 index 0000000000..3c283693c9 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/GaugeRequest.php @@ -0,0 +1,51 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/metrics.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Request message containing the gauge name + * + * Generated from protobuf message <code>grpc.testing.GaugeRequest</code> + */ +class GaugeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>string name = 1;</code> + */ + private $name = ''; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\Metrics::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>string name = 1;</code> + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field <code>string name = 1;</code> + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/GaugeResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/GaugeResponse.php new file mode 100644 index 0000000000..da658ba198 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/GaugeResponse.php @@ -0,0 +1,126 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/metrics.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Reponse message containing the gauge name and value + * + * Generated from protobuf message <code>grpc.testing.GaugeResponse</code> + */ +class GaugeResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>string name = 1;</code> + */ + private $name = ''; + protected $value; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\Metrics::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>string name = 1;</code> + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field <code>string name = 1;</code> + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>int64 long_value = 2;</code> + * @return int|string + */ + public function getLongValue() + { + return $this->readOneof(2); + } + + /** + * Generated from protobuf field <code>int64 long_value = 2;</code> + * @param int|string $var + * @return $this + */ + public function setLongValue($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Generated from protobuf field <code>double double_value = 3;</code> + * @return float + */ + public function getDoubleValue() + { + return $this->readOneof(3); + } + + /** + * Generated from protobuf field <code>double double_value = 3;</code> + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Generated from protobuf field <code>string string_value = 4;</code> + * @return string + */ + public function getStringValue() + { + return $this->readOneof(4); + } + + /** + * Generated from protobuf field <code>string string_value = 4;</code> + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/MetricsServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/MetricsServiceClient.php new file mode 100644 index 0000000000..491ccbce72 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/MetricsServiceClient.php @@ -0,0 +1,69 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Contains the definitions for a metrics service and the type of metrics +// exposed by the service. +// +// Currently, 'Gauge' (i.e a metric that represents the measured value of +// something at an instant of time) is the only metric type supported by the +// service. +namespace Grpc\Testing; + +/** + */ +class MetricsServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * Returns the values of all the gauges that are currently being maintained by + * the service + * @param \Grpc\Testing\EmptyMessage $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetAllGauges(\Grpc\Testing\EmptyMessage $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/grpc.testing.MetricsService/GetAllGauges', + $argument, + ['\Grpc\Testing\GaugeResponse', 'decode'], + $metadata, $options); + } + + /** + * Returns the value of one gauge + * @param \Grpc\Testing\GaugeRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetGauge(\Grpc\Testing\GaugeRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.MetricsService/GetGauge', + $argument, + ['\Grpc\Testing\GaugeResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/NoRpcServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/NoRpcServiceClient.php new file mode 100644 index 0000000000..1d58eaf88a --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/NoRpcServiceClient.php @@ -0,0 +1,35 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +namespace Grpc\Testing; + +/** + * A service without any rpc defined to test coverage. + */ +class NoRpcServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/PBEmpty.php b/src/php/tests/qps/generated_code/Grpc/Testing/PBEmpty.php new file mode 100644 index 0000000000..a1fe9df454 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PBEmpty.php @@ -0,0 +1,30 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/empty.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * 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) { }; + * }; + * + * Generated from protobuf message <code>grpc.testing.Empty</code> + */ +class PBEmpty extends \Google\Protobuf\Internal\Message +{ + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\GPBEmpty::initOnce(); + parent::__construct(); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php b/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php new file mode 100644 index 0000000000..94cb6c1ecf --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php @@ -0,0 +1,23 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/control.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.Void</code> + */ +class PBVoid extends \Google\Protobuf\Internal\Message +{ + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); + parent::__construct(); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php index 5510b57064..c0e304929d 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php @@ -32,11 +32,11 @@ class ProxyClientServiceClient extends \Grpc\BaseStub { } /** - * @param \Grpc\Testing\Void $argument input argument + * @param \Grpc\Testing\PBVoid $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function GetConfig(\Grpc\Testing\Void $argument, + public function GetConfig(\Grpc\Testing\PBVoid $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.ProxyClientService/GetConfig', $argument, @@ -50,7 +50,7 @@ class ProxyClientServiceClient extends \Grpc\BaseStub { */ public function ReportTime($metadata = [], $options = []) { return $this->_clientStreamRequest('/grpc.testing.ProxyClientService/ReportTime', - ['\Grpc\Testing\Void','decode'], + ['\Grpc\Testing\PBVoid','decode'], $metadata, $options); } @@ -60,7 +60,7 @@ class ProxyClientServiceClient extends \Grpc\BaseStub { */ public function ReportHist($metadata = [], $options = []) { return $this->_clientStreamRequest('/grpc.testing.ProxyClientService/ReportHist', - ['\Grpc\Testing\Void','decode'], + ['\Grpc\Testing\PBVoid','decode'], $metadata, $options); } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php new file mode 100644 index 0000000000..a1802e97cd --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php @@ -0,0 +1,64 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +// +namespace Grpc\Testing; + +/** + * A service used to control reconnect server. + */ +class ReconnectServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * @param \Grpc\Testing\ReconnectParams $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Start(\Grpc\Testing\ReconnectParams $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.ReconnectService/Start', + $argument, + ['\Grpc\Testing\PBEmpty', 'decode'], + $metadata, $options); + } + + /** + * @param \Grpc\Testing\PBEmpty $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Stop(\Grpc\Testing\PBEmpty $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.ReconnectService/Stop', + $argument, + ['\Grpc\Testing\ReconnectInfo', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php index 72d44ffc66..3abb5abe6d 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php @@ -43,7 +43,7 @@ class ReportQpsScenarioServiceClient extends \Grpc\BaseStub { $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.ReportQpsScenarioService/ReportScenario', $argument, - ['\Grpc\Testing\Void', 'decode'], + ['\Grpc\Testing\PBVoid', 'decode'], $metadata, $options); } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Request.php b/src/php/tests/qps/generated_code/Grpc/Testing/Request.php new file mode 100644 index 0000000000..6a20f6a897 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Request.php @@ -0,0 +1,23 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/compiler_test.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.Request</code> + */ +class Request extends \Google\Protobuf\Internal\Message +{ + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\CompilerTest::initOnce(); + parent::__construct(); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php new file mode 100644 index 0000000000..f01f50d5af --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php @@ -0,0 +1,431 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.RequestParams</code> + */ +class RequestParams extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>bool echo_deadline = 1;</code> + */ + private $echo_deadline = false; + /** + * Generated from protobuf field <code>int32 client_cancel_after_us = 2;</code> + */ + private $client_cancel_after_us = 0; + /** + * Generated from protobuf field <code>int32 server_cancel_after_us = 3;</code> + */ + private $server_cancel_after_us = 0; + /** + * Generated from protobuf field <code>bool echo_metadata = 4;</code> + */ + private $echo_metadata = false; + /** + * Generated from protobuf field <code>bool check_auth_context = 5;</code> + */ + private $check_auth_context = false; + /** + * Generated from protobuf field <code>int32 response_message_length = 6;</code> + */ + private $response_message_length = 0; + /** + * Generated from protobuf field <code>bool echo_peer = 7;</code> + */ + private $echo_peer = false; + /** + * will force check_auth_context. + * + * Generated from protobuf field <code>string expected_client_identity = 8;</code> + */ + private $expected_client_identity = ''; + /** + * Generated from protobuf field <code>bool skip_cancelled_check = 9;</code> + */ + private $skip_cancelled_check = false; + /** + * Generated from protobuf field <code>string expected_transport_security_type = 10;</code> + */ + private $expected_transport_security_type = ''; + /** + * Generated from protobuf field <code>.grpc.testing.DebugInfo debug_info = 11;</code> + */ + private $debug_info = null; + /** + * Server should not see a request with this set. + * + * Generated from protobuf field <code>bool server_die = 12;</code> + */ + private $server_die = false; + /** + * Generated from protobuf field <code>string binary_error_details = 13;</code> + */ + private $binary_error_details = ''; + /** + * Generated from protobuf field <code>.grpc.testing.ErrorStatus expected_error = 14;</code> + */ + private $expected_error = null; + /** + * Amount to sleep when invoking server + * + * Generated from protobuf field <code>int32 server_sleep_us = 15;</code> + */ + private $server_sleep_us = 0; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>bool echo_deadline = 1;</code> + * @return bool + */ + public function getEchoDeadline() + { + return $this->echo_deadline; + } + + /** + * Generated from protobuf field <code>bool echo_deadline = 1;</code> + * @param bool $var + * @return $this + */ + public function setEchoDeadline($var) + { + GPBUtil::checkBool($var); + $this->echo_deadline = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>int32 client_cancel_after_us = 2;</code> + * @return int + */ + public function getClientCancelAfterUs() + { + return $this->client_cancel_after_us; + } + + /** + * Generated from protobuf field <code>int32 client_cancel_after_us = 2;</code> + * @param int $var + * @return $this + */ + public function setClientCancelAfterUs($var) + { + GPBUtil::checkInt32($var); + $this->client_cancel_after_us = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>int32 server_cancel_after_us = 3;</code> + * @return int + */ + public function getServerCancelAfterUs() + { + return $this->server_cancel_after_us; + } + + /** + * Generated from protobuf field <code>int32 server_cancel_after_us = 3;</code> + * @param int $var + * @return $this + */ + public function setServerCancelAfterUs($var) + { + GPBUtil::checkInt32($var); + $this->server_cancel_after_us = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>bool echo_metadata = 4;</code> + * @return bool + */ + public function getEchoMetadata() + { + return $this->echo_metadata; + } + + /** + * Generated from protobuf field <code>bool echo_metadata = 4;</code> + * @param bool $var + * @return $this + */ + public function setEchoMetadata($var) + { + GPBUtil::checkBool($var); + $this->echo_metadata = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>bool check_auth_context = 5;</code> + * @return bool + */ + public function getCheckAuthContext() + { + return $this->check_auth_context; + } + + /** + * Generated from protobuf field <code>bool check_auth_context = 5;</code> + * @param bool $var + * @return $this + */ + public function setCheckAuthContext($var) + { + GPBUtil::checkBool($var); + $this->check_auth_context = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>int32 response_message_length = 6;</code> + * @return int + */ + public function getResponseMessageLength() + { + return $this->response_message_length; + } + + /** + * Generated from protobuf field <code>int32 response_message_length = 6;</code> + * @param int $var + * @return $this + */ + public function setResponseMessageLength($var) + { + GPBUtil::checkInt32($var); + $this->response_message_length = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>bool echo_peer = 7;</code> + * @return bool + */ + public function getEchoPeer() + { + return $this->echo_peer; + } + + /** + * Generated from protobuf field <code>bool echo_peer = 7;</code> + * @param bool $var + * @return $this + */ + public function setEchoPeer($var) + { + GPBUtil::checkBool($var); + $this->echo_peer = $var; + + return $this; + } + + /** + * will force check_auth_context. + * + * Generated from protobuf field <code>string expected_client_identity = 8;</code> + * @return string + */ + public function getExpectedClientIdentity() + { + return $this->expected_client_identity; + } + + /** + * will force check_auth_context. + * + * Generated from protobuf field <code>string expected_client_identity = 8;</code> + * @param string $var + * @return $this + */ + public function setExpectedClientIdentity($var) + { + GPBUtil::checkString($var, True); + $this->expected_client_identity = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>bool skip_cancelled_check = 9;</code> + * @return bool + */ + public function getSkipCancelledCheck() + { + return $this->skip_cancelled_check; + } + + /** + * Generated from protobuf field <code>bool skip_cancelled_check = 9;</code> + * @param bool $var + * @return $this + */ + public function setSkipCancelledCheck($var) + { + GPBUtil::checkBool($var); + $this->skip_cancelled_check = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>string expected_transport_security_type = 10;</code> + * @return string + */ + public function getExpectedTransportSecurityType() + { + return $this->expected_transport_security_type; + } + + /** + * Generated from protobuf field <code>string expected_transport_security_type = 10;</code> + * @param string $var + * @return $this + */ + public function setExpectedTransportSecurityType($var) + { + GPBUtil::checkString($var, True); + $this->expected_transport_security_type = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>.grpc.testing.DebugInfo debug_info = 11;</code> + * @return \Grpc\Testing\DebugInfo + */ + public function getDebugInfo() + { + return $this->debug_info; + } + + /** + * Generated from protobuf field <code>.grpc.testing.DebugInfo debug_info = 11;</code> + * @param \Grpc\Testing\DebugInfo $var + * @return $this + */ + public function setDebugInfo($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\DebugInfo::class); + $this->debug_info = $var; + + return $this; + } + + /** + * Server should not see a request with this set. + * + * Generated from protobuf field <code>bool server_die = 12;</code> + * @return bool + */ + public function getServerDie() + { + return $this->server_die; + } + + /** + * Server should not see a request with this set. + * + * Generated from protobuf field <code>bool server_die = 12;</code> + * @param bool $var + * @return $this + */ + public function setServerDie($var) + { + GPBUtil::checkBool($var); + $this->server_die = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>string binary_error_details = 13;</code> + * @return string + */ + public function getBinaryErrorDetails() + { + return $this->binary_error_details; + } + + /** + * Generated from protobuf field <code>string binary_error_details = 13;</code> + * @param string $var + * @return $this + */ + public function setBinaryErrorDetails($var) + { + GPBUtil::checkString($var, True); + $this->binary_error_details = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>.grpc.testing.ErrorStatus expected_error = 14;</code> + * @return \Grpc\Testing\ErrorStatus + */ + public function getExpectedError() + { + return $this->expected_error; + } + + /** + * Generated from protobuf field <code>.grpc.testing.ErrorStatus expected_error = 14;</code> + * @param \Grpc\Testing\ErrorStatus $var + * @return $this + */ + public function setExpectedError($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\ErrorStatus::class); + $this->expected_error = $var; + + return $this; + } + + /** + * Amount to sleep when invoking server + * + * Generated from protobuf field <code>int32 server_sleep_us = 15;</code> + * @return int + */ + public function getServerSleepUs() + { + return $this->server_sleep_us; + } + + /** + * Amount to sleep when invoking server + * + * Generated from protobuf field <code>int32 server_sleep_us = 15;</code> + * @param int $var + * @return $this + */ + public function setServerSleepUs($var) + { + GPBUtil::checkInt32($var); + $this->server_sleep_us = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Response.php b/src/php/tests/qps/generated_code/Grpc/Testing/Response.php new file mode 100644 index 0000000000..7925a7db3d --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Response.php @@ -0,0 +1,23 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/compiler_test.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.Response</code> + */ +class Response extends \Google\Protobuf\Internal\Message +{ + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\CompilerTest::initOnce(); + parent::__construct(); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php new file mode 100644 index 0000000000..d20f92289a --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php @@ -0,0 +1,101 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: src/proto/grpc/testing/echo_messages.proto + +namespace Grpc\Testing; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>grpc.testing.ResponseParams</code> + */ +class ResponseParams extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>int64 request_deadline = 1;</code> + */ + private $request_deadline = 0; + /** + * Generated from protobuf field <code>string host = 2;</code> + */ + private $host = ''; + /** + * Generated from protobuf field <code>string peer = 3;</code> + */ + private $peer = ''; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field <code>int64 request_deadline = 1;</code> + * @return int|string + */ + public function getRequestDeadline() + { + return $this->request_deadline; + } + + /** + * Generated from protobuf field <code>int64 request_deadline = 1;</code> + * @param int|string $var + * @return $this + */ + public function setRequestDeadline($var) + { + GPBUtil::checkInt64($var); + $this->request_deadline = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>string host = 2;</code> + * @return string + */ + public function getHost() + { + return $this->host; + } + + /** + * Generated from protobuf field <code>string host = 2;</code> + * @param string $var + * @return $this + */ + public function setHost($var) + { + GPBUtil::checkString($var, True); + $this->host = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>string peer = 3;</code> + * @return string + */ + public function getPeer() + { + return $this->peer; + } + + /** + * Generated from protobuf field <code>string peer = 3;</code> + * @param string $var + * @return $this + */ + public function setPeer($var) + { + GPBUtil::checkString($var, True); + $this->peer = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServiceAClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServiceAClient.php new file mode 100644 index 0000000000..df469cbea3 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServiceAClient.php @@ -0,0 +1,97 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// File detached comment 1 +// +// File detached comment 2 +// +// File leading comment 1 +namespace Grpc\Testing; + +/** + * ServiceA detached comment 1 + * + * ServiceA detached comment 2 + * + * ServiceA leading comment 1 + */ +class ServiceAClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * MethodA1 leading comment 1 + * @param \Grpc\Testing\Request $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function MethodA1(\Grpc\Testing\Request $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.ServiceA/MethodA1', + $argument, + ['\Grpc\Testing\Response', 'decode'], + $metadata, $options); + } + + /** + * MethodA2 detached leading comment 1 + * + * Method A2 leading comment 1 + * Method A2 leading comment 2 + * @param array $metadata metadata + * @param array $options call options + */ + public function MethodA2($metadata = [], $options = []) { + return $this->_clientStreamRequest('/grpc.testing.ServiceA/MethodA2', + ['\Grpc\Testing\Response','decode'], + $metadata, $options); + } + + /** + * Method A3 leading comment 1 + * @param \Grpc\Testing\Request $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function MethodA3(\Grpc\Testing\Request $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/grpc.testing.ServiceA/MethodA3', + $argument, + ['\Grpc\Testing\Response', 'decode'], + $metadata, $options); + } + + /** + * Method A4 leading comment 1 + * @param array $metadata metadata + * @param array $options call options + */ + public function MethodA4($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.ServiceA/MethodA4', + ['\Grpc\Testing\Response','decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServiceBClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServiceBClient.php new file mode 100644 index 0000000000..54acf6364f --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServiceBClient.php @@ -0,0 +1,54 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// File detached comment 1 +// +// File detached comment 2 +// +// File leading comment 1 +namespace Grpc\Testing; + +/** + * ServiceB leading comment 1 + */ +class ServiceBClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * MethodB1 leading comment 1 + * @param \Grpc\Testing\Request $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function MethodB1(\Grpc\Testing\Request $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.ServiceB/MethodB1', + $argument, + ['\Grpc\Testing\Response', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php new file mode 100644 index 0000000000..7da9713d65 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php @@ -0,0 +1,152 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +// +namespace Grpc\Testing; + +/** + * A simple service to test the various types of RPCs and experiment with + * performance with various types of payload. + */ +class TestServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * One empty request followed by one empty response. + * @param \Grpc\Testing\PBEmpty $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function EmptyCall(\Grpc\Testing\PBEmpty $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/EmptyCall', + $argument, + ['\Grpc\Testing\PBEmpty', '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\PBEmpty $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnimplementedCall(\Grpc\Testing\PBEmpty $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/UnimplementedCall', + $argument, + ['\Grpc\Testing\PBEmpty', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedEchoServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedEchoServiceClient.php new file mode 100644 index 0000000000..fee0daa70c --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedEchoServiceClient.php @@ -0,0 +1,47 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +namespace Grpc\Testing; + +/** + */ +class UnimplementedEchoServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * @param \Grpc\Testing\EchoRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function Unimplemented(\Grpc\Testing\EchoRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.UnimplementedEchoService/Unimplemented', + $argument, + ['\Grpc\Testing\EchoResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php new file mode 100644 index 0000000000..53b2020f19 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php @@ -0,0 +1,53 @@ +<?php +// GENERATED CODE -- DO NOT EDIT! + +// Original file comments: +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +// +namespace Grpc\Testing; + +/** + * A simple service NOT implemented at servers so clients can test for + * that case. + */ +class UnimplementedServiceClient extends \Grpc\BaseStub { + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param \Grpc\Channel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) { + parent::__construct($hostname, $opts, $channel); + } + + /** + * A call that no server should implement + * @param \Grpc\Testing\PBEmpty $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnimplementedCall(\Grpc\Testing\PBEmpty $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.UnimplementedService/UnimplementedCall', + $argument, + ['\Grpc\Testing\PBEmpty', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php index 98c244ff9d..366e36529e 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php @@ -81,15 +81,15 @@ class WorkerServiceClient extends \Grpc\BaseStub { /** * Quit this worker - * @param \Grpc\Testing\Void $argument input argument + * @param \Grpc\Testing\PBVoid $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function QuitWorker(\Grpc\Testing\Void $argument, + public function QuitWorker(\Grpc\Testing\PBVoid $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.WorkerService/QuitWorker', $argument, - ['\Grpc\Testing\Void', 'decode'], + ['\Grpc\Testing\PBVoid', 'decode'], $metadata, $options); } diff --git a/src/php/tests/unit_tests/InterceptorTest.php b/src/php/tests/unit_tests/InterceptorTest.php new file mode 100644 index 0000000000..08f5abbb21 --- /dev/null +++ b/src/php/tests/unit_tests/InterceptorTest.php @@ -0,0 +1,427 @@ +<?php +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +/** + * Interface exported by the server. + */ +require_once(dirname(__FILE__).'/../../lib/Grpc/BaseStub.php'); +require_once(dirname(__FILE__).'/../../lib/Grpc/AbstractCall.php'); +require_once(dirname(__FILE__).'/../../lib/Grpc/UnaryCall.php'); +require_once(dirname(__FILE__).'/../../lib/Grpc/ClientStreamingCall.php'); +require_once(dirname(__FILE__).'/../../lib/Grpc/Interceptor.php'); +require_once(dirname(__FILE__).'/../../lib/Grpc/Internal/InterceptorChannel.php'); + +class SimpleRequest +{ + private $data; + public function __construct($data) + { + $this->data = $data; + } + public function setData($data) + { + $this->data = $data; + } + public function serializeToString() + { + return $this->data; + } +} + +class InterceptorClient extends Grpc\BaseStub +{ + + /** + * @param string $hostname hostname + * @param array $opts channel options + * @param Channel|InterceptorChannel $channel (optional) re-use channel object + */ + public function __construct($hostname, $opts, $channel = null) + { + parent::__construct($hostname, $opts, $channel); + } + + /** + * A simple RPC. + * @param \Routeguide\Point $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnaryCall( + SimpleRequest $argument, + $metadata = [], + $options = [] + ) { + return $this->_simpleRequest( + '/dummy_method', + $argument, + [], + $metadata, + $options + ); + } + + /** + * A client-to-server streaming RPC. + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamCall( + $metadata = [], + $options = [] + ) { + return $this->_clientStreamRequest('/dummy_method', [], $metadata, $options); + } +} + + +class ChangeMetadataInterceptor extends Grpc\Interceptor +{ + public function interceptUnaryUnary($method, + $argument, + array $metadata = [], + array $options = [], + $continuation) + { + $metadata["foo"] = array('interceptor_from_unary_request'); + return $continuation($method, $argument, $metadata, $options); + } + public function interceptStreamUnary($method, array $metadata = [], array $options = [], $continuation) + { + $metadata["foo"] = array('interceptor_from_stream_request'); + return $continuation($method, $metadata, $options); + } +} + +class ChangeMetadataInterceptor2 extends Grpc\Interceptor +{ + public function interceptUnaryUnary($method, + $argument, + array $metadata = [], + array $options = [], + $continuation) + { + if (array_key_exists('foo', $metadata)) { + $metadata['bar'] = array('ChangeMetadataInterceptor should be executed first'); + } else { + $metadata["bar"] = array('interceptor_from_unary_request'); + } + return $continuation($method, $argument, $metadata, $options); + } + public function interceptStreamUnary($method, + array $metadata = [], + array $options = [], + $continuation) + { + if (array_key_exists('foo', $metadata)) { + $metadata['bar'] = array('ChangeMetadataInterceptor should be executed first'); + } else { + $metadata["bar"] = array('interceptor_from_stream_request'); + } + return $continuation($method, $metadata, $options); + } +} + +class ChangeRequestCall +{ + private $call; + + public function __construct($call) + { + $this->call = $call; + } + public function getCall() + { + return $this->call; + } + + public function write($request) + { + $request->setData('intercepted_stream_request'); + $this->getCall()->write($request); + } + + public function wait() + { + return $this->getCall()->wait(); + } +} + +class ChangeRequestInterceptor extends Grpc\Interceptor +{ + public function interceptUnaryUnary($method, + $argument, + array $metadata = [], + array $options = [], + $continuation) + { + $argument->setData('intercepted_unary_request'); + return $continuation($method, $argument, $metadata, $options); + } + public function interceptStreamUnary($method, array $metadata = [], array $options = [], $continuation) + { + return new ChangeRequestCall( + $continuation($method, $metadata, $options) + ); + } +} + +class StopCallInterceptor extends Grpc\Interceptor +{ + public function interceptUnaryUnary($method, + $argument, + array $metadata = [], + array $options = [], + $continuation) + { + $metadata["foo"] = array('interceptor_from_request_response'); + } + public function interceptStreamUnary($method, + array $metadata = [], + array $options = [], + $continuation) + { + $metadata["foo"] = array('interceptor_from_request_response'); + } +} + +class InterceptorTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + $this->server = new Grpc\Server([]); + $this->port = $this->server->addHttp2Port('0.0.0.0:0'); + $this->channel = new Grpc\Channel('localhost:'.$this->port, ['credentials' => Grpc\ChannelCredentials::createInsecure()]); + $this->server->start(); + } + + public function tearDown() + { + $this->channel->close(); + } + + + public function testClientChangeMetadataOneInterceptor() + { + $req_text = 'client_request'; + $channel_matadata_interceptor = new ChangeMetadataInterceptor(); + $intercept_channel = Grpc\Interceptor::intercept($this->channel, $channel_matadata_interceptor); + echo "create Client\n"; + $client = new InterceptorClient('localhost:'.$this->port, [ + 'credentials' => Grpc\ChannelCredentials::createInsecure(), + ], $intercept_channel); + echo "create Call\n"; + $req = new SimpleRequest($req_text); + echo "Call created\n"; + $unary_call = $client->UnaryCall($req); + echo "start call\n"; + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $this->assertSame(['interceptor_from_unary_request'], $event->metadata['foo']); + + $stream_call = $client->StreamCall(); + $stream_call->write($req); + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $this->assertSame(['interceptor_from_stream_request'], $event->metadata['foo']); + + unset($unary_call); + unset($stream_call); + unset($server_call); + } + + public function testClientChangeMetadataTwoInterceptor() + { + $req_text = 'client_request'; + $channel_matadata_interceptor = new ChangeMetadataInterceptor(); + $channel_matadata_intercepto2 = new ChangeMetadataInterceptor2(); + // test intercept separately. + $intercept_channel1 = Grpc\Interceptor::intercept($this->channel, $channel_matadata_interceptor); + $intercept_channel2 = Grpc\Interceptor::intercept($intercept_channel1, $channel_matadata_intercepto2); + $client = new InterceptorClient('localhost:'.$this->port, [ + 'credentials' => Grpc\ChannelCredentials::createInsecure(), + ], $intercept_channel2); + + $req = new SimpleRequest($req_text); + $unary_call = $client->UnaryCall($req); + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $this->assertSame(['interceptor_from_unary_request'], $event->metadata['foo']); + $this->assertSame(['interceptor_from_unary_request'], $event->metadata['bar']); + + $stream_call = $client->StreamCall(); + $stream_call->write($req); + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $this->assertSame(['interceptor_from_stream_request'], $event->metadata['foo']); + $this->assertSame(['interceptor_from_stream_request'], $event->metadata['bar']); + + unset($unary_call); + unset($stream_call); + unset($server_call); + + // test intercept by array. + $intercept_channel3 = Grpc\Interceptor::intercept($this->channel, + [$channel_matadata_intercepto2, $channel_matadata_interceptor]); + $client = new InterceptorClient('localhost:'.$this->port, [ + 'credentials' => Grpc\ChannelCredentials::createInsecure(), + ], $intercept_channel3); + + $req = new SimpleRequest($req_text); + $unary_call = $client->UnaryCall($req); + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $this->assertSame(['interceptor_from_unary_request'], $event->metadata['foo']); + $this->assertSame(['interceptor_from_unary_request'], $event->metadata['bar']); + + $stream_call = $client->StreamCall(); + $stream_call->write($req); + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $this->assertSame(['interceptor_from_stream_request'], $event->metadata['foo']); + $this->assertSame(['interceptor_from_stream_request'], $event->metadata['bar']); + + unset($unary_call); + unset($stream_call); + unset($server_call); + } + + public function testClientChangeRequestInterceptor() + { + $req_text = 'client_request'; + $change_request_interceptor = new ChangeRequestInterceptor(); + $intercept_channel = Grpc\Interceptor::intercept($this->channel, + $change_request_interceptor); + $client = new InterceptorClient('localhost:'.$this->port, [ + 'credentials' => Grpc\ChannelCredentials::createInsecure(), + ], $intercept_channel); + + $req = new SimpleRequest($req_text); + $unary_call = $client->UnaryCall($req); + + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $server_call = $event->call; + $event = $server_call->startBatch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_STATUS_FROM_SERVER => [ + 'metadata' => [], + 'code' => Grpc\STATUS_OK, + 'details' => '', + ], + Grpc\OP_RECV_MESSAGE => true, + Grpc\OP_RECV_CLOSE_ON_SERVER => true, + ]); + $this->assertSame('intercepted_unary_request', $event->message); + + $stream_call = $client->StreamCall(); + $stream_call->write($req); + $event = $this->server->requestCall(); + $this->assertSame('/dummy_method', $event->method); + $server_call = $event->call; + $event = $server_call->startBatch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_STATUS_FROM_SERVER => [ + 'metadata' => [], + 'code' => Grpc\STATUS_OK, + 'details' => '', + ], + Grpc\OP_RECV_MESSAGE => true, + Grpc\OP_RECV_CLOSE_ON_SERVER => true, + ]); + $this->assertSame('intercepted_stream_request', $event->message); + + unset($unary_call); + unset($stream_call); + unset($server_call); + } + + public function testClientChangeStopCallInterceptor() + { + $req_text = 'client_request'; + $channel_request_interceptor = new StopCallInterceptor(); + $intercept_channel = Grpc\Interceptor::intercept($this->channel, + $channel_request_interceptor); + $client = new InterceptorClient('localhost:'.$this->port, [ + 'credentials' => Grpc\ChannelCredentials::createInsecure(), + ], $intercept_channel); + + $req = new SimpleRequest($req_text); + $unary_call = $client->UnaryCall($req); + $this->assertNull($unary_call); + + + $stream_call = $client->StreamCall(); + $this->assertNull($stream_call); + + unset($unary_call); + unset($stream_call); + unset($server_call); + } + + public function testGetInterceptorChannelConnectivityState() + { + $channel = new Grpc\Channel( + 'localhost:0', + ['credentials' => Grpc\ChannelCredentials::createInsecure()] + ); + $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); + $state = $interceptor_channel->getConnectivityState(); + $this->assertEquals(0, $state); + $channel->close(); + } + + public function testInterceptorChannelWatchConnectivityState() + { + $channel = new Grpc\Channel( + 'localhost:0', + ['credentials' => Grpc\ChannelCredentials::createInsecure()] + ); + $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); + $now = Grpc\Timeval::now(); + $deadline = $now->add(new Grpc\Timeval(100*1000)); + $state = $interceptor_channel->watchConnectivityState(1, $deadline); + $this->assertTrue($state); + unset($time); + unset($deadline); + $channel->close(); + } + + public function testInterceptorChannelClose() + { + $channel = new Grpc\Channel( + 'localhost:0', + ['credentials' => Grpc\ChannelCredentials::createInsecure()] + ); + $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); + $this->assertNotNull($interceptor_channel); + $channel->close(); + } + + public function testInterceptorChannelGetTarget() + { + $channel = new Grpc\Channel( + 'localhost:8888', + ['credentials' => Grpc\ChannelCredentials::createInsecure()] + ); + $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); + $target = $interceptor_channel->getTarget(); + $this->assertTrue(is_string($target)); + $channel->close(); + } +} diff --git a/src/php/tests/unit_tests/ServerTest.php b/src/php/tests/unit_tests/ServerTest.php index fee9f1e644..ac6f2f0312 100644 --- a/src/php/tests/unit_tests/ServerTest.php +++ b/src/php/tests/unit_tests/ServerTest.php @@ -99,6 +99,24 @@ class ServerTest extends PHPUnit_Framework_TestCase /** * @expectedException InvalidArgumentException */ + public function testInvalidConstructorWithNumKeyOfArray() + { + $this->server = new Grpc\Server([10 => '127.0.0.1', + 20 => '8080', ]); + $this->assertNull($this->server); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testInvalidConstructorWithList() + { + $this->server = new Grpc\Server(['127.0.0.1', '8080']); + $this->assertNull($this->server); + } + /** + * @expectedException InvalidArgumentException + */ public function testInvalidAddHttp2Port() { $this->server = new Grpc\Server([]); |