Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
6c8de363
Commit
6c8de363
authored
8 years ago
by
yang-g
Browse files
Options
Downloads
Patches
Plain Diff
Use user provided method name when using binary files in cli
parent
c2046472
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/cpp/util/grpc_tool.cc
+6
-3
6 additions, 3 deletions
test/cpp/util/grpc_tool.cc
test/cpp/util/proto_file_parser.cc
+6
-6
6 additions, 6 deletions
test/cpp/util/proto_file_parser.cc
test/cpp/util/proto_file_parser.h
+2
-2
2 additions, 2 deletions
test/cpp/util/proto_file_parser.h
with
14 additions
and
11 deletions
test/cpp/util/grpc_tool.cc
+
6
−
3
View file @
6c8de363
...
...
@@ -414,6 +414,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
grpc
::
string
request_text
;
grpc
::
string
server_address
(
argv
[
0
]);
grpc
::
string
method_name
(
argv
[
1
]);
grpc
::
string
formatted_method_name
;
std
::
unique_ptr
<
grpc
::
testing
::
ProtoFileParser
>
parser
;
grpc
::
string
serialized_request_proto
;
...
...
@@ -450,7 +451,9 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
if
(
FLAGS_binary_input
)
{
serialized_request_proto
=
request_text
;
formatted_method_name
=
method_name
;
}
else
{
formatted_method_name
=
parser
->
GetFormattedMethodName
(
method_name
);
serialized_request_proto
=
parser
->
GetSerializedProtoFromMethod
(
method_name
,
request_text
,
true
/* is_request */
);
if
(
parser
->
HasError
())
{
...
...
@@ -466,9 +469,9 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
ParseMetadataFlag
(
&
client_metadata
);
PrintMetadata
(
client_metadata
,
"Sending client initial metadata:"
);
grpc
::
Status
status
=
grpc
::
testing
::
CliCall
::
Call
(
channel
,
parser
->
GetF
ormated
M
ethod
N
ame
(
method_name
)
,
serialized_request_proto
,
&
serialized_response_proto
,
client_metadata
,
&
server_initial_metadata
,
&
server_trailing_metadata
);
channel
,
f
ormat
t
ed
_m
ethod
_n
ame
,
serialized_request_proto
,
&
serialized_response_proto
,
client_metadata
,
&
server_initial_metadata
,
&
server_trailing_metadata
);
PrintMetadata
(
server_initial_metadata
,
"Received initial metadata from server:"
);
PrintMetadata
(
server_trailing_metadata
,
...
...
This diff is collapsed.
Click to expand it.
test/cpp/util/proto_file_parser.cc
+
6
−
6
View file @
6c8de363
...
...
@@ -172,19 +172,19 @@ grpc::string ProtoFileParser::GetFullMethodName(const grpc::string& method) {
return
method_descriptor
->
full_name
();
}
grpc
::
string
ProtoFileParser
::
GetFormatedMethodName
(
grpc
::
string
ProtoFileParser
::
GetFormat
t
edMethodName
(
const
grpc
::
string
&
method
)
{
has_error_
=
false
;
grpc
::
string
formated_method_name
=
GetFullMethodName
(
method
);
grpc
::
string
format
t
ed_method_name
=
GetFullMethodName
(
method
);
if
(
has_error_
)
{
return
""
;
}
size_t
last_dot
=
formated_method_name
.
find_last_of
(
'.'
);
size_t
last_dot
=
format
t
ed_method_name
.
find_last_of
(
'.'
);
if
(
last_dot
!=
grpc
::
string
::
npos
)
{
formated_method_name
[
last_dot
]
=
'/'
;
format
t
ed_method_name
[
last_dot
]
=
'/'
;
}
formated_method_name
.
insert
(
formated_method_name
.
begin
(),
'/'
);
return
formated_method_name
;
format
t
ed_method_name
.
insert
(
format
t
ed_method_name
.
begin
(),
'/'
);
return
format
t
ed_method_name
;
}
grpc
::
string
ProtoFileParser
::
GetMessageTypeFromMethod
(
...
...
This diff is collapsed.
Click to expand it.
test/cpp/util/proto_file_parser.h
+
2
−
2
View file @
6c8de363
...
...
@@ -64,9 +64,9 @@ class ProtoFileParser {
// descriptor database queries.
grpc
::
string
GetFullMethodName
(
const
grpc
::
string
&
method
);
// Formated method name is in the form of /Service/Method, it's good to be
// Format
t
ed method name is in the form of /Service/Method, it's good to be
// used as the argument of Stub::Call()
grpc
::
string
GetFormatedMethodName
(
const
grpc
::
string
&
method
);
grpc
::
string
GetFormat
t
edMethodName
(
const
grpc
::
string
&
method
);
grpc
::
string
GetSerializedProtoFromMethod
(
const
grpc
::
string
&
method
,
const
grpc
::
string
&
text_format_proto
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment