Mercurial > hg > orthanc
comparison UnitTests/RestApi.cpp @ 281:e5402c368b21
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 10 Dec 2012 17:49:14 +0100 |
parents | bd934af46ba4 |
children | 78a8eaa5f30b |
comparison
equal
deleted
inserted
replaced
280:77e526e6fdf8 | 281:e5402c368b21 |
---|---|
48 ASSERT_EQ("a", trail[0]); | 48 ASSERT_EQ("a", trail[0]); |
49 ASSERT_EQ("b", trail[1]); | 49 ASSERT_EQ("b", trail[1]); |
50 ASSERT_EQ("c", trail[2]); | 50 ASSERT_EQ("c", trail[2]); |
51 } | 51 } |
52 } | 52 } |
53 | |
54 | |
55 | |
56 #if 0 | |
57 | |
58 #include "../Core/HttpServer/MongooseServer.h" | |
59 | |
60 struct Tutu : public IDynamicObject | |
61 { | |
62 static void Toto(RestApi::GetCall& call) | |
63 { | |
64 printf("DONE\n"); | |
65 Json::Value a = Json::objectValue; | |
66 a["Tutu"] = "Toto"; | |
67 a["Youpie"] = call.GetArgument("coucou", "nope"); | |
68 a["Toto"] = call.GetUriComponent("test", "nope"); | |
69 call.GetOutput().AnswerJson(a); | |
70 } | |
71 }; | |
72 | |
73 | |
74 | |
75 TEST(RestApi, Tutu) | |
76 { | |
77 MongooseServer httpServer; | |
78 httpServer.SetPortNumber(8042); | |
79 httpServer.Start(); | |
80 | |
81 RestApi* api = new RestApi; | |
82 httpServer.RegisterHandler(api); | |
83 api->Register("/coucou/{test}/a/*", Tutu::Toto); | |
84 | |
85 httpServer.Start(); | |
86 /*LOG(WARNING) << "REST has started"; | |
87 Toolbox::ServerBarrier();*/ | |
88 } | |
89 | |
90 #endif |