Move Channel also to impl for now
This commit is contained in:
parent
e57182ab61
commit
60bdeef9f4
|
|
@ -19,8 +19,8 @@
|
|||
#ifndef GRPCPP_CREATE_CHANNEL_H
|
||||
#define GRPCPP_CREATE_CHANNEL_H
|
||||
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
#include <grpcpp/create_channel_impl.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -309,7 +309,8 @@ class ClientContext {
|
|||
/// call.
|
||||
///
|
||||
/// \see https://grpc.io/docs/guides/auth.html
|
||||
void set_credentials(const std::shared_ptr<grpc_impl::CallCredentials>& creds) {
|
||||
void set_credentials(
|
||||
const std::shared_ptr<grpc_impl::CallCredentials>& creds) {
|
||||
creds_ = creds;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ typedef ::grpc_impl::SslCredentialsOptions SslCredentialsOptions;
|
|||
typedef ::grpc_impl::SecureCallCredentials SecureCallCredentials;
|
||||
typedef ::grpc_impl::SecureChannelCredentials SecureChannelCredentials;
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials> GoogleDefaultCredentials() {
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials>
|
||||
GoogleDefaultCredentials() {
|
||||
return ::grpc_impl::GoogleDefaultCredentials();
|
||||
}
|
||||
|
||||
|
|
@ -39,30 +40,34 @@ static inline std::shared_ptr<ChannelCredentials> SslCredentials(
|
|||
return ::grpc_impl::SslCredentials(options);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> GoogleComputeEngineCredentials() {
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials>
|
||||
GoogleComputeEngineCredentials() {
|
||||
return ::grpc_impl::GoogleComputeEngineCredentials();
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> ServiceAccountJWTAccessCredentials(
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials>
|
||||
ServiceAccountJWTAccessCredentials(
|
||||
const grpc::string& json_key,
|
||||
long token_lifetime_seconds = ::grpc_impl::kMaxAuthTokenLifetimeSecs) {
|
||||
return ::grpc_impl::ServiceAccountJWTAccessCredentials(json_key, token_lifetime_seconds);
|
||||
return ::grpc_impl::ServiceAccountJWTAccessCredentials(
|
||||
json_key, token_lifetime_seconds);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> GoogleRefreshTokenCredentials(
|
||||
const grpc::string& json_refresh_token) {
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials>
|
||||
GoogleRefreshTokenCredentials(const grpc::string& json_refresh_token) {
|
||||
return ::grpc_impl::GoogleRefreshTokenCredentials(json_refresh_token);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> AccessTokenCredentials(
|
||||
const grpc::string& access_token) {
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials>
|
||||
AccessTokenCredentials(const grpc::string& access_token) {
|
||||
return ::grpc_impl::AccessTokenCredentials(access_token);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> GoogleIAMCredentials(
|
||||
const grpc::string& authorization_token,
|
||||
const grpc::string& authority_selector) {
|
||||
return ::grpc_impl::GoogleIAMCredentials(authorization_token, authority_selector);
|
||||
return ::grpc_impl::GoogleIAMCredentials(authorization_token,
|
||||
authority_selector);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
|
||||
|
|
@ -71,30 +76,34 @@ static inline std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
|
|||
return ::grpc_impl::CompositeChannelCredentials(channel_creds, call_creds);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> CompositeCallCredentials(
|
||||
const std::shared_ptr<CallCredentials>& creds1,
|
||||
const std::shared_ptr<CallCredentials>& creds2) {
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials>
|
||||
CompositeCallCredentials(const std::shared_ptr<CallCredentials>& creds1,
|
||||
const std::shared_ptr<CallCredentials>& creds2) {
|
||||
return ::grpc_impl::CompositeCallCredentials(creds1, creds2);
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials> InsecureChannelCredentials() {
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials>
|
||||
InsecureChannelCredentials() {
|
||||
return ::grpc_impl::InsecureChannelCredentials();
|
||||
}
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials> CronetChannelCredentials(void* engine) {
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials>
|
||||
CronetChannelCredentials(void* engine) {
|
||||
return ::grpc_impl::CronetChannelCredentials(engine);
|
||||
}
|
||||
|
||||
typedef ::grpc_impl::MetadataCredentialsPlugin MetadataCredentialsPlugin;
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials> MetadataCredentialsFromPlugin(
|
||||
static inline std::shared_ptr<grpc_impl::CallCredentials>
|
||||
MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin> plugin) {
|
||||
return ::grpc_impl::MetadataCredentialsFromPlugin(std::move(plugin));
|
||||
}
|
||||
|
||||
namespace experimental {
|
||||
|
||||
typedef ::grpc_impl::experimental::AltsCredentialsOptions AltsCredentialsOptions;
|
||||
typedef ::grpc_impl::experimental::AltsCredentialsOptions
|
||||
AltsCredentialsOptions;
|
||||
|
||||
static inline std::shared_ptr<grpc_impl::ChannelCredentials> AltsCredentials(
|
||||
const AltsCredentialsOptions& options) {
|
||||
|
|
|
|||
|
|
@ -88,19 +88,19 @@ class ChannelCredentials : private grpc::GrpcLibraryCodegen {
|
|||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
std::vector<std::unique_ptr<
|
||||
grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators);
|
||||
|
||||
virtual std::shared_ptr<grpc::Channel> CreateChannel(
|
||||
virtual std::shared_ptr<grpc::Channel> CreateChannelImpl(
|
||||
const grpc::string& target, const grpc::ChannelArguments& args) = 0;
|
||||
|
||||
// This function should have been a pure virtual function, but it is
|
||||
// implemented as a virtual function so that it does not break API.
|
||||
virtual std::shared_ptr<grpc::Channel> CreateChannelWithInterceptors(
|
||||
const grpc::string& target, const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
std::vector<std::unique_ptr<
|
||||
grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -280,6 +280,6 @@ std::shared_ptr<ChannelCredentials> LocalCredentials(
|
|||
grpc_local_connect_type type);
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_SECURITY_CREDENTIALS_H
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include <grpcpp/channel.h>
|
||||
#include <grpcpp/create_channel.h>
|
||||
#include <grpcpp/security/credentials.h>
|
||||
#include <grpcpp/impl/grpc_library.h>
|
||||
#include <grpcpp/security/credentials.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
|
||||
#include "src/cpp/client/create_channel_internal.h"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
#include <grpc/grpc.h>
|
||||
#include <grpc/grpc_posix.h>
|
||||
#include <grpcpp/channel.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
#include <grpcpp/impl/grpc_library.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
|
||||
#include "src/cpp/client/create_channel_internal.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -30,4 +30,4 @@ CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
|
|||
|
||||
CallCredentials::~CallCredentials() {}
|
||||
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
|
|
|||
|
|
@ -31,13 +31,8 @@ namespace grpc_impl {
|
|||
namespace {
|
||||
class InsecureChannelCredentialsImpl final : public ChannelCredentials {
|
||||
public:
|
||||
<<<<<<< HEAD
|
||||
std::shared_ptr<grpc::Channel> CreateChannelImpl(
|
||||
const string& target, const grpc::ChannelArguments& args) override {
|
||||
=======
|
||||
std::shared_ptr<grpc::Channel> CreateChannel(
|
||||
const grpc::string& target, const grpc::ChannelArguments& args) override {
|
||||
>>>>>>> Changes to fold credentials into grpc_impl from grpc
|
||||
return CreateChannelWithInterceptors(
|
||||
target, args,
|
||||
std::vector<std::unique_ptr<
|
||||
|
|
@ -46,8 +41,8 @@ class InsecureChannelCredentialsImpl final : public ChannelCredentials {
|
|||
|
||||
std::shared_ptr<grpc::Channel> CreateChannelWithInterceptors(
|
||||
const grpc::string& target, const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
std::vector<std::unique_ptr<
|
||||
grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators) override {
|
||||
grpc_channel_args channel_args;
|
||||
args.SetChannelArgs(&channel_args);
|
||||
|
|
@ -66,4 +61,4 @@ std::shared_ptr<ChannelCredentials> InsecureChannelCredentials() {
|
|||
new InsecureChannelCredentialsImpl());
|
||||
}
|
||||
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ SecureChannelCredentials::SecureChannelCredentials(
|
|||
}
|
||||
|
||||
std::shared_ptr<grpc::Channel> SecureChannelCredentials::CreateChannelImpl(
|
||||
const string& target, const grpc::ChannelArguments& args) {
|
||||
const grpc::string& target, const grpc::ChannelArguments& args) {
|
||||
return CreateChannelWithInterceptors(
|
||||
target, args,
|
||||
std::vector<
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>());
|
||||
std::vector<std::unique_ptr<
|
||||
grpc::experimental::ClientInterceptorFactoryInterface>>());
|
||||
}
|
||||
|
||||
std::shared_ptr<grpc::Channel>
|
||||
|
|
@ -220,7 +220,7 @@ std::shared_ptr<grpc_impl::CallCredentials> MetadataCredentialsFromPlugin(
|
|||
grpc_metadata_credentials_create_from_plugin(c_plugin, nullptr));
|
||||
}
|
||||
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc_impl
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
@ -325,4 +325,4 @@ MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(
|
|||
std::unique_ptr<MetadataCredentialsPlugin> plugin)
|
||||
: thread_pool_(CreateDefaultThreadPool()), plugin_(std::move(plugin)) {}
|
||||
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -38,15 +38,15 @@ class SecureChannelCredentials final : public ChannelCredentials {
|
|||
grpc_channel_credentials* GetRawCreds() { return c_creds_; }
|
||||
|
||||
std::shared_ptr<grpc::Channel> CreateChannelImpl(
|
||||
const string& target, const grpc::ChannelArguments& args) override;
|
||||
const grpc::string& target, const grpc::ChannelArguments& args) override;
|
||||
|
||||
SecureChannelCredentials* AsSecureCredentials() override { return this; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<grpc::Channel> CreateChannelWithInterceptors(
|
||||
const grpc::string& target, const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
std::vector<std::unique_ptr<
|
||||
grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators) override;
|
||||
grpc_channel_credentials* const c_creds_;
|
||||
};
|
||||
|
|
@ -66,7 +66,7 @@ class SecureCallCredentials final : public CallCredentials {
|
|||
grpc_call_credentials* const c_creds_;
|
||||
};
|
||||
|
||||
} // namespace grpc_impl
|
||||
} // namespace grpc_impl
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,8 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
|
|||
|
||||
proxy_server_ = builder.BuildAndStart();
|
||||
|
||||
channel_ = grpc::CreateChannel(proxyaddr.str(), InsecureChannelCredentials());
|
||||
channel_ =
|
||||
grpc::CreateChannel(proxyaddr.str(), InsecureChannelCredentials());
|
||||
}
|
||||
|
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel_);
|
||||
|
|
@ -1825,8 +1826,8 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginKeyFailure) {
|
|||
EchoRequest request;
|
||||
EchoResponse response;
|
||||
ClientContext context;
|
||||
context.set_credentials(
|
||||
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
context.set_credentials(grpc::MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(
|
||||
TestMetadataCredentialsPlugin::kBadMetadataKey,
|
||||
"Does not matter, will fail the key is invalid.", false, true))));
|
||||
|
|
@ -1843,8 +1844,8 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) {
|
|||
EchoRequest request;
|
||||
EchoResponse response;
|
||||
ClientContext context;
|
||||
context.set_credentials(
|
||||
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
context.set_credentials(grpc::MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(
|
||||
TestMetadataCredentialsPlugin::kGoodMetadataKey,
|
||||
"With illegal \n value.", false, true))));
|
||||
|
|
@ -1861,8 +1862,8 @@ TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) {
|
|||
EchoRequest request;
|
||||
EchoResponse response;
|
||||
ClientContext context;
|
||||
context.set_credentials(
|
||||
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
context.set_credentials(grpc::MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(
|
||||
TestMetadataCredentialsPlugin::kGoodMetadataKey,
|
||||
"Does not matter, will fail anyway (see 3rd param)", false,
|
||||
|
|
@ -1925,8 +1926,8 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginFailure) {
|
|||
EchoRequest request;
|
||||
EchoResponse response;
|
||||
ClientContext context;
|
||||
context.set_credentials(
|
||||
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
context.set_credentials(grpc::MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(
|
||||
TestMetadataCredentialsPlugin::kGoodMetadataKey,
|
||||
"Does not matter, will fail anyway (see 3rd param)", true,
|
||||
|
|
@ -1953,12 +1954,14 @@ TEST_P(SecureEnd2endTest, CompositeCallCreds) {
|
|||
const char kMetadataVal2[] = "call-creds-val2";
|
||||
|
||||
context.set_credentials(grpc::CompositeCallCredentials(
|
||||
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(kMetadataKey1, kMetadataVal1, true,
|
||||
true))),
|
||||
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(kMetadataKey2, kMetadataVal2, true,
|
||||
true)))));
|
||||
grpc::MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(kMetadataKey1, kMetadataVal1,
|
||||
true, true))),
|
||||
grpc::MetadataCredentialsFromPlugin(
|
||||
std::unique_ptr<MetadataCredentialsPlugin>(
|
||||
new TestMetadataCredentialsPlugin(kMetadataKey2, kMetadataVal2,
|
||||
true, true)))));
|
||||
request.set_message("Hello");
|
||||
request.mutable_param()->set_echo_metadata(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ class FilterEnd2endTest : public ::testing::Test {
|
|||
}
|
||||
|
||||
void ResetStub() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
generic_stub_.reset(new GenericStub(channel));
|
||||
ResetConnectionCounter();
|
||||
ResetCallCounter();
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ class GenericEnd2endTest : public ::testing::Test {
|
|||
}
|
||||
|
||||
void ResetStub() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
generic_stub_.reset(new GenericStub(channel));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ class HealthServiceEnd2endTest : public ::testing::Test {
|
|||
}
|
||||
|
||||
void ResetStubs() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
hc_stub_ = grpc::health::v1::Health::NewStub(channel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ class HybridEnd2endTest : public ::testing::TestWithParam<bool> {
|
|||
std::shared_ptr<Channel> channel =
|
||||
inproc_ ? server_->InProcessChannel(ChannelArguments())
|
||||
: grpc::CreateChannel(server_address_.str(),
|
||||
InsecureChannelCredentials());
|
||||
InsecureChannelCredentials());
|
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel);
|
||||
}
|
||||
|
||||
|
|
@ -321,8 +321,8 @@ class HybridEnd2endTest : public ::testing::TestWithParam<bool> {
|
|||
}
|
||||
|
||||
void SendEchoToDupService() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
auto stub = grpc::testing::duplicate::EchoTestService::NewStub(channel);
|
||||
EchoRequest send_request;
|
||||
EchoResponse recv_response;
|
||||
|
|
@ -373,8 +373,8 @@ class HybridEnd2endTest : public ::testing::TestWithParam<bool> {
|
|||
}
|
||||
|
||||
void SendSimpleServerStreamingToDupService() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
auto stub = grpc::testing::duplicate::EchoTestService::NewStub(channel);
|
||||
EchoRequest request;
|
||||
EchoResponse response;
|
||||
|
|
|
|||
|
|
@ -244,8 +244,8 @@ class MockTest : public ::testing::Test {
|
|||
void TearDown() override { server_->Shutdown(); }
|
||||
|
||||
void ResetStub() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ class ServerEarlyReturnTest : public ::testing::Test {
|
|||
builder.RegisterService(&service_);
|
||||
server_ = builder.BuildAndStart();
|
||||
|
||||
channel_ =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
channel_ = grpc::CreateChannel(server_address_.str(),
|
||||
InsecureChannelCredentials());
|
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel_);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,7 +265,8 @@ class ServerInterceptorsEnd2endSyncUnaryTest : public ::testing::Test {
|
|||
TEST_F(ServerInterceptorsEnd2endSyncUnaryTest, UnaryTest) {
|
||||
ChannelArguments args;
|
||||
DummyInterceptor::Reset();
|
||||
auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
MakeCall(channel);
|
||||
// Make sure all 20 dummy interceptors were run
|
||||
EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20);
|
||||
|
|
@ -308,7 +309,8 @@ class ServerInterceptorsEnd2endSyncStreamingTest : public ::testing::Test {
|
|||
TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, ClientStreamingTest) {
|
||||
ChannelArguments args;
|
||||
DummyInterceptor::Reset();
|
||||
auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
MakeClientStreamingCall(channel);
|
||||
// Make sure all 20 dummy interceptors were run
|
||||
EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20);
|
||||
|
|
@ -317,7 +319,8 @@ TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, ClientStreamingTest) {
|
|||
TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, ServerStreamingTest) {
|
||||
ChannelArguments args;
|
||||
DummyInterceptor::Reset();
|
||||
auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
MakeServerStreamingCall(channel);
|
||||
// Make sure all 20 dummy interceptors were run
|
||||
EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20);
|
||||
|
|
@ -326,7 +329,8 @@ TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, ServerStreamingTest) {
|
|||
TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, BidiStreamingTest) {
|
||||
ChannelArguments args;
|
||||
DummyInterceptor::Reset();
|
||||
auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address_, InsecureChannelCredentials());
|
||||
MakeBidiStreamingCall(channel);
|
||||
// Make sure all 20 dummy interceptors were run
|
||||
EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20);
|
||||
|
|
@ -356,7 +360,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, UnaryTest) {
|
|||
auto server = builder.BuildAndStart();
|
||||
|
||||
ChannelArguments args;
|
||||
auto channel = grpc::CreateChannel(server_address, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address, InsecureChannelCredentials());
|
||||
auto stub = grpc::testing::EchoTestService::NewStub(channel);
|
||||
|
||||
EchoRequest send_request;
|
||||
|
|
@ -428,7 +433,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, BidiStreamingTest) {
|
|||
auto server = builder.BuildAndStart();
|
||||
|
||||
ChannelArguments args;
|
||||
auto channel = grpc::CreateChannel(server_address, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address, InsecureChannelCredentials());
|
||||
auto stub = grpc::testing::EchoTestService::NewStub(channel);
|
||||
|
||||
EchoRequest send_request;
|
||||
|
|
@ -509,7 +515,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, GenericRPCTest) {
|
|||
auto server = builder.BuildAndStart();
|
||||
|
||||
ChannelArguments args;
|
||||
auto channel = grpc::CreateChannel(server_address, InsecureChannelCredentials());
|
||||
auto channel =
|
||||
grpc::CreateChannel(server_address, InsecureChannelCredentials());
|
||||
GenericStub generic_stub(channel);
|
||||
|
||||
const grpc::string kMethodName("/grpc.cpp.test.util.EchoTestService/Echo");
|
||||
|
|
|
|||
|
|
@ -145,8 +145,8 @@ class End2endTest : public ::testing::Test {
|
|||
void TearDown() override { server_->Shutdown(); }
|
||||
|
||||
void ResetStub() {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ template <class Service>
|
|||
class CommonStressTestInsecure : public CommonStressTest<Service> {
|
||||
public:
|
||||
void ResetStub() override {
|
||||
std::shared_ptr<Channel> channel =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
std::shared_ptr<Channel> channel = grpc::CreateChannel(
|
||||
server_address_.str(), InsecureChannelCredentials());
|
||||
this->stub_ = grpc::testing::EchoTestService::NewStub(channel);
|
||||
}
|
||||
bool AllowExhaustion() override { return false; }
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ class CliCallTest : public ::testing::Test {
|
|||
void TearDown() override { server_->Shutdown(); }
|
||||
|
||||
void ResetStub() {
|
||||
channel_ =
|
||||
grpc::CreateChannel(server_address_.str(), InsecureChannelCredentials());
|
||||
channel_ = grpc::CreateChannel(server_address_.str(),
|
||||
InsecureChannelCredentials());
|
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel_);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue