Moved ReplayCache into xmltooling
[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 <fstream>\r
19 #include <cxxtest/GlobalFixture.h>\r
20 #include <saml/SAMLConfig.h>\r
21 #include <saml/binding/ArtifactMap.h>\r
22 #include <xmltooling/util/ReplayCache.h>\r
23 \r
24 //#define SAML_LEAKCHECK\r
25 \r
26 std::string data_path = "../samltest/data/";\r
27 \r
28 class SAMLFixture : public CxxTest::GlobalFixture\r
29 {\r
30 public:\r
31     bool setUpWorld() {\r
32         XMLToolingConfig::getConfig().log_config();\r
33         if (!SAMLConfig::getConfig().init())\r
34             return false;\r
35         XMLToolingConfig::getConfig().setReplayCache(new ReplayCache());\r
36         SAMLConfig::getConfig().setArtifactMap(new ArtifactMap());\r
37 \r
38         if (getenv("SAMLTEST_DATA"))\r
39             data_path=std::string(getenv("SAMLTEST_DATA")) + "/";\r
40         //std::string catpath=data_path + "catalog.xml";\r
41         //auto_ptr_XMLCh temp(catpath.c_str());\r
42         //return XMLToolingConfig::getConfig().getValidatingParser().loadCatalog(temp.get());\r
43         return true;\r
44     }\r
45     bool tearDownWorld() {\r
46         SAMLConfig::getConfig().term();\r
47 #if defined(_MSC_VER ) && defined(SAML_LEAKCHECK)\r
48        _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );\r
49        _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );\r
50        _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );\r
51        _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );\r
52        _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );\r
53        _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\r
54        _CrtDumpMemoryLeaks();\r
55 #endif\r
56         return true;\r
57     }\r
58     //bool setUp() { printf( "</test>" ); return true; }\r
59     //bool tearDown() { printf( "</test>" ); return true; }\r
60 };\r
61 \r
62 static SAMLFixture globalFixture;\r
63 \r
64 class GlobalTest : public CxxTest::TestSuite\r
65 {\r
66 public:\r
67     void testGlobal() {\r
68     }\r
69 };\r