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
7176a828
Commit
7176a828
authored
8 years ago
by
Yuchen Zeng
Browse files
Options
Downloads
Patches
Plain Diff
Use --protofiles
parent
c931305c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/cpp/util/grpc_tool.cc
+11
-11
11 additions, 11 deletions
test/cpp/util/grpc_tool.cc
test/cpp/util/grpc_tool.h
+1
-1
1 addition, 1 deletion
test/cpp/util/grpc_tool.h
with
12 additions
and
12 deletions
test/cpp/util/grpc_tool.cc
+
11
−
11
View file @
7176a828
...
@@ -57,7 +57,7 @@ DEFINE_bool(remotedb, true, "Use server types to parse and format messages");
...
@@ -57,7 +57,7 @@ DEFINE_bool(remotedb, true, "Use server types to parse and format messages");
DEFINE_string
(
metadata
,
""
,
DEFINE_string
(
metadata
,
""
,
"Metadata to send to server, in the form of key1:val1:key2:val2"
);
"Metadata to send to server, in the form of key1:val1:key2:val2"
);
DEFINE_string
(
proto_path
,
"."
,
"Path to look for the proto file."
);
DEFINE_string
(
proto_path
,
"."
,
"Path to look for the proto file."
);
DEFINE_string
(
proto
_
file
,
""
,
"Name of the proto file."
);
DEFINE_string
(
protofile
s
,
""
,
"Name of the proto file."
);
DEFINE_bool
(
binary_input
,
false
,
"Input in binary format"
);
DEFINE_bool
(
binary_input
,
false
,
"Input in binary format"
);
DEFINE_bool
(
binary_output
,
false
,
"Output in binary format"
);
DEFINE_bool
(
binary_output
,
false
,
"Output in binary format"
);
DEFINE_string
(
infile
,
""
,
"Input file (default is stdin)"
);
DEFINE_string
(
infile
,
""
,
"Input file (default is stdin)"
);
...
@@ -71,9 +71,9 @@ class GrpcTool {
...
@@ -71,9 +71,9 @@ class GrpcTool {
explicit
GrpcTool
();
explicit
GrpcTool
();
virtual
~
GrpcTool
()
{}
virtual
~
GrpcTool
()
{}
bool
Help
(
int
argc
,
const
char
**
argv
,
CliCredentials
cred
,
bool
Help
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
&
cred
,
GrpcToolOutputCallback
callback
);
GrpcToolOutputCallback
callback
);
bool
CallMethod
(
int
argc
,
const
char
**
argv
,
CliCredentials
cred
,
bool
CallMethod
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
&
cred
,
GrpcToolOutputCallback
callback
);
GrpcToolOutputCallback
callback
);
// TODO(zyc): implement the following methods
// TODO(zyc): implement the following methods
// bool ListServices(int argc, const char** argv, GrpcToolOutputCallback
// bool ListServices(int argc, const char** argv, GrpcToolOutputCallback
...
@@ -101,7 +101,7 @@ class GrpcTool {
...
@@ -101,7 +101,7 @@ class GrpcTool {
};
};
template
<
typename
T
>
template
<
typename
T
>
std
::
function
<
bool
(
GrpcTool
*
,
int
,
const
char
**
,
const
CliCredentials
,
std
::
function
<
bool
(
GrpcTool
*
,
int
,
const
char
**
,
const
CliCredentials
&
,
GrpcToolOutputCallback
)
>
GrpcToolOutputCallback
)
>
BindWith5Args
(
T
&&
func
)
{
BindWith5Args
(
T
&&
func
)
{
return
std
::
bind
(
std
::
forward
<
T
>
(
func
),
std
::
placeholders
::
_1
,
return
std
::
bind
(
std
::
forward
<
T
>
(
func
),
std
::
placeholders
::
_1
,
...
@@ -156,7 +156,7 @@ void PrintMetadata(const T& m, const grpc::string& message) {
...
@@ -156,7 +156,7 @@ void PrintMetadata(const T& m, const grpc::string& message) {
struct
Command
{
struct
Command
{
const
char
*
command
;
const
char
*
command
;
std
::
function
<
bool
(
GrpcTool
*
,
int
,
const
char
**
,
const
CliCredentials
,
std
::
function
<
bool
(
GrpcTool
*
,
int
,
const
char
**
,
const
CliCredentials
&
,
GrpcToolOutputCallback
)
>
GrpcToolOutputCallback
)
>
function
;
function
;
int
min_args
;
int
min_args
;
...
@@ -201,7 +201,7 @@ const Command* FindCommand(const grpc::string& name) {
...
@@ -201,7 +201,7 @@ const Command* FindCommand(const grpc::string& name) {
}
}
}
// namespace
}
// namespace
int
GrpcToolMainLib
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
cred
,
int
GrpcToolMainLib
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
&
cred
,
GrpcToolOutputCallback
callback
)
{
GrpcToolOutputCallback
callback
)
{
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
Usage
(
"No command specified"
);
Usage
(
"No command specified"
);
...
@@ -238,7 +238,7 @@ void GrpcTool::CommandUsage(const grpc::string& usage) const {
...
@@ -238,7 +238,7 @@ void GrpcTool::CommandUsage(const grpc::string& usage) const {
}
}
}
}
bool
GrpcTool
::
Help
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
cred
,
bool
GrpcTool
::
Help
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
&
cred
,
GrpcToolOutputCallback
callback
)
{
GrpcToolOutputCallback
callback
)
{
CommandUsage
(
CommandUsage
(
"Print help
\n
"
"Print help
\n
"
...
@@ -258,7 +258,7 @@ bool GrpcTool::Help(int argc, const char** argv, const CliCredentials cred,
...
@@ -258,7 +258,7 @@ bool GrpcTool::Help(int argc, const char** argv, const CliCredentials cred,
}
}
bool
GrpcTool
::
CallMethod
(
int
argc
,
const
char
**
argv
,
bool
GrpcTool
::
CallMethod
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
cred
,
const
CliCredentials
&
cred
,
GrpcToolOutputCallback
callback
)
{
GrpcToolOutputCallback
callback
)
{
CommandUsage
(
CommandUsage
(
"Call method
\n
"
"Call method
\n
"
...
@@ -267,10 +267,10 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
...
@@ -267,10 +267,10 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
" <service> ; Exported service name
\n
"
" <service> ; Exported service name
\n
"
" <method> ; Method name
\n
"
" <method> ; Method name
\n
"
" <request> ; Text protobuffer (overrides infile)
\n
"
" <request> ; Text protobuffer (overrides infile)
\n
"
" --proto
_
file ; Comma separated proto files used as a"
" --protofile
s
; Comma separated proto files used as a"
" fallback when parsing request/response
\n
"
" fallback when parsing request/response
\n
"
" --proto_path ; The search path of proto files, valid"
" --proto_path ; The search path of proto files, valid"
" only when --proto
_
file is given
\n
"
" only when --protofile
s
is given
\n
"
" --metadata ; The metadata to be sent to the server
\n
"
" --metadata ; The metadata to be sent to the server
\n
"
" --infile ; Input filename (defaults to stdin)
\n
"
" --infile ; Input filename (defaults to stdin)
\n
"
" --outfile ; Output filename (defaults to stdout)
\n
"
" --outfile ; Output filename (defaults to stdout)
\n
"
...
@@ -310,7 +310,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
...
@@ -310,7 +310,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
if
(
!
FLAGS_binary_input
||
!
FLAGS_binary_output
)
{
if
(
!
FLAGS_binary_input
||
!
FLAGS_binary_output
)
{
parser
.
reset
(
parser
.
reset
(
new
grpc
::
testing
::
ProtoFileParser
(
FLAGS_remotedb
?
channel
:
nullptr
,
new
grpc
::
testing
::
ProtoFileParser
(
FLAGS_remotedb
?
channel
:
nullptr
,
FLAGS_proto_path
,
FLAGS_proto
_
file
));
FLAGS_proto_path
,
FLAGS_protofile
s
));
if
(
parser
->
HasError
())
{
if
(
parser
->
HasError
())
{
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
test/cpp/util/grpc_tool.h
+
1
−
1
View file @
7176a828
...
@@ -45,7 +45,7 @@ namespace testing {
...
@@ -45,7 +45,7 @@ namespace testing {
typedef
std
::
function
<
bool
(
const
grpc
::
string
&
)
>
GrpcToolOutputCallback
;
typedef
std
::
function
<
bool
(
const
grpc
::
string
&
)
>
GrpcToolOutputCallback
;
int
GrpcToolMainLib
(
int
argc
,
const
char
**
argv
,
CliCredentials
cred
,
int
GrpcToolMainLib
(
int
argc
,
const
char
**
argv
,
const
CliCredentials
&
cred
,
GrpcToolOutputCallback
callback
);
GrpcToolOutputCallback
callback
);
}
// namespace testing
}
// namespace testing
...
...
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