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