Main Page
Namespaces
Classes
Files
File List
File Members
test
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
55
XmlRpc::XmlRpcServer
s
;
56
Hello
hello;
57
58
// Server port number (for clients)
59
int
port;
60
61
// Server thread
62
bool
server_done
;
63
boost::thread server_thread;
64
};
XmlRpc
Definition:
XmlRpcClient.h:20
Hello::Hello
Hello(XmlRpc::XmlRpcServer *s)
Definition:
test_fixtures.h:34
XmlRpcTest::server_done
bool server_done
Definition:
test_fixtures.h:62
XmlRpc.h
XmlRpc::XmlRpcValue
RPC method arguments and results are represented by Values.
Definition:
XmlRpcValue.h:24
Hello::hello_mutex
boost::mutex hello_mutex
Definition:
test_fixtures.h:40
s
XmlRpcServer s
Definition:
HelloServer.cpp:11
XmlRpcTest
Definition:
HelloTest.cpp:91
XmlRpc::XmlRpcServerMethod
Abstract class representing a single RPC method.
Definition:
XmlRpcServerMethod.h:26
Hello::~Hello
virtual ~Hello()
Definition:
test_fixtures.h:36
Hello::execute
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
Definition:
HelloServer.cpp:19
XmlRpc::XmlRpcServer
A class to handle XML RPC requests.
Definition:
XmlRpcServer.h:39
XmlRpcTest::s
XmlRpc::XmlRpcServer s
Definition:
test_fixtures.h:55
XmlRpc::XmlRpcServerMethod::XmlRpcServerMethod
XmlRpcServerMethod(std::string const &name, XmlRpcServer *server=0)
Constructor.
Definition:
XmlRpcServerMethod.cpp:8
Hello
Definition:
HelloServer.cpp:14
xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley, Austin Hendrix
autogenerated on Sun Feb 3 2019 03:29:51