aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/tests/auto-reply/auto-reply.cpp
blob: 7197d1241df0f4a6ad954ecd3e568fd23cd8cf7a (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/messagebus/emptyreply.h>
#include <vespa/messagebus/routablequeue.h>
#include <vespa/messagebus/testlib/simplemessage.h>
#include <vespa/messagebus/testlib/simplereply.h>
#include <vespa/vespalib/testkit/testapp.h>

using namespace mbus;

TEST_SETUP(Test);

int
Test::Main()
{
    TEST_INIT("auto-reply_test");
    RoutableQueue q;
    {
        Message::UP msg(new SimpleMessage("test"));
    }
    EXPECT_TRUE(q.size() == 0);
    {
        Message::UP msg(new SimpleMessage("test"));
        msg->pushHandler(q);
    }
    EXPECT_TRUE(q.size() == 1);
    {
        Reply::UP reply(new SimpleReply("test"));
    }
    EXPECT_TRUE(q.size() == 1);
    {
        Reply::UP reply(new SimpleReply("test"));
        reply->pushHandler(q);
    }
    EXPECT_TRUE(q.size() == 2);
    TEST_DONE();
}