[shibboleth-sp2] 70/82: SSPCPP-756 Add logging setup to SP test framework.
Etienne Dysli Metref
edm-guest at moszumanska.debian.org
Thu Nov 16 08:16:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
edm-guest pushed a commit to branch master
in repository shibboleth-sp2.
commit d8717c7b98708008c83d1ae66d72155193c515af
Author: Rod Widdowson <rdw at steadingsoftware.com>
Date: Fri Oct 6 13:49:57 2017 +0100
SSPCPP-756 Add logging setup to SP test framework.
https://issues.shibboleth.net/jira/browse/SSPCPP-756
---
Projects/vc15/UnitTests/UnitTests.vcxproj | 17 +++++++++++++
Projects/vc15/UnitTests/UnitTests.vcxproj.filters | 14 +++++++---
unittests/SPTest.h | 31 ++++++++++++++++-------
unittests/config/etc/shibboleth/console.logger | 6 +++++
4 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/Projects/vc15/UnitTests/UnitTests.vcxproj b/Projects/vc15/UnitTests/UnitTests.vcxproj
index bb4550f..e2a16b4 100644
--- a/Projects/vc15/UnitTests/UnitTests.vcxproj
+++ b/Projects/vc15/UnitTests/UnitTests.vcxproj
@@ -91,7 +91,12 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(solutionDir)\..\..\..\;$(solutionDir)\..\..\;$(solutionDir)\..\..\..\cpp-opensaml;$(solutionDir)\..\..\..\cpp-xmltooling;$(OutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
</ClCompile>
+ <Link>
+ <AdditionalDependencies>Shibsp1D.lib;log4shib1D.lib;xmltooling1D.lib;saml2D.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\Build\VC15\$(Platform)\$(Configuration);..\..\..\..\cpp-xmltooling\Build\VC15\$(Platform)\$(Configuration);..\..\..\..\cpp-opensaml\Build\VC15\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -100,7 +105,12 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(solutionDir)\..\..\..\;$(solutionDir)\..\..\;$(solutionDir)\..\..\..\cpp-opensaml;$(solutionDir)\..\..\..\cpp-xmltooling;$(OutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
</ClCompile>
+ <Link>
+ <AdditionalDependencies>Shibsp1D.lib;log4shib1D.lib;xmltooling1D.lib;saml2D.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\\Build\VC15\$(Configuration);..\..\..\..\cpp-xmltooling\Build\VC15\$(Configuration);..\..\..\..\cpp-opensaml\Build\VC15\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -115,6 +125,8 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>Shibsp1.lib;log4shib1.lib;xmltooling1.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\\Build\VC15\$(Configuration);..\..\..\..\cpp-xmltooling\Build\VC15\$(Configuration);..\..\..\..\cpp-opensaml\Build\VC15\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -130,6 +142,8 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>Shibsp1.lib;log4shib1.lib;xmltooling1.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\\Build\VC15\$(Platform)\$(Configuration);..\..\..\..\cpp-xmltooling\Build\VC15\$(Platform)\$(Configuration);..\..\..\..\cpp-opensaml\Build\VC15\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@@ -159,6 +173,9 @@
<ClCompile Include="..\..\..\Build\VC15\UnitTests\x64\Debug\DynamicMetadataProviderTest.cpp" />
<ClCompile Include="..\..\..\Build\VC15\UnitTests\x64\Debug\SPTest.cpp" />
</ItemGroup>
+ <ItemGroup>
+ <Xml Include="..\..\..\unittests\data\DynamicMetadataProvider.xml" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/Projects/vc15/UnitTests/UnitTests.vcxproj.filters b/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
index 518aa29..362c3bd 100644
--- a/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
+++ b/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
@@ -8,19 +8,22 @@
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
+ <Filter Include="Data">
+ <UniqueIdentifier>{c7232fb3-a33b-4038-80d4-eb48b209a285}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\unittests\BaseTestCase.h">
<Filter>UnitTests</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\unittests\SPTest.h">
- <Filter>UnitTests</Filter>
- </ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\unittests\DynamicMetadataProviderTest.h">
<Filter>UnitTests</Filter>
</CustomBuild>
+ <CustomBuild Include="..\..\..\unittests\SPTest.h">
+ <Filter>UnitTests</Filter>
+ </CustomBuild>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\Build\VC15\UnitTests\x64\Debug\DynamicMetadataProviderTest.cpp">
@@ -30,4 +33,9 @@
<Filter>GeneratedCode</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Xml Include="..\..\..\unittests\data\DynamicMetadataProvider.xml">
+ <Filter>Data</Filter>
+ </Xml>
+ </ItemGroup>
</Project>
\ No newline at end of file
diff --git a/unittests/SPTest.h b/unittests/SPTest.h
index ba64bf8..4808f6a 100644
--- a/unittests/SPTest.h
+++ b/unittests/SPTest.h
@@ -1,29 +1,42 @@
#include <fstream>
#include "BaseTestCase.h"
+#include <shibsp/SPConfig.h>
#include <cxxtest/GlobalFixture.h>
-#include <xmltooling/XMLToolingConfig.h>
-#include <xmltooling/util/ParserPool.h>
+#include <shibsp\metadata\MetadataExt.h>
+#include <shibsp\ServiceProvider.h>
-using namespace xmltooling;
-using namespace xercesc;
-using namespace std;
+using namespace shibsp;
-
-string data_path = "../xmltoolingtest/data/";
+std::string data_path = "unittests/data/";
+std::string config_path = "unittests/config";
class ToolingFixture : public CxxTest::GlobalFixture
{
public:
bool setUpWorld() {
+ SPConfig& conf = SPConfig::getConfig();
+ // Initialize the SP library.
+ conf.setFeatures(
+ SPConfig::Metadata |
+ SPConfig::Logging);
+
+ if (!conf.init(nullptr, config_path.c_str())) {
+ fprintf(stderr, "configuration is invalid, see console for specific problems\n");
+ return false;
+ }
+
+ registerMetadataExtClasses();
+
return true;
}
bool tearDownWorld() {
+ SPConfig::getConfig().term();
return true;
}
- //bool setUp() { printf( "</test>" ); return true; }
- //bool tearDown() { printf( "</test>" ); return true; }
};
+static ToolingFixture globalFixture;
+
class GlobalTest : public CxxTest::TestSuite
{
diff --git a/unittests/config/etc/shibboleth/console.logger b/unittests/config/etc/shibboleth/console.logger
new file mode 100644
index 0000000..62b278e
--- /dev/null
+++ b/unittests/config/etc/shibboleth/console.logger
@@ -0,0 +1,6 @@
+log4j.rootCategory=DEBUG, console
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+#log4j.appender.console.layout=org.apache.log4j.BasicLayout
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{%Y-%m-%d %H:%M:%S} %p %c %x: %m%n
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git
More information about the Pkg-shibboleth-devel
mailing list