File: intra_loopback.cpp

package info (click to toggle)
robotraconteur 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,380 kB
  • sloc: cpp: 1,149,268; cs: 87,653; java: 58,127; python: 26,897; ansic: 356; sh: 152; makefile: 90; xml: 51
file content (59 lines) | stat: -rw-r--r-- 1,801 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <boost/shared_array.hpp>

#include <gtest/gtest.h>
#include <RobotRaconteur/ServiceDefinition.h>
#include <RobotRaconteur/RobotRaconteurNode.h>

#include "com__robotraconteur__testing__TestService1.h"
#include "com__robotraconteur__testing__TestService1_stubskel.h"

#include "ServiceTestClient.h"
#include "ServiceTest.h"
#include "robotraconteur_generated.h"
#include "service_test_utils.h"

using namespace RobotRaconteur;
using namespace RobotRaconteur::test;
using namespace RobotRaconteurTest;

TEST(RobotRaconteurService, IntraLoopback)
{
    RobotRaconteurNode::s()->SetNodeName("test_intra_loopback");
    RobotRaconteurNode::s()->SetLogLevelFromEnvVariable();

    RR_SHARED_PTR<IntraTransport> c = RR_MAKE_SHARED<IntraTransport>();
    c->StartServer();

    RR_SHARED_PTR<TcpTransport> c2 = RR_MAKE_SHARED<TcpTransport>();
    c2->StartServer(0);

    // c->EnableNodeAnnounce();
    // c->EnableNodeDiscoveryListening();

    RobotRaconteurNode::s()->RegisterTransport(c);
    RobotRaconteurNode::s()->RegisterServiceType(RR_MAKE_SHARED<com__robotraconteur__testing__TestService1Factory>());
    RobotRaconteurNode::s()->RegisterServiceType(RR_MAKE_SHARED<com__robotraconteur__testing__TestService2Factory>());

    RobotRaconteurTestServiceSupport s;
    s.RegisterServices(c2);

    {
        ServiceTestClient cl;
        EXPECT_NO_THROW(
            cl.RunFullTest("rr+intra:///?nodename=test_intra_loopback&service=RobotRaconteurTestService",
                           "rr+intra:///?nodename=test_intra_loopback&service=RobotRaconteurTestService_auth"));
    }

    cout << "start shutdown" << endl;

    RobotRaconteurNode::s()->Shutdown();
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);

    int ret = RUN_ALL_TESTS();

    return ret;
}