test_fixtures.h
Go to the documentation of this file.
1 /*
2  * Unit tests for XmlRpc++
3  *
4  * Copyright (C) 2017, Zoox Inc
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Author: Austin Hendrix <austin@zoox.com>
21  *
22  */
23 
24 #include "xmlrpcpp/XmlRpc.h"
25 
26 #include <boost/thread/mutex.hpp>
27 #include <boost/thread/thread.hpp>
28 #include <gtest/gtest.h>
29 
30 // No arguments, result is "Hello".
31 class Hello : public XmlRpc::XmlRpcServerMethod
32 {
33 public:
34  Hello(XmlRpc::XmlRpcServer* s) : XmlRpc::XmlRpcServerMethod("Hello", s) {}
35 
36  virtual ~Hello() {}
37 
38  void execute(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result);
39 
40  boost::mutex hello_mutex;
41 };
42 
43 class XmlRpcTest : public ::testing::Test
44 {
45 protected:
46  XmlRpcTest();
47 
48  void work();
49 
50  virtual void SetUp();
51 
52  virtual void TearDown();
53 
54  // The server and its methods
56  Hello hello;
57 
58  // Server port number (for clients)
59  int port;
60 
61  // Server thread
63  boost::thread server_thread;
64 };
XmlRpcTest::SetUp
virtual void SetUp()
Definition: HelloTest.cpp:104
XmlRpc::XmlRpcServer
A class to handle XML RPC requests.
Definition: XmlRpcServer.h:41
XmlRpcTest::s
XmlRpc::XmlRpcServer s
Definition: test_fixtures.h:55
Hello::Hello
Hello(XmlRpc::XmlRpcServer *s)
Definition: test_fixtures.h:34
s
XmlRpcServer s
Definition: HelloServer.cpp:11
XmlRpcTest::work
void work()
Definition: HelloTest.cpp:96
XmlRpc
Definition: XmlRpcClient.h:20
XmlRpcTest::TearDown
virtual void TearDown()
Definition: HelloTest.cpp:121
Hello::hello_mutex
boost::mutex hello_mutex
Definition: test_fixtures.h:40
XmlRpcTest::server_thread
boost::thread server_thread
Definition: HelloTest.cpp:141
XmlRpcTest::XmlRpcTest
XmlRpcTest()
Definition: HelloTest.cpp:94
XmlRpcTest::hello
Hello hello
Definition: HelloTest.cpp:132
XmlRpc::XmlRpcServerMethod
Abstract class representing a single RPC method.
Definition: XmlRpcServerMethod.h:26
XmlRpc.h
Hello::~Hello
virtual ~Hello()
Definition: test_fixtures.h:36
Hello::execute
void execute(XmlRpcValue &params, XmlRpcValue &result)
Definition: HelloServer.cpp:19
XmlRpcTest::server_done
bool server_done
Definition: test_fixtures.h:62
Hello
Definition: HelloServer.cpp:14
XmlRpcTest
Definition: HelloTest.cpp:91
XmlRpcTest::port
int port
Definition: HelloTest.cpp:137
XmlRpc::XmlRpcValue
RPC method arguments and results are represented by Values.
Definition: XmlRpcValue.h:24


xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley, Austin Hendrix, Dirk Thomas
autogenerated on Thu Sep 23 2021 03:02:02