Skip to content

Commit 62897e0

Browse files
committed
Initial implementation of dynamic dispatcher.
1 parent c6dd632 commit 62897e0

File tree

4 files changed

+73
-1
lines changed

4 files changed

+73
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2013 (c) Google, Inc.
2+
// Copyright 2013 (c) Dean Michael Berris <dberris@google.com>
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef NETWORK_HTTP_SERVER_DYNAMIC_DISPATCHER_HPP_20130327
8+
#define NETWORK_HTTP_SERVER_DYNAMIC_DISPATCHER_HPP_20130327
9+
10+
namespace network {
11+
namespace http {
12+
13+
struct dynamic_dispatcher{};
14+
15+
} // namespace http
16+
} // namespace network
17+
18+
#endif /* end of include guard: NETWORK_HTTP_SERVER_DYNAMIC_DISPATCHER_HPP_20130327 */
19+

http/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if (CPP-NETLIB_BUILD_TESTS)
8686
add_test(cpp-netlib-http-client_test
8787
${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
8888

89-
set (SERVER_TESTS server_simple_sessions_test)
89+
set (SERVER_TESTS server_simple_sessions_test server_dynamic_dispatcher_test)
9090
foreach (test ${SERVER_TESTS})
9191
add_executable(cpp-netlib-http-${test} ${test}.cpp)
9292
add_dependencies(cpp-netlib-http-${test} cppnetlib-http-server)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 (c) Google, Inc.
2+
// Copyright 2013 (c) Dean Michael Berris <dberris@google.com>
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#include <gtest/gtest.h>
8+
#include <network/http/server/dynamic_dispatcher.hpp>
9+
10+
namespace http = ::network::http;
11+
12+
TEST(server_dynamic_dispatcher, constructor) {
13+
http::dynamic_dispatcher dispatcher;
14+
(void)dispatcher;
15+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2013 (c) Google, Inc.
2+
// Copyright 2013 (c) Dean Michael Berris <dberris@google.com>
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#include <gtest/gtest.h>
8+
#include <http/server/simple_sessions.hpp>
9+
10+
namespace http = network::http;
11+
namespace net = network;
12+
13+
namespace {
14+
15+
TEST(simple_sessions_test, constructor) {
16+
http::simple_sessions simple_sessions;
17+
(void) simple_sessions;
18+
}
19+
20+
TEST(simple_sessions_test, lookup) {
21+
http::simple_sessions simple_sessions;
22+
http::session &session = simple_sessions.lookup("sessionid");
23+
(void) session;
24+
}
25+
26+
TEST(simple_sessions_test, update) {
27+
http::simple_sessions simple_sessions;
28+
{
29+
http::session &session = simple_sessions.lookup("sessionid");
30+
session.set("user", "some-user");
31+
}
32+
{
33+
http::session &session = simple_sessions.lookup("sessionid");
34+
EXPECT_EQ("some-user", session["user"]);
35+
}
36+
}
37+
38+
} // namespace

0 commit comments

Comments
 (0)