Go to the documentation of this file.
21 #include <gtest/gtest.h>
23 #include "absl/memory/memory.h"
38 #include "src/proto/grpc/testing/echo.grpc.pb.h"
43 #define PLUGIN_NAME "TestServerBuilderPlugin"
74 return service_->has_async_methods();
81 return service_->has_synchronous_methods();
107 std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
override {
110 std::unique_ptr<TestServerBuilderPlugin> plugin(
113 plugins->emplace_back(
std::move(plugin));
143 builder_ = absl::make_unique<ServerBuilder>();
152 builder_->SetOption(std::unique_ptr<ServerBuilderOption>(
162 plugin->SetRegisterService();
165 std::unique_ptr<InsertPluginServerBuilderOption>
option(
167 option->SetRegisterService();
201 std::stringstream strs;
209 std::unique_ptr<grpc::testing::EchoTestService::Stub>
stub_;
210 std::unique_ptr<ServerCompletionQueue>
cq_;
243 InsertPluginWithTestService();
249 request.set_message(
"Hello hello hello hello");
263 int main(
int argc,
char** argv) {
std::unique_ptr< grpc::testing::EchoTestService::Stub > stub_
void ChangeArguments(const std::string &, void *) override
std::unique_ptr< ServerBuilderPlugin > CreateTestServerBuilderPlugin()
string to_string(const int number)
bool change_arguments_is_called_
std::shared_ptr< Channel > channel_
void UpdatePlugins(std::vector< std::unique_ptr< ServerBuilderPlugin >> *plugins) override
TestServerBuilderPlugin()
TestMultipleServiceImpl< grpc::testing::EchoTestService::Service > TestServiceImpl
std::string server_address("0.0.0.0:10000")
int main(int argc, char **argv)
void Finish(ServerInitializer *) override
Finish will be called at the end of ServerBuilder::BuildAndStart().
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
InsertPluginServerBuilderOption()
bool has_async_methods() const override
ServerBuilderPluginTest()
void SetRegisterService()
INSTANTIATE_TEST_SUITE_P(HistogramTestCases, HistogramTest, ::testing::Range< int >(0, GRPC_STATS_HISTOGRAM_COUNT))
bool change_arguments_is_called()
std::unique_ptr< Server > server_
std::unique_ptr< ServerCompletionQueue > cq_
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Interface to pass an option to a ServerBuilder.
int grpc_pick_unused_port_or_die(void)
static void * tag(intptr_t t)
std::unique_ptr< ServerBuilder > builder_
struct grpc::testing::StaticTestPluginInitializer static_plugin_initializer_test_
std::unique_ptr< grpc::testing::EchoTestService::Stub > stub_
bool init_server_is_called_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
internal::ValueArray< T... > Values(T... v)
std::shared_ptr< TestServiceImpl > service_
void SetRegisterService()
void UpdateArguments(ChannelArguments *) override
Alter the ChannelArguments used to create the gRPC server.
void StartServer(JNIEnv *env, jobject obj, jmethodID is_cancelled_mid, int port)
bool init_server_is_called()
bool has_sync_methods() const override
static const ParamType & GetParam()
EXPECT_EQ(options.token_exchange_service_uri, "https://foo/exchange")
void InsertPluginWithTestService()
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
grpc::ClientContext context
TEST_P(HistogramTest, IncHistogram)
std::string name() override
EXPECT_TRUE(grpc::experimental::StsCredentialsOptionsFromJson(minimum_valid_json, &options) .ok())
void InitServer(ServerInitializer *si) override
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
bool RegisterService(std::shared_ptr< grpc::Service > service)
static void InternalAddPluginFactory(std::unique_ptr< grpc::ServerBuilderPlugin >(*CreatePlugin)())
For internal use only: Register a ServerBuilderPlugin factory function.
void set_compression_algorithm(grpc_compression_algorithm algorithm)
StaticTestPluginInitializer()
static uv_thread_t thread
TestServerBuilderPlugin * CheckPresent()
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:16