summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/unittests/testInit.cpp
blob: 15479ac05570070c302d57b6694919a66853427b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#define BOOST_TEST_MODULE TestInit
#include <boost/test/unit_test.hpp>
#include <dlfcn.h>
#include <Ice/Ice.h>
#include <IceBox/IceBox.h>

typedef IceBox::Service *(* SetupFunction)(Ice::CommunicatorPtr);

BOOST_AUTO_TEST_CASE( init )
{
	void * i = dlsym(NULL, "createGentooBrowseAPI");
	BOOST_REQUIRE(i);
	auto sf = (SetupFunction)i;
	BOOST_REQUIRE(sf);
	Ice::StringSeq args;
	Ice::InitializationData id;
	id.properties = Ice::createProperties();
	id.properties->setProperty("GentooBrowseAPI.Endpoints", "tcp -p 9002");
	auto ic = Ice::initialize(args, id);
	IceBox::Service * s = sf(nullptr);
	s->start("GentooBrowseAPI", ic, {});
	s->stop();
	delete s;
	ic->destroy();
}