blob: 8383505538b0175efb1f39fd1354a1b58b42fd78 (
plain) (
blame)
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/messagebus/network/rpcserviceaddress.h>
#include <vespa/vespalib/testkit/testapp.h>
using namespace mbus;
TEST_SETUP(Test);
int
Test::Main()
{
TEST_INIT("rpcserviceaddress_test");
{
EXPECT_TRUE(RPCServiceAddress("", "bar").isMalformed());
EXPECT_TRUE(RPCServiceAddress("foo", "bar").isMalformed());
EXPECT_TRUE(RPCServiceAddress("foo/", "bar").isMalformed());
EXPECT_TRUE(RPCServiceAddress("/foo", "bar").isMalformed());
}
{
RPCServiceAddress addr("foo/bar/baz", "tcp/foo.com:42");
EXPECT_TRUE(!addr.isMalformed());
EXPECT_TRUE(addr.getServiceName() == "foo/bar/baz");
EXPECT_TRUE(addr.getConnectionSpec() == "tcp/foo.com:42");
EXPECT_TRUE(addr.getSessionName() == "baz");
}
{
RPCServiceAddress addr("foo/bar", "tcp/foo.com:42");
EXPECT_TRUE(!addr.isMalformed());
EXPECT_TRUE(addr.getServiceName() == "foo/bar");
EXPECT_TRUE(addr.getConnectionSpec() == "tcp/foo.com:42");
EXPECT_TRUE(addr.getSessionName() == "bar");
}
{
RPCServiceAddress addr("", "tcp/foo.com:42");
EXPECT_TRUE(addr.isMalformed());
EXPECT_TRUE(addr.getServiceName() == "");
EXPECT_TRUE(addr.getConnectionSpec() == "tcp/foo.com:42");
EXPECT_TRUE(addr.getSessionName() == "");
}
TEST_DONE();
}
|