Fixes associated with wildcard test classes.
[shibboleth/cpp-xmltooling.git] / xmltoolingtest / xmltoolingtest.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 <cxxtest/TestSuite.h>\r
18 #include <cxxtest/GlobalFixture.h>\r
19 \r
20 #include <xmltooling/XMLToolingConfig.h>\r
21 #include <xmltooling/util/ParserPool.h>\r
22 \r
23 using namespace xmltooling;\r
24 \r
25 ParserPool* validatingPool=NULL;\r
26 ParserPool* nonvalidatingPool=NULL;\r
27 std::string data_path = "../xmltoolingtest/data/";\r
28 \r
29 class ToolingFixture : public CxxTest::GlobalFixture\r
30 {\r
31 public:\r
32     bool setUpWorld() {\r
33         XMLToolingConfig::getConfig().log_config();\r
34         if (!XMLToolingConfig::getConfig().init())\r
35             return false;\r
36         validatingPool = new ParserPool(true,true);\r
37         nonvalidatingPool = new ParserPool();\r
38         if (getenv("XMLTOOLINGTEST_DATA"))\r
39             data_path=std::string(getenv("XMLTOOLINGTEST_DATA")) + "/";\r
40         return true;\r
41     }\r
42     bool tearDownWorld() {\r
43         delete validatingPool;\r
44         delete nonvalidatingPool;\r
45         XMLToolingConfig::getConfig().term();\r
46 #if defined(_MSC_VER ) && defined(XMLTOOLINGTEST_LEAKCHECK)\r
47        _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );\r
48        _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );\r
49        _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );\r
50        _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );\r
51        _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );\r
52        _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\r
53        _CrtDumpMemoryLeaks();\r
54 #endif\r
55         return true;\r
56     }\r
57     //bool setUp() { printf( "</test>" ); return true; }\r
58     //bool tearDown() { printf( "</test>" ); return true; }\r
59 };\r
60 \r
61 static ToolingFixture globalFixture;\r
62 \r
63 class CatalogTest : public CxxTest::TestSuite\r
64 {\r
65 public:\r
66     void testCatalog(void) {\r
67         std::string path=data_path + "catalog.xml";\r
68         auto_ptr_XMLCh temp(path.c_str());\r
69         TS_ASSERT(validatingPool->loadCatalog(temp.get()));\r
70     }\r
71 };\r