[shibboleth-sp2] 71/82: SSPCPP-756 Flesh out Metadata Tests: templateFromRepo

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 a1ef8bc25aa6b9b0c7c69b3029d60deb79df29ff
Author: Rod Widdowson <rdw at steadingsoftware.com>
Date:   Fri Oct 6 13:50:31 2017 +0100

    SSPCPP-756 Flesh out Metadata Tests: templateFromRepo
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-756
    
    This first test fails - templated metadata from http is one of the
    things we need to add.
---
 unittests/DynamicMetadataProviderTest.h | 23 ++++++++++++++++++++---
 unittests/data/templateFromRepo.xml     |  3 +++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/unittests/DynamicMetadataProviderTest.h b/unittests/DynamicMetadataProviderTest.h
index 46e63fc..4ab9662 100644
--- a/unittests/DynamicMetadataProviderTest.h
+++ b/unittests/DynamicMetadataProviderTest.h
@@ -20,14 +20,13 @@
 #include <fstream>
 
 #include "BaseTestCase.h"
-#include <shibsp\SPConfig.h>
-#include <cpp-opensaml\saml\saml2\metadata\MetadataProvider.h>
 #include <xercesc\dom\DOMDocument.hpp>
 #include <cpp-xmltooling\xmltooling\XMLToolingConfig.h>
 #include <cpp-xmltooling\xmltooling\util\XMLHelper.h>
 #include <cpp-xmltooling\xmltooling\util\ParserPool.h>
 
 #include <cpp-opensaml\saml\SAMLConfig.h>
+#include <cpp-opensaml\saml\saml2\metadata\MetadataProvider.h>
 
 
 using namespace xmltooling;
@@ -45,7 +44,25 @@ public:
     void tearDown()
     {}
 
-    void testXMLProvider() {
+    void testTemplateFromRepo() {
+        string config = data_path + "templateFromRepo.xml";
+        ifstream in(config.c_str());
+        XMLToolingConfig& xcf = XMLToolingConfig::getConfig();
+        ParserPool& pool = xcf.getParser();
+        DOMDocument* doc = pool.parse(in);
+        XercesJanitor<DOMDocument> janitor(doc);
+
+        auto_ptr<MetadataProvider> metadataProvider(
+            opensaml::SAMLConfig::getConfig().MetadataProviderManager.newPlugin(DYNAMIC_METADATA_PROVIDER, doc->getDocumentElement())
+        );
+        try {
+            metadataProvider->init();
+            pair<const EntityDescriptor*, const RoleDescriptor*>  pair = metadataProvider->getEntityDescriptor( opensaml::saml2md::MetadataProvider::Criteria("https://www.example.org/sp"));
+        }
+        catch (XMLToolingException& ex) {
+            TS_TRACE(ex.what());
+            throw;
+        }
     }
 
 };
diff --git a/unittests/data/templateFromRepo.xml b/unittests/data/templateFromRepo.xml
new file mode 100644
index 0000000..8b77fb0
--- /dev/null
+++ b/unittests/data/templateFromRepo.xml
@@ -0,0 +1,3 @@
+<MetadataProvider type="Dynamic" ignoreTransport="true" >
+<Subst hashed="SHA1">https://git.shibboleth.net/view/?p=java-opensaml.git&a=blob_plain&f=opensaml-saml-impl/src/test/resources/org/opensaml/saml/metadata/resolver/impl/$entityID.xml&hb=master</Subst>
+</MetadataProvider>

-- 
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