diff options
Diffstat (limited to 'linden/indra/test/llservicebuilder_tut.cpp')
-rw-r--r-- | linden/indra/test/llservicebuilder_tut.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/linden/indra/test/llservicebuilder_tut.cpp b/linden/indra/test/llservicebuilder_tut.cpp index fde0564..762aa46 100644 --- a/linden/indra/test/llservicebuilder_tut.cpp +++ b/linden/indra/test/llservicebuilder_tut.cpp | |||
@@ -1,9 +1,9 @@ | |||
1 | /** | 1 | /** |
2 | * @file llservicebuilder_tut.cpp | 2 | * @file llservicebuilder_tut.cpp |
3 | * @brief LLServiceBuilder unit tests | 3 | * @brief LLServiceBuilder unit tests |
4 | * @date March 2007 | 4 | * @date March 2007 |
5 | * | 5 | * |
6 | * Copyright (c) 2006-2007, Linden Research, Inc. | 6 | * Copyright (c) 2006-2007, Linden Research, Inc. |
7 | * | 7 | * |
8 | * Second Life Viewer Source Code | 8 | * Second Life Viewer Source Code |
9 | * The source code in this file ("Source Code") is provided by Linden Lab | 9 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -24,73 +24,73 @@ | |||
24 | * | 24 | * |
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
27 | * COMPLETENESS OR PERFORMANCE. | 27 | * COMPLETENESS OR PERFORMANCE. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <tut/tut.h> | 30 | #include <tut/tut.h> |
31 | #include "lltut.h" | 31 | #include "lltut.h" |
32 | 32 | ||
33 | #include "llsd.h" | 33 | #include "llsd.h" |
34 | #include "llservicebuilder.h" | 34 | #include "llservicebuilder.h" |
35 | 35 | ||
36 | namespace tut | 36 | namespace tut |
37 | { | 37 | { |
38 | 38 | ||
39 | struct ServiceBuilderTestData { | 39 | struct ServiceBuilderTestData { |
40 | LLServiceBuilder mServiceBuilder; | 40 | LLServiceBuilder mServiceBuilder; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | typedef test_group<ServiceBuilderTestData> ServiceBuilderTestGroup; | 43 | typedef test_group<ServiceBuilderTestData> ServiceBuilderTestGroup; |
44 | typedef ServiceBuilderTestGroup::object ServiceBuilderTestObject; | 44 | typedef ServiceBuilderTestGroup::object ServiceBuilderTestObject; |
45 | 45 | ||
46 | ServiceBuilderTestGroup serviceBuilderTestGroup("ServiceBuilder"); | 46 | ServiceBuilderTestGroup serviceBuilderTestGroup("ServiceBuilder"); |
47 | 47 | ||
48 | template<> template<> | 48 | template<> template<> |
49 | void ServiceBuilderTestObject::test<1>() | 49 | void ServiceBuilderTestObject::test<1>() |
50 | { | 50 | { |
51 | //Simple service build and reply with no mapping | 51 | //Simple service build and reply with no mapping |
52 | LLSD test_block; | 52 | LLSD test_block; |
53 | test_block["service-builder"] = "/agent/name"; | 53 | test_block["service-builder"] = "/agent/name"; |
54 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); | 54 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); |
55 | std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest"); | 55 | std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest"); |
56 | ensure_equals("Basic URL Creation", test_url , "/agent/name"); | 56 | ensure_equals("Basic URL Creation", test_url , "/agent/name"); |
57 | } | 57 | } |
58 | 58 | ||
59 | template<> template<> | 59 | template<> template<> |
60 | void ServiceBuilderTestObject::test<2>() | 60 | void ServiceBuilderTestObject::test<2>() |
61 | { | 61 | { |
62 | //Simple replace test | 62 | //Simple replace test |
63 | LLSD test_block; | 63 | LLSD test_block; |
64 | test_block["service-builder"] = "/agent/{$agent-id}/name"; | 64 | test_block["service-builder"] = "/agent/{$agent-id}/name"; |
65 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); | 65 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); |
66 | LLSD data_map; | 66 | LLSD data_map; |
67 | data_map["agent-id"] = "257c631f-a0c5-4f29-8a9f-9031feaae6c6"; | 67 | data_map["agent-id"] = "257c631f-a0c5-4f29-8a9f-9031feaae6c6"; |
68 | std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest", data_map); | 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"); | 69 | ensure_equals("Replacement URL Creation", test_url , "/agent/257c631f-a0c5-4f29-8a9f-9031feaae6c6/name"); |
70 | } | 70 | } |
71 | 71 | ||
72 | template<> template<> | 72 | template<> template<> |
73 | void ServiceBuilderTestObject::test<3>() | 73 | void ServiceBuilderTestObject::test<3>() |
74 | { | 74 | { |
75 | //Incorrect service test | 75 | //Incorrect service test |
76 | LLSD test_block; | 76 | LLSD test_block; |
77 | test_block["service-builder"] = "/agent/{$agent-id}/name"; | 77 | test_block["service-builder"] = "/agent/{$agent-id}/name"; |
78 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); | 78 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); |
79 | std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilder"); | 79 | std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilder"); |
80 | ensure_equals("Replacement URL Creation for Non-existant Service", test_url , ""); | 80 | ensure_equals("Replacement URL Creation for Non-existant Service", test_url , ""); |
81 | } | 81 | } |
82 | 82 | ||
83 | template<> template<> | 83 | template<> template<> |
84 | void ServiceBuilderTestObject::test<4>() | 84 | void ServiceBuilderTestObject::test<4>() |
85 | { | 85 | { |
86 | //Incorrect service test | 86 | //Incorrect service test |
87 | LLSD test_block; | 87 | LLSD test_block; |
88 | test_block["service-builder"] = "/agent/{$agent-id}/name"; | 88 | test_block["service-builder"] = "/agent/{$agent-id}/name"; |
89 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); | 89 | mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); |
90 | LLSD data_map; | 90 | LLSD data_map; |
91 | data_map["agent_id"] = "257c631f-a0c5-4f29-8a9f-9031feaae6c6"; | 91 | data_map["agent_id"] = "257c631f-a0c5-4f29-8a9f-9031feaae6c6"; |
92 | std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest", data_map); | 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"); | 93 | ensure_equals("Replacement URL Creation for Non-existant Service", test_url , "/agent/{$agent-id}/name"); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||