741a9e047da0aeb370cde8c703b5565c546ad72e
[shibboleth/cpp-opensaml.git] / samltest / samltest.h
1 /*\r
2  *  Copyright 2001-2005 Internet2\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 #include "internal.h"\r
18 #include <saml/SAMLConfig.h>\r
19 #include <saml/binding/ArtifactMap.h>\r
20 #include <saml/binding/ReplayCache.h>\r
21 \r
22 #include <fstream>\r
23 #include <cxxtest/GlobalFixture.h>\r
24 \r
25 //#define SAML_LEAKCHECK\r
26 \r
27 std::string data_path = "../samltest/data/";\r
28 \r
29 class SAMLFixture : public CxxTest::GlobalFixture\r
30 {\r
31 public:\r
32     bool setUpWorld() {\r
33         XMLToolingConfig::getConfig().log_config();\r
34         if (!SAMLConfig::getConfig().init())\r
35             return false;\r
36         SAMLConfig::getConfig().setReplayCache(new ReplayCache());\r
37         SAMLConfig::getConfig().setArtifactMap(new ArtifactMap());\r
38 \r
39         if (getenv("SAMLTEST_DATA"))\r
40             data_path=std::string(getenv("SAMLTEST_DATA")) + "/";\r
41         //std::string catpath=data_path + "catalog.xml";\r
42         //auto_ptr_XMLCh temp(catpath.c_str());\r
43         //return XMLToolingConfig::getConfig().getValidatingParser().loadCatalog(temp.get());\r
44         return true;\r
45     }\r
46     bool tearDownWorld() {\r
47         SAMLConfig::getConfig().term();\r
48 #if defined(_MSC_VER ) && defined(SAML_LEAKCHECK)\r
49        _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );\r
50        _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );\r
51        _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );\r
52        _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );\r
53        _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );\r
54        _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\r
55        _CrtDumpMemoryLeaks();\r
56 #endif\r
57         return true;\r
58     }\r
59     //bool setUp() { printf( "</test>" ); return true; }\r
60     //bool tearDown() { printf( "</test>" ); return true; }\r
61 };\r
62 \r
63 static SAMLFixture globalFixture;\r
64 \r
65 class GlobalTest : public CxxTest::TestSuite\r
66 {\r
67 public:\r
68     void testGlobal() {\r
69     }\r
70 };\r