diff options
author | dvshkurko <dvshkurko@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
commit | c768a99151e47c3a4bb7b92c514d256abd301c4d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/grpc/include/grpcpp/test | |
parent | 321ee9bce31ec6e238be26dbcbe539cffa2c3309 (diff) | |
download | ydb-c768a99151e47c3a4bb7b92c514d256abd301c4d.tar.gz |
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/grpc/include/grpcpp/test')
3 files changed, 57 insertions, 57 deletions
diff --git a/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h b/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h index 8a237378e4..a792e6f94a 100644 --- a/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h +++ b/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h @@ -1,58 +1,58 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H -#define GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H - -#include <grpcpp/server_context.h> -#include <grpcpp/support/server_callback.h> - -namespace grpc { -namespace testing { - -/// A test-only class to monitor the behavior of the ServerContext's -/// DefaultReactor. It is intended for allow unit-testing of a callback API -/// service via direct invocation of the service methods rather than through -/// RPCs. It is only applicable for unary RPC methods that use the +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H +#define GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H + +#include <grpcpp/server_context.h> +#include <grpcpp/support/server_callback.h> + +namespace grpc { +namespace testing { + +/// A test-only class to monitor the behavior of the ServerContext's +/// DefaultReactor. It is intended for allow unit-testing of a callback API +/// service via direct invocation of the service methods rather than through +/// RPCs. It is only applicable for unary RPC methods that use the /// DefaultReactor rather than any user-defined reactor. If it is used, it must /// be created before the RPC is invoked so that it can bind the reactor into a /// test mode rather than letting it follow the normal paths. -class DefaultReactorTestPeer { - public: - explicit DefaultReactorTestPeer(experimental::CallbackServerContext* ctx) - : DefaultReactorTestPeer(ctx, [](::grpc::Status) {}) {} - DefaultReactorTestPeer(experimental::CallbackServerContext* ctx, - std::function<void(::grpc::Status)> finish_func) - : ctx_(ctx) { - ctx->SetupTestDefaultReactor(std::move(finish_func)); - } - ::grpc::experimental::ServerUnaryReactor* reactor() const { +class DefaultReactorTestPeer { + public: + explicit DefaultReactorTestPeer(experimental::CallbackServerContext* ctx) + : DefaultReactorTestPeer(ctx, [](::grpc::Status) {}) {} + DefaultReactorTestPeer(experimental::CallbackServerContext* ctx, + std::function<void(::grpc::Status)> finish_func) + : ctx_(ctx) { + ctx->SetupTestDefaultReactor(std::move(finish_func)); + } + ::grpc::experimental::ServerUnaryReactor* reactor() const { return reinterpret_cast<experimental::ServerUnaryReactor*>( &ctx_->default_reactor_); - } - bool test_status_set() const { return ctx_->test_status_set(); } - Status test_status() const { return ctx_->test_status(); } - - private: - experimental::CallbackServerContext* const ctx_; // not owned -}; - -} // namespace testing -} // namespace grpc - -#endif // GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H + } + bool test_status_set() const { return ctx_->test_status_set(); } + Status test_status() const { return ctx_->test_status(); } + + private: + experimental::CallbackServerContext* const ctx_; // not owned +}; + +} // namespace testing +} // namespace grpc + +#endif // GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H diff --git a/contrib/libs/grpc/include/grpcpp/test/mock_stream.h b/contrib/libs/grpc/include/grpcpp/test/mock_stream.h index 24bbffa190..e33595d709 100644 --- a/contrib/libs/grpc/include/grpcpp/test/mock_stream.h +++ b/contrib/libs/grpc/include/grpcpp/test/mock_stream.h @@ -62,7 +62,7 @@ class MockClientWriter : public ::grpc::ClientWriterInterface<W> { }; template <class W, class R> -class MockClientReaderWriter +class MockClientReaderWriter : public ::grpc::ClientReaderWriterInterface<W, R> { public: MockClientReaderWriter() = default; diff --git a/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h b/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h index 775920c597..00c19dc4b8 100644 --- a/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h +++ b/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h @@ -37,11 +37,11 @@ class ServerContextTestSpouse { client_metadata_storage_.insert( std::pair<TString, TString>(key, value)); ctx_->client_metadata_.map()->clear(); - for (const auto& item : client_metadata_storage_) { + for (const auto& item : client_metadata_storage_) { ctx_->client_metadata_.map()->insert( std::pair<grpc::string_ref, grpc::string_ref>( - item.first.c_str(), - grpc::string_ref(item.second.data(), item.second.size()))); + item.first.c_str(), + grpc::string_ref(item.second.data(), item.second.size()))); } } |