aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-01-30 14:13:44 -0800
committerGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-01-30 14:13:44 -0800
commit484bc53582ee89a5412bab46ddb21d2cb5acabf2 (patch)
tree1c7fb4c894b69472af43ff8a20e50f3b7e892154 /src
parent16c7d4d1af43046d63e16569f6ee49ac066969e5 (diff)
parentf21eb2573b398a83dedf3d2123e1d8438106b492 (diff)
Merge pull request #309 from murgatroid99/php_interop_failures
Fix a couple of PHP bugs that prevented the PHP interop test client from working
Diffstat (limited to 'src')
-rwxr-xr-xsrc/php/lib/Grpc/ActiveCall.php6
-rwxr-xr-xsrc/php/lib/Grpc/BaseStub.php4
-rwxr-xr-xsrc/php/tests/interop/empty.php9
-rwxr-xr-xsrc/php/tests/interop/interop_client.php2
-rwxr-xr-xsrc/php/tests/interop/messages.php213
-rwxr-xr-xsrc/php/tests/interop/test.php22
6 files changed, 159 insertions, 97 deletions
diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php
index 836a4b09e3..e0ea43ab08 100755
--- a/src/php/lib/Grpc/ActiveCall.php
+++ b/src/php/lib/Grpc/ActiveCall.php
@@ -28,9 +28,9 @@ class ActiveCall {
$this->flags = $flags;
// Invoke the call.
- $this->call->start_invoke($this->completion_queue,
- CLIENT_METADATA_READ,
- FINISHED, 0);
+ $this->call->invoke($this->completion_queue,
+ CLIENT_METADATA_READ,
+ FINISHED, 0);
$metadata_event = $this->completion_queue->pluck(CLIENT_METADATA_READ,
Timeval::inf_future());
$this->metadata = $metadata_event->data;
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index e1feb1206b..e745ec3709 100755
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -10,8 +10,8 @@ class BaseStub {
private $channel;
- public function __construct($hostname) {
- $this->channel = new Channel($hostname, []);
+ public function __construct($hostname, $opts) {
+ $this->channel = new Channel($hostname, $opts);
}
/**
diff --git a/src/php/tests/interop/empty.php b/src/php/tests/interop/empty.php
index 0107f2530b..3e4968fcc3 100755
--- a/src/php/tests/interop/empty.php
+++ b/src/php/tests/interop/empty.php
@@ -1,9 +1,9 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
-// Source: net/proto2/proto/empty.proto
-// Date: 2014-12-03 22:02:20
+// Source: test/cpp/interop/empty.proto
+// Date: 2015-01-30 21:44:54
-namespace proto2 {
+namespace grpc\testing {
class EmptyMessage extends \DrSlump\Protobuf\Message {
@@ -13,7 +13,7 @@ namespace proto2 {
public static function descriptor()
{
- $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'proto2.EmptyMessage');
+ $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.EmptyMessage');
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
@@ -23,4 +23,3 @@ namespace proto2 {
}
}
}
-
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index 43da47fd53..c83750635b 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -25,7 +25,7 @@ function hardAssert($value, $error_message) {
* @param $stub Stub object that has service methods
*/
function emptyUnary($stub) {
- list($result, $status) = $stub->EmptyCall(new proto2\EmptyMessage())->wait();
+ list($result, $status) = $stub->EmptyCall(new grpc\testing\EmptyMessage())->wait();
hardAssert($status->code == Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result != null, 'Call completed with a null response');
}
diff --git a/src/php/tests/interop/messages.php b/src/php/tests/interop/messages.php
index beaec7c0d8..bbdd296452 100755
--- a/src/php/tests/interop/messages.php
+++ b/src/php/tests/interop/messages.php
@@ -1,7 +1,7 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
-// Source: third_party/stubby/testing/proto/messages.proto
-// Date: 2014-12-03 22:02:20
+// Source: test/cpp/interop/messages.proto
+// Date: 2015-01-30 21:44:54
namespace grpc\testing {
@@ -142,6 +142,12 @@ namespace grpc\testing {
/** @var \grpc\testing\Payload */
public $payload = null;
+ /** @var boolean */
+ public $fill_username = null;
+
+ /** @var boolean */
+ public $fill_oauth_scope = null;
+
/** @var \Closure[] */
protected static $__extensions = array();
@@ -176,6 +182,22 @@ namespace grpc\testing {
$f->reference = '\grpc\testing\Payload';
$descriptor->addField($f);
+ // OPTIONAL BOOL fill_username = 4
+ $f = new \DrSlump\Protobuf\Field();
+ $f->number = 4;
+ $f->name = "fill_username";
+ $f->type = \DrSlump\Protobuf::TYPE_BOOL;
+ $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
+ $descriptor->addField($f);
+
+ // OPTIONAL BOOL fill_oauth_scope = 5
+ $f = new \DrSlump\Protobuf\Field();
+ $f->number = 5;
+ $f->name = "fill_oauth_scope";
+ $f->type = \DrSlump\Protobuf::TYPE_BOOL;
+ $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
+ $descriptor->addField($f);
+
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@@ -293,6 +315,80 @@ namespace grpc\testing {
public function setPayload(\grpc\testing\Payload $value){
return $this->_set(3, $value);
}
+
+ /**
+ * Check if <fill_username> has a value
+ *
+ * @return boolean
+ */
+ public function hasFillUsername(){
+ return $this->_has(4);
+ }
+
+ /**
+ * Clear <fill_username> value
+ *
+ * @return \grpc\testing\SimpleRequest
+ */
+ public function clearFillUsername(){
+ return $this->_clear(4);
+ }
+
+ /**
+ * Get <fill_username> value
+ *
+ * @return boolean
+ */
+ public function getFillUsername(){
+ return $this->_get(4);
+ }
+
+ /**
+ * Set <fill_username> value
+ *
+ * @param boolean $value
+ * @return \grpc\testing\SimpleRequest
+ */
+ public function setFillUsername( $value){
+ return $this->_set(4, $value);
+ }
+
+ /**
+ * Check if <fill_oauth_scope> has a value
+ *
+ * @return boolean
+ */
+ public function hasFillOauthScope(){
+ return $this->_has(5);
+ }
+
+ /**
+ * Clear <fill_oauth_scope> value
+ *
+ * @return \grpc\testing\SimpleRequest
+ */
+ public function clearFillOauthScope(){
+ return $this->_clear(5);
+ }
+
+ /**
+ * Get <fill_oauth_scope> value
+ *
+ * @return boolean
+ */
+ public function getFillOauthScope(){
+ return $this->_get(5);
+ }
+
+ /**
+ * Set <fill_oauth_scope> value
+ *
+ * @param boolean $value
+ * @return \grpc\testing\SimpleRequest
+ */
+ public function setFillOauthScope( $value){
+ return $this->_set(5, $value);
+ }
}
}
@@ -303,8 +399,11 @@ namespace grpc\testing {
/** @var \grpc\testing\Payload */
public $payload = null;
- /** @var int */
- public $effective_gaia_user_id = null;
+ /** @var string */
+ public $username = null;
+
+ /** @var string */
+ public $oauth_scope = null;
/** @var \Closure[] */
@@ -323,11 +422,19 @@ namespace grpc\testing {
$f->reference = '\grpc\testing\Payload';
$descriptor->addField($f);
- // OPTIONAL INT64 effective_gaia_user_id = 2
+ // OPTIONAL STRING username = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
- $f->name = "effective_gaia_user_id";
- $f->type = \DrSlump\Protobuf::TYPE_INT64;
+ $f->name = "username";
+ $f->type = \DrSlump\Protobuf::TYPE_STRING;
+ $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
+ $descriptor->addField($f);
+
+ // OPTIONAL STRING oauth_scope = 3
+ $f = new \DrSlump\Protobuf\Field();
+ $f->number = 3;
+ $f->name = "oauth_scope";
+ $f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
@@ -376,109 +483,77 @@ namespace grpc\testing {
}
/**
- * Check if <effective_gaia_user_id> has a value
+ * Check if <username> has a value
*
* @return boolean
*/
- public function hasEffectiveGaiaUserId(){
+ public function hasUsername(){
return $this->_has(2);
}
/**
- * Clear <effective_gaia_user_id> value
+ * Clear <username> value
*
* @return \grpc\testing\SimpleResponse
*/
- public function clearEffectiveGaiaUserId(){
+ public function clearUsername(){
return $this->_clear(2);
}
/**
- * Get <effective_gaia_user_id> value
+ * Get <username> value
*
- * @return int
+ * @return string
*/
- public function getEffectiveGaiaUserId(){
+ public function getUsername(){
return $this->_get(2);
}
/**
- * Set <effective_gaia_user_id> value
+ * Set <username> value
*
- * @param int $value
+ * @param string $value
* @return \grpc\testing\SimpleResponse
*/
- public function setEffectiveGaiaUserId( $value){
+ public function setUsername( $value){
return $this->_set(2, $value);
}
- }
-}
-
-namespace grpc\testing {
-
- class SimpleContext extends \DrSlump\Protobuf\Message {
-
- /** @var string */
- public $value = null;
-
- /** @var \Closure[] */
- protected static $__extensions = array();
-
- public static function descriptor()
- {
- $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.SimpleContext');
-
- // OPTIONAL STRING value = 1
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 1;
- $f->name = "value";
- $f->type = \DrSlump\Protobuf::TYPE_STRING;
- $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
- $descriptor->addField($f);
-
- foreach (self::$__extensions as $cb) {
- $descriptor->addField($cb(), true);
- }
-
- return $descriptor;
- }
-
/**
- * Check if <value> has a value
+ * Check if <oauth_scope> has a value
*
* @return boolean
*/
- public function hasValue(){
- return $this->_has(1);
+ public function hasOauthScope(){
+ return $this->_has(3);
}
/**
- * Clear <value> value
+ * Clear <oauth_scope> value
*
- * @return \grpc\testing\SimpleContext
+ * @return \grpc\testing\SimpleResponse
*/
- public function clearValue(){
- return $this->_clear(1);
+ public function clearOauthScope(){
+ return $this->_clear(3);
}
/**
- * Get <value> value
+ * Get <oauth_scope> value
*
* @return string
*/
- public function getValue(){
- return $this->_get(1);
+ public function getOauthScope(){
+ return $this->_get(3);
}
/**
- * Set <value> value
+ * Set <oauth_scope> value
*
* @param string $value
- * @return \grpc\testing\SimpleContext
+ * @return \grpc\testing\SimpleResponse
*/
- public function setValue( $value){
- return $this->_set(1, $value);
+ public function setOauthScope( $value){
+ return $this->_set(3, $value);
}
}
}
@@ -997,15 +1072,3 @@ namespace grpc\testing {
}
}
-namespace {
- \proto2\bridge\MessageSet::extension(function(){
- // OPTIONAL MESSAGE grpc\testing\SimpleContext\message_set_extension = 71139615
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 71139615;
- $f->name = "grpc\testing\SimpleContext\message_set_extension";
- $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
- $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
- $f->reference = '\grpc\testing\SimpleContext';
- return $f;
- });
-} \ No newline at end of file
diff --git a/src/php/tests/interop/test.php b/src/php/tests/interop/test.php
index fe6d0fb6c4..060a21def6 100755
--- a/src/php/tests/interop/test.php
+++ b/src/php/tests/interop/test.php
@@ -1,52 +1,52 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
-// Source: third_party/stubby/testing/proto/test.proto
-// Date: 2014-12-03 22:02:20
+// Source: test/cpp/interop/test.proto
+// Date: 2015-01-30 21:44:54
namespace grpc\testing {
class TestServiceClient extends \Grpc\BaseStub {
/**
- * @param proto2\EmptyMessage $input
- * @return proto2\EmptyMessage
+ * @param grpc\testing\EmptyMessage $input
+ * @return grpc\testing\EmptyMessage
*/
- public function EmptyCall(\proto2\EmptyMessage $argument, $metadata = array()) {
- return $this->_simpleRequest('/TestService/EmptyCall', $argument, '\proto2\EmptyMessage::deserialize', $metadata);
+ public function EmptyCall(\grpc\testing\EmptyMessage $argument, $metadata = array()) {
+ return $this->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, '\grpc\testing\EmptyMessage::deserialize', $metadata);
}
/**
* @param grpc\testing\SimpleRequest $input
* @return grpc\testing\SimpleResponse
*/
public function UnaryCall(\grpc\testing\SimpleRequest $argument, $metadata = array()) {
- return $this->_simpleRequest('/TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata);
+ return $this->_simpleRequest('/grpc.testing.TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/
public function StreamingOutputCall($argument, $metadata = array()) {
- return $this->_serverStreamRequest('/TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
+ return $this->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingInputCallRequest $input
* @return grpc\testing\StreamingInputCallResponse
*/
public function StreamingInputCall($arguments, $metadata = array()) {
- return $this->_clientStreamRequest('/TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata);
+ return $this->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/
public function FullDuplexCall($metadata = array()) {
- return $this->_bidiRequest('/TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
+ return $this->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/
public function HalfDuplexCall($metadata = array()) {
- return $this->_bidiRequest('/TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
+ return $this->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
}
}
}