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