]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/cpp/test/TServerTransportTest.cpp
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 #include <boost/test/auto_unit_test.hpp>
21 #include <thrift/transport/TSocket.h>
22 #include <thrift/transport/TServerTransport.h>
25 using apache::thrift::transport::TServerTransport
;
26 using apache::thrift::transport::TTransport
;
27 using apache::thrift::transport::TTransportException
;
28 using std::shared_ptr
;
30 BOOST_AUTO_TEST_SUITE(TServerTransportTest
)
32 class TestTTransport
: public TTransport
{};
34 class TestTServerTransport
: public TServerTransport
{
36 TestTServerTransport() : valid_(true) {}
37 void close() override
{}
41 shared_ptr
<TTransport
> acceptImpl() override
{
42 return valid_
? std::make_shared
<TestTTransport
>()
43 : shared_ptr
<TestTTransport
>();
47 BOOST_AUTO_TEST_CASE(test_positive_accept
) {
48 TestTServerTransport uut
;
49 BOOST_CHECK(uut
.accept());
52 BOOST_AUTO_TEST_CASE(test_negative_accept
) {
53 TestTServerTransport uut
;
55 BOOST_CHECK_THROW(uut
.accept(), TTransportException
);
58 BOOST_AUTO_TEST_SUITE_END()