aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/llservicebuilder_tut.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:54 -0500
committerJacek Antonelli2008-08-15 23:44:54 -0500
commitb2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch)
tree3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/test/llservicebuilder_tut.cpp
parentSecond Life viewer sources 1.14.0.1 (diff)
downloadmeta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/test/llservicebuilder_tut.cpp')
-rw-r--r--linden/indra/test/llservicebuilder_tut.cpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/linden/indra/test/llservicebuilder_tut.cpp b/linden/indra/test/llservicebuilder_tut.cpp
new file mode 100644
index 0000000..fde0564
--- /dev/null
+++ b/linden/indra/test/llservicebuilder_tut.cpp
@@ -0,0 +1,96 @@
1/**
2* @file llservicebuilder_tut.cpp
3* @brief LLServiceBuilder unit tests
4* @date March 2007
5*
6* Copyright (c) 2006-2007, Linden Research, Inc.
7*
8 * Second Life Viewer Source Code
9 * The source code in this file ("Source Code") is provided by Linden Lab
10 * to you under the terms of the GNU General Public License, version 2.0
11 * ("GPL"), unless you have obtained a separate licensing agreement
12 * ("Other License"), formally executed by you and Linden Lab. Terms of
13 * the GPL can be found in doc/GPL-license.txt in this distribution, or
14 * online at http://secondlife.com/developers/opensource/gplv2
15 *
16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlife.com/developers/opensource/flossexception
20 *
21 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above,
23 * and agree to abide by those obligations.
24 *
25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27 * COMPLETENESS OR PERFORMANCE.
28*/
29
30#include <tut/tut.h>
31#include "lltut.h"
32
33#include "llsd.h"
34#include "llservicebuilder.h"
35
36namespace tut
37{
38
39 struct ServiceBuilderTestData {
40 LLServiceBuilder mServiceBuilder;
41 };
42
43 typedef test_group<ServiceBuilderTestData> ServiceBuilderTestGroup;
44 typedef ServiceBuilderTestGroup::object ServiceBuilderTestObject;
45
46 ServiceBuilderTestGroup serviceBuilderTestGroup("ServiceBuilder");
47
48 template<> template<>
49 void ServiceBuilderTestObject::test<1>()
50 {
51 //Simple service build and reply with no mapping
52 LLSD test_block;
53 test_block["service-builder"] = "/agent/name";
54 mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]);
55 std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest");
56 ensure_equals("Basic URL Creation", test_url , "/agent/name");
57 }
58
59 template<> template<>
60 void ServiceBuilderTestObject::test<2>()
61 {
62 //Simple replace test
63 LLSD test_block;
64 test_block["service-builder"] = "/agent/{$agent-id}/name";
65 mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]);
66 LLSD data_map;
67 data_map["agent-id"] = "257c631f-a0c5-4f29-8a9f-9031feaae6c6";
68 std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest", data_map);
69 ensure_equals("Replacement URL Creation", test_url , "/agent/257c631f-a0c5-4f29-8a9f-9031feaae6c6/name");
70 }
71
72 template<> template<>
73 void ServiceBuilderTestObject::test<3>()
74 {
75 //Incorrect service test
76 LLSD test_block;
77 test_block["service-builder"] = "/agent/{$agent-id}/name";
78 mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]);
79 std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilder");
80 ensure_equals("Replacement URL Creation for Non-existant Service", test_url , "");
81 }
82
83 template<> template<>
84 void ServiceBuilderTestObject::test<4>()
85 {
86 //Incorrect service test
87 LLSD test_block;
88 test_block["service-builder"] = "/agent/{$agent-id}/name";
89 mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]);
90 LLSD data_map;
91 data_map["agent_id"] = "257c631f-a0c5-4f29-8a9f-9031feaae6c6";
92 std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest", data_map);
93 ensure_equals("Replacement URL Creation for Non-existant Service", test_url , "/agent/{$agent-id}/name");
94 }
95}
96