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.
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
29 using namespace opensaml;
31 //#define SAML_LEAKCHECK
33 std::string data_path = "../samltest/data/";
35 class SAMLFixture : public CxxTest::GlobalFixture
39 XMLToolingConfig::getConfig().log_config();
40 if (!SAMLConfig::getConfig().init())
42 if (!SAMLConfig::getConfig().init()) // should be a no-op
44 XMLToolingConfig::getConfig().setReplayCache(new ReplayCache());
45 XMLToolingConfig::getConfig().setTemplateEngine(new TemplateEngine());
46 SAMLConfig::getConfig().setArtifactMap(new ArtifactMap());
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());
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();
70 //bool setUp() { printf( "</test>" ); return true; }
71 //bool tearDown() { printf( "</test>" ); return true; }
74 static SAMLFixture globalFixture;
76 class GlobalTest : public CxxTest::TestSuite