aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/test/server_context_test_spouse.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc++/test/server_context_test_spouse.h')
-rw-r--r--include/grpc++/test/server_context_test_spouse.h49
1 files changed, 6 insertions, 43 deletions
diff --git a/include/grpc++/test/server_context_test_spouse.h b/include/grpc++/test/server_context_test_spouse.h
index b1a7f87009..48a4838c2d 100644
--- a/include/grpc++/test/server_context_test_spouse.h
+++ b/include/grpc++/test/server_context_test_spouse.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,50 +16,13 @@
*
*/
+// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
+// headers in include/grpcpp instead. This header exists only for backwards
+// compatibility.
+
#ifndef GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
#define GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
-#include <map>
-
-#include <grpc++/server_context.h>
-
-namespace grpc {
-namespace testing {
-
-/// A test-only class to access private members and methods of ServerContext.
-class ServerContextTestSpouse {
- public:
- explicit ServerContextTestSpouse(ServerContext* ctx) : ctx_(ctx) {}
-
- /// Inject client metadata to the ServerContext for the test. The test spouse
- /// must be alive when \a ServerContext::client_metadata is called.
- void AddClientMetadata(const grpc::string& key, const grpc::string& value) {
- client_metadata_storage_.insert(
- std::pair<grpc::string, grpc::string>(key, value));
- ctx_->client_metadata_.map()->clear();
- for (auto iter = client_metadata_storage_.begin();
- iter != client_metadata_storage_.end(); ++iter) {
- ctx_->client_metadata_.map()->insert(
- std::pair<grpc::string_ref, grpc::string_ref>(
- iter->first.c_str(),
- grpc::string_ref(iter->second.data(), iter->second.size())));
- }
- }
-
- std::multimap<grpc::string, grpc::string> GetInitialMetadata() const {
- return ctx_->initial_metadata_;
- }
-
- std::multimap<grpc::string, grpc::string> GetTrailingMetadata() const {
- return ctx_->trailing_metadata_;
- }
-
- private:
- ServerContext* ctx_; // not owned
- std::multimap<grpc::string, grpc::string> client_metadata_storage_;
-};
-
-} // namespace testing
-} // namespace grpc
+#include <grpcpp/test/server_context_test_spouse.h>
#endif // GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H