SAML 2.0 Core Assertion namespace unit tests.
authorBrent Putman <putmanb@georgetown.edu>
Sat, 22 Jul 2006 20:18:01 +0000 (20:18 +0000)
committerBrent Putman <putmanb@georgetown.edu>
Sat, 22 Jul 2006 20:18:01 +0000 (20:18 +0000)
83 files changed:
saml/saml2/core/Assertions.h
saml/saml2/core/impl/Assertions20Impl.cpp
samltest/Makefile.am
samltest/data/saml2/core/impl/Action.xml
samltest/data/saml2/core/impl/ActionOptionalAttributes.xml [deleted file]
samltest/data/saml2/core/impl/AdviceChildElements.xml
samltest/data/saml2/core/impl/Assertion.xml
samltest/data/saml2/core/impl/AssertionChildElements.xml
samltest/data/saml2/core/impl/AssertionIDRef.xml
samltest/data/saml2/core/impl/AssertionOptionalAttributes.xml
samltest/data/saml2/core/impl/AssertionURIRef.xml
samltest/data/saml2/core/impl/Attribute.xml
samltest/data/saml2/core/impl/AttributeChildElements.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/AttributeOptionalAttributes.xml
samltest/data/saml2/core/impl/AttributeStatement.xml
samltest/data/saml2/core/impl/AttributeStatementChildElements.xml
samltest/data/saml2/core/impl/Audience.xml
samltest/data/saml2/core/impl/AudienceRestriction.xml
samltest/data/saml2/core/impl/AudienceRestrictionChildElements.xml
samltest/data/saml2/core/impl/AuthenticatingAuthority.xml
samltest/data/saml2/core/impl/AuthnContext.xml
samltest/data/saml2/core/impl/AuthnContextChildElements.xml
samltest/data/saml2/core/impl/AuthnContextClassRef.xml
samltest/data/saml2/core/impl/AuthnContextDeclRef.xml
samltest/data/saml2/core/impl/AuthnStatement.xml
samltest/data/saml2/core/impl/AuthnStatementChildElements.xml
samltest/data/saml2/core/impl/AuthnStatementOptionalAttributes.xml
samltest/data/saml2/core/impl/AuthzDecisionStatement.xml
samltest/data/saml2/core/impl/AuthzDecisionStatementChildElements.xml
samltest/data/saml2/core/impl/Conditions.xml
samltest/data/saml2/core/impl/ConditionsChildElements.xml
samltest/data/saml2/core/impl/ConditionsOptionalAttributes.xml
samltest/data/saml2/core/impl/EvidenceChildElements.xml
samltest/data/saml2/core/impl/Issuer.xml
samltest/data/saml2/core/impl/IssuerOptionalAttributes.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/KeyInfoConfirmationDataType.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/NameID.xml
samltest/data/saml2/core/impl/NameIDOptionalAttributes.xml
samltest/data/saml2/core/impl/NameIDType.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/NameIDTypeOptionalAttributes.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/OneTimeUse.xml
samltest/data/saml2/core/impl/ProxyRestriction.xml
samltest/data/saml2/core/impl/ProxyRestrictionChildElements.xml
samltest/data/saml2/core/impl/ProxyRestrictionOptionalAttributes.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/Subject.xml
samltest/data/saml2/core/impl/SubjectChildElements.xml
samltest/data/saml2/core/impl/SubjectConfirmation.xml
samltest/data/saml2/core/impl/SubjectConfirmationChildElements.xml
samltest/data/saml2/core/impl/SubjectConfirmationData.xml
samltest/data/saml2/core/impl/SubjectConfirmationDataChildElements.xml [new file with mode: 0644]
samltest/data/saml2/core/impl/SubjectConfirmationDataOptionalAttributes.xml
samltest/data/saml2/core/impl/SubjectLocality.xml
samltest/data/saml2/core/impl/SubjectLocalityOptionalAttributes.xml
samltest/internal.h
samltest/saml2/core/impl/Action20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Advice20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Assertion20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AssertionIDRef20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AssertionURIRef20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Attribute20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AttributeStatement20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Audience20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AudienceRestriction20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AuthenticatingAuthority20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AuthnContext20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AuthnContextClassRef20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AuthnContextDeclRef20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AuthnStatement20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/AuthzDecisionStatement20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Conditions20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Evidence20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Issuer20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/KeyInfoConfirmationDataType20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/NameID20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/NameIDType20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/OneTimeUse20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/ProxyRestriction20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/Subject20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/SubjectConfirmation20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/SubjectConfirmationData20Test.h [new file with mode: 0644]
samltest/saml2/core/impl/SubjectLocality20Test.h [new file with mode: 0644]

index d408c80..cc1ccc9 100644 (file)
@@ -49,6 +49,7 @@ namespace opensaml {
         
         // Forward references
         class SAML_API Assertion;
+        class SAML_API EncryptedAssertion;
         
         DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionIDRef,AssertionID,SAML 2.0 AssertionIDRef element);
         DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionURIRef,AssertionURI,SAML 2.0 AssertionURIRef element);
@@ -216,7 +217,7 @@ namespace opensaml {
             DECL_TYPED_CHILDREN(AssertionIDRef);
             DECL_TYPED_CHILDREN(AssertionURIRef);
             DECL_TYPED_CHILDREN(Assertion);
-            //DECL_TYPED_CHILDREN(EncryptedAssertion);
+            DECL_TYPED_CHILDREN(EncryptedAssertion);
             /** EvidenceType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
index 4672495..532f6ad 100644 (file)
@@ -154,6 +154,8 @@ namespace opensaml {
             }
         };
 
+        //TODO unit test for this
+        //  - need to test encryption/decryption too, or already done in xmltooling ?
         class SAML_DLLLOCAL EncryptedElementTypeImpl : public virtual EncryptedElementType,
             public AbstractComplexElement,
             public AbstractDOMCachingXMLObject,
@@ -222,6 +224,7 @@ namespace opensaml {
             }
         };
 
+        //TODO unit test for this 
         class SAML_DLLLOCAL EncryptedIDImpl : public virtual EncryptedID, public EncryptedElementTypeImpl
         {
         public:
@@ -789,6 +792,7 @@ namespace opensaml {
             }
         };
 
+        //TODO need unit test for this
         class SAML_DLLLOCAL AuthnContextDeclImpl : public virtual AuthnContextDecl, public AnyElementImpl
         {
         public:
@@ -1097,6 +1101,7 @@ namespace opensaml {
             }
         };
 
+        //TODO need unit test for this
         class SAML_DLLLOCAL AttributeValueImpl : public virtual AttributeValue, public AnyElementImpl
         {
         public:
@@ -1199,6 +1204,7 @@ namespace opensaml {
             }
         };
 
+        //TODO unit test for this 
         class SAML_DLLLOCAL EncryptedAttributeImpl : public virtual EncryptedAttribute, public EncryptedElementTypeImpl
         {
         public:
@@ -1331,6 +1337,7 @@ namespace opensaml {
             }
         };
 
+        //TODO unit test for this 
         class SAML_DLLLOCAL EncryptedAssertionImpl : public virtual EncryptedAssertion, public EncryptedElementTypeImpl
         {
         public:
index be61ae8..f5de16d 100644 (file)
@@ -23,17 +23,35 @@ samltest_h = \
     saml1/core/impl/AudienceRestrictionConditionTest.h \
     saml1/core/impl/AudienceTest.h \
     saml1/core/impl/AuthenticationStatementTest.h \
+    saml2/core/impl/Action20Test.h \
+    saml2/core/impl/Advice20Test.h \
     saml2/core/impl/Artifact20Test.h \
     saml2/core/impl/ArtifactResolve20Test.h \
     saml2/core/impl/ArtifactResponse20Test.h \
+    saml2/core/impl/Assertion20Test.h \
     saml2/core/impl/AssertionIDRequest20Test.h \
+    saml2/core/impl/AssertionURIRef20Test.h \
+    saml2/core/impl/Attribute20Test.h \
     saml2/core/impl/AttributeQuery20Test.h \
+    saml2/core/impl/AttributeStatement20Test.h \
+    saml2/core/impl/Audience20Test.h \
+    saml2/core/impl/AudienceRestriction20Test.h \
+    saml2/core/impl/AuthenticatingAuthority20Test.h \
+    saml2/core/impl/AuthnContext20Test.h \
+    saml2/core/impl/AuthnContextClassRef20Test.h \
+    saml2/core/impl/AuthnContextDeclRef20Test.h \
     saml2/core/impl/AuthnQuery20Test.h \
     saml2/core/impl/AuthnRequest20Test.h \
+    saml2/core/impl/AuthnStatement20Test.h \
     saml2/core/impl/AuthzDecisionQuery20Test.h \
+    saml2/core/impl/AuthzDecisionStatement20Test.h \
+    saml2/core/impl/Conditions20Test.h \
+    saml2/core/impl/Evidence20Test.h \
     saml2/core/impl/GetComplete20Test.h \
     saml2/core/impl/IDPEntry20Test.h \
     saml2/core/impl/IDPList20Test.h \
+    saml2/core/impl/Issuer20Test.h \
+    saml2/core/impl/KeyInfoConfirmationDataType20Test.h\
     saml2/core/impl/LogoutRequest20Test.h \
     saml2/core/impl/LogoutResponse20Test.h \
     saml2/core/impl/ManageNameIDRequest20Test.h \
@@ -41,8 +59,12 @@ samltest_h = \
     saml2/core/impl/NameIDMappingRequest20Test.h \
     saml2/core/impl/NameIDMappingResponse20Test.h \
     saml2/core/impl/NameIDPolicy20Test.h \
+    saml2/core/impl/NameID20Test.h \
+    saml2/core/impl/NameIDType20Test.h \
     saml2/core/impl/NewEncryptedID20Test.h \
     saml2/core/impl/NewID20Test.h \
+    saml2/core/impl/OneTimeUse20Test.h \
+    saml2/core/impl/ProxyRestriction20Test.h \
     saml2/core/impl/RequesterID20Test.h \
     saml2/core/impl/RequestedAuthnContext20Test.h \
     saml2/core/impl/Response20Test.h \
@@ -53,6 +75,10 @@ samltest_h = \
     saml2/core/impl/StatusDetail20Test.h \
     saml2/core/impl/StatusMessage20Test.h \
     saml2/core/impl/StatusResponse20Test.h\
+    saml2/core/impl/Subject20Test.h\
+    saml2/core/impl/SubjectConfirmation20Test.h\
+    saml2/core/impl/SubjectConfirmationData20Test.h\
+    saml2/core/impl/SubjectLocality20Test.h\
     saml2/core/impl/Terminate20Test.h \
     saml2/metadata/FilesystemMetadataProviderTest.h
 
index 2e9162f..bf7705c 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Action.xml and b/samltest/data/saml2/core/impl/Action.xml differ
diff --git a/samltest/data/saml2/core/impl/ActionOptionalAttributes.xml b/samltest/data/saml2/core/impl/ActionOptionalAttributes.xml
deleted file mode 100644 (file)
index c7766c7..0000000
Binary files a/samltest/data/saml2/core/impl/ActionOptionalAttributes.xml and /dev/null differ
index b872820..72f40ac 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AdviceChildElements.xml and b/samltest/data/saml2/core/impl/AdviceChildElements.xml differ
index 54b5f54..24f6522 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Assertion.xml and b/samltest/data/saml2/core/impl/Assertion.xml differ
index 67e917a..238a6b8 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AssertionChildElements.xml and b/samltest/data/saml2/core/impl/AssertionChildElements.xml differ
index b6c07b0..039ec59 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AssertionIDRef.xml and b/samltest/data/saml2/core/impl/AssertionIDRef.xml differ
index abfd7df..959b542 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AssertionOptionalAttributes.xml and b/samltest/data/saml2/core/impl/AssertionOptionalAttributes.xml differ
index 313ee24..cf33958 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AssertionURIRef.xml and b/samltest/data/saml2/core/impl/AssertionURIRef.xml differ
index 3f82e10..c5cdb52 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Attribute.xml and b/samltest/data/saml2/core/impl/Attribute.xml differ
diff --git a/samltest/data/saml2/core/impl/AttributeChildElements.xml b/samltest/data/saml2/core/impl/AttributeChildElements.xml
new file mode 100644 (file)
index 0000000..206f191
Binary files /dev/null and b/samltest/data/saml2/core/impl/AttributeChildElements.xml differ
index 6ceb810..ba99fb1 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AttributeOptionalAttributes.xml and b/samltest/data/saml2/core/impl/AttributeOptionalAttributes.xml differ
index 126259c..36f7ea2 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AttributeStatement.xml and b/samltest/data/saml2/core/impl/AttributeStatement.xml differ
index 6b30b14..6145080 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AttributeStatementChildElements.xml and b/samltest/data/saml2/core/impl/AttributeStatementChildElements.xml differ
index 014826e..446ffac 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Audience.xml and b/samltest/data/saml2/core/impl/Audience.xml differ
index 3caca6b..c349f1e 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AudienceRestriction.xml and b/samltest/data/saml2/core/impl/AudienceRestriction.xml differ
index 7c5a9b5..90f011a 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AudienceRestrictionChildElements.xml and b/samltest/data/saml2/core/impl/AudienceRestrictionChildElements.xml differ
index dbaa528..307b529 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthenticatingAuthority.xml and b/samltest/data/saml2/core/impl/AuthenticatingAuthority.xml differ
index 4cc45b7..4f03ea6 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnContext.xml and b/samltest/data/saml2/core/impl/AuthnContext.xml differ
index 943638f..e0a5000 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnContextChildElements.xml and b/samltest/data/saml2/core/impl/AuthnContextChildElements.xml differ
index 5c98363..5324cc3 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnContextClassRef.xml and b/samltest/data/saml2/core/impl/AuthnContextClassRef.xml differ
index 86d6476..18ab5ff 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnContextDeclRef.xml and b/samltest/data/saml2/core/impl/AuthnContextDeclRef.xml differ
index d86cb43..7ce1017 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnStatement.xml and b/samltest/data/saml2/core/impl/AuthnStatement.xml differ
index f32826a..11d0a40 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnStatementChildElements.xml and b/samltest/data/saml2/core/impl/AuthnStatementChildElements.xml differ
index 7198d82..1603be1 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthnStatementOptionalAttributes.xml and b/samltest/data/saml2/core/impl/AuthnStatementOptionalAttributes.xml differ
index 970b15e..25b7c75 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthzDecisionStatement.xml and b/samltest/data/saml2/core/impl/AuthzDecisionStatement.xml differ
index 84bd12a..5f5693a 100644 (file)
Binary files a/samltest/data/saml2/core/impl/AuthzDecisionStatementChildElements.xml and b/samltest/data/saml2/core/impl/AuthzDecisionStatementChildElements.xml differ
index 2fbb68b..b061bbf 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Conditions.xml and b/samltest/data/saml2/core/impl/Conditions.xml differ
index 696778c..f32c3f0 100644 (file)
Binary files a/samltest/data/saml2/core/impl/ConditionsChildElements.xml and b/samltest/data/saml2/core/impl/ConditionsChildElements.xml differ
index 2eb7206..fad56ed 100644 (file)
Binary files a/samltest/data/saml2/core/impl/ConditionsOptionalAttributes.xml and b/samltest/data/saml2/core/impl/ConditionsOptionalAttributes.xml differ
index 956b603..d3e597f 100644 (file)
Binary files a/samltest/data/saml2/core/impl/EvidenceChildElements.xml and b/samltest/data/saml2/core/impl/EvidenceChildElements.xml differ
index 5dd24ae..5dd303a 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Issuer.xml and b/samltest/data/saml2/core/impl/Issuer.xml differ
diff --git a/samltest/data/saml2/core/impl/IssuerOptionalAttributes.xml b/samltest/data/saml2/core/impl/IssuerOptionalAttributes.xml
new file mode 100644 (file)
index 0000000..3cc35ae
Binary files /dev/null and b/samltest/data/saml2/core/impl/IssuerOptionalAttributes.xml differ
diff --git a/samltest/data/saml2/core/impl/KeyInfoConfirmationDataType.xml b/samltest/data/saml2/core/impl/KeyInfoConfirmationDataType.xml
new file mode 100644 (file)
index 0000000..db780d2
Binary files /dev/null and b/samltest/data/saml2/core/impl/KeyInfoConfirmationDataType.xml differ
diff --git a/samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml b/samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml
new file mode 100644 (file)
index 0000000..9002fbd
Binary files /dev/null and b/samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml differ
diff --git a/samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml b/samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml
new file mode 100644 (file)
index 0000000..10546cb
Binary files /dev/null and b/samltest/data/saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml differ
index bccde84..cef35e8 100644 (file)
Binary files a/samltest/data/saml2/core/impl/NameID.xml and b/samltest/data/saml2/core/impl/NameID.xml differ
index 405c31f..8af601f 100644 (file)
Binary files a/samltest/data/saml2/core/impl/NameIDOptionalAttributes.xml and b/samltest/data/saml2/core/impl/NameIDOptionalAttributes.xml differ
diff --git a/samltest/data/saml2/core/impl/NameIDType.xml b/samltest/data/saml2/core/impl/NameIDType.xml
new file mode 100644 (file)
index 0000000..b5a802b
Binary files /dev/null and b/samltest/data/saml2/core/impl/NameIDType.xml differ
diff --git a/samltest/data/saml2/core/impl/NameIDTypeOptionalAttributes.xml b/samltest/data/saml2/core/impl/NameIDTypeOptionalAttributes.xml
new file mode 100644 (file)
index 0000000..cd6bcc0
Binary files /dev/null and b/samltest/data/saml2/core/impl/NameIDTypeOptionalAttributes.xml differ
index c77061c..8f7d3c4 100644 (file)
Binary files a/samltest/data/saml2/core/impl/OneTimeUse.xml and b/samltest/data/saml2/core/impl/OneTimeUse.xml differ
index e1a79e9..3827d49 100644 (file)
Binary files a/samltest/data/saml2/core/impl/ProxyRestriction.xml and b/samltest/data/saml2/core/impl/ProxyRestriction.xml differ
index fc39669..97c16c6 100644 (file)
Binary files a/samltest/data/saml2/core/impl/ProxyRestrictionChildElements.xml and b/samltest/data/saml2/core/impl/ProxyRestrictionChildElements.xml differ
diff --git a/samltest/data/saml2/core/impl/ProxyRestrictionOptionalAttributes.xml b/samltest/data/saml2/core/impl/ProxyRestrictionOptionalAttributes.xml
new file mode 100644 (file)
index 0000000..1f4903e
Binary files /dev/null and b/samltest/data/saml2/core/impl/ProxyRestrictionOptionalAttributes.xml differ
index 3f53fe2..22f301e 100644 (file)
Binary files a/samltest/data/saml2/core/impl/Subject.xml and b/samltest/data/saml2/core/impl/Subject.xml differ
index c60a5ad..7864e11 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectChildElements.xml and b/samltest/data/saml2/core/impl/SubjectChildElements.xml differ
index a7951db..f8ae526 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectConfirmation.xml and b/samltest/data/saml2/core/impl/SubjectConfirmation.xml differ
index feacd77..0983bd0 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectConfirmationChildElements.xml and b/samltest/data/saml2/core/impl/SubjectConfirmationChildElements.xml differ
index 5c88556..1e894aa 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectConfirmationData.xml and b/samltest/data/saml2/core/impl/SubjectConfirmationData.xml differ
diff --git a/samltest/data/saml2/core/impl/SubjectConfirmationDataChildElements.xml b/samltest/data/saml2/core/impl/SubjectConfirmationDataChildElements.xml
new file mode 100644 (file)
index 0000000..1e894aa
Binary files /dev/null and b/samltest/data/saml2/core/impl/SubjectConfirmationDataChildElements.xml differ
index 615f8cf..f664011 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectConfirmationDataOptionalAttributes.xml and b/samltest/data/saml2/core/impl/SubjectConfirmationDataOptionalAttributes.xml differ
index 77d8d38..e5c6072 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectLocality.xml and b/samltest/data/saml2/core/impl/SubjectLocality.xml differ
index db678ff..12c2e98 100644 (file)
Binary files a/samltest/data/saml2/core/impl/SubjectLocalityOptionalAttributes.xml and b/samltest/data/saml2/core/impl/SubjectLocalityOptionalAttributes.xml differ
index 664ab40..a49c55f 100644 (file)
@@ -20,6 +20,8 @@
 #include <saml/exceptions.h>
 #include <saml/SAMLConfig.h>
 #include <saml/util/SAMLConstants.h>
+#include <xmltooling/exceptions.h>
+#include <xmltooling/validation/Validator.h>
 #include <xmltooling/XMLObject.h>
 #include <xmltooling/XMLObjectBuilder.h>
 
@@ -126,3 +128,120 @@ public:
         if (expectedChildElementsDOM) expectedChildElementsDOM->release();
     }
 };
+
+class SAMLObjectValidatorBaseTestCase : virtual public SAMLObjectBaseTestCase {
+
+    public:
+        SAMLObjectValidatorBaseTestCase() : target(NULL), targetQName(NULL), builder(NULL), validator(NULL) {}
+
+        virtual ~SAMLObjectValidatorBaseTestCase() {
+            delete validator;
+        }
+
+    protected: 
+        /** The primary XMLObject which will be the target of a given test run */
+        XMLObject* target;
+
+        /** QName of the object to be tested */
+        QName targetQName;
+
+        /** Builder for XMLObjects of type targetQName */
+        const XMLObjectBuilder* builder;
+
+        /** Validator for the type corresponding to the test target */
+        Validator* validator;
+
+        /** Subclasses should override to populate required elements and attributes */
+        virtual void populateRequiredData() { }
+
+        /**
+         * Asserts that the validation of default test XMLObject target 
+         * was successful, as expected.
+         * 
+         * @param message
+         */
+        void assertValidationPass(const char* message) {
+            assertValidationPass(message, target);
+        }
+
+        /**
+         * Asserts that the validation of the specified XMLObject target 
+         * was successful, as expected.
+         * 
+         * @param message
+         * @param validateTarget
+         */
+        void assertValidationPass(const char* message, XMLObject* validateTarget) {
+            try {
+                validator->validate(validateTarget);
+            } catch (ValidationException &e) {
+                TS_TRACE(message);
+                TS_TRACE("Expected success, but validation failure raised following ValidationException: ");
+                TS_FAIL(e.getMessage());
+            }
+        }
+
+        /**
+         * Asserts that the validation of the default test XMLObject target 
+         * failed, as expected.
+         * 
+         * @param message
+         */
+        void assertValidationFail(const char* message) {
+            assertValidationFail(message, target);
+        }
+
+        /**
+         * Asserts that the validation of the specified XMLObject target 
+         * failed, as expected.
+         * 
+         * @param message
+         * @param validateTarget
+         */
+        void assertValidationFail(const char* message, XMLObject* validateTarget) {
+            try {
+                validator->validate(validateTarget);
+                TS_TRACE(message);
+                TS_FAIL("Validation success, expected failure to raise ValidationException");
+            } catch (ValidationException &e) {
+            }
+        }
+
+        /**
+         * Build an XMLObject based on the specified QName
+         * 
+         * @param targetQName QName of the type of object to build
+         * @returns new XMLObject of type targetQName
+         */
+        XMLObject* buildXMLObject(QName &targetQName) {
+            // Create the builder on the first request only, for efficiency
+            if (builder == NULL) {
+                builder = XMLObjectBuilder::getBuilder(targetQName);
+                TSM_ASSERT("Unable to retrieve builder for object QName: " + targetQName.toString(), builder!=NULL);
+            }
+            return builder->buildObject(targetQName.getNamespaceURI(), targetQName.getLocalPart(), targetQName.getPrefix());
+
+        }
+
+    public:
+
+        void setUp() {
+            SAMLObjectBaseTestCase::setUp();
+
+            TSM_ASSERT("targetQName was empty", targetQName.hasLocalPart());
+
+            TSM_ASSERT("validator was null", validator!=NULL);
+
+            target = buildXMLObject(targetQName);
+            TSM_ASSERT("XMLObject target was NULL", target!=NULL);
+            populateRequiredData();
+        }
+
+        void tearDown() {
+            delete target;
+            target=NULL;
+            SAMLObjectBaseTestCase::tearDown();
+        }
+
+};
+
diff --git a/samltest/saml2/core/impl/Action20Test.h b/samltest/saml2/core/impl/Action20Test.h
new file mode 100644 (file)
index 0000000..910a990
--- /dev/null
@@ -0,0 +1,61 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Action20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedNamespace; \r
+    XMLCh* expectedContent; \r
+\r
+public:\r
+    void setUp() {\r
+        expectedNamespace = XMLString::transcode("urn:string:namespace"); \r
+        expectedContent = XMLString::transcode("someActionName"); \r
+\r
+        singleElementFile = data_path + "saml2/core/impl/Action.xml";\r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedNamespace);\r
+        XMLString::release(&expectedContent);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Action* action = dynamic_cast<Action*>(xo.get());\r
+        TS_ASSERT(action!=NULL);\r
+\r
+        assertEquals("Element content", expectedContent, action->getAction());\r
+        assertEquals("Namespace attribute", expectedNamespace, action->getNamespace());\r
+    }\r
+\r
+\r
+    void testSingleElementMarshall() {\r
+        Action* action = ActionBuilder::buildAction();\r
+        TS_ASSERT(action!=NULL);\r
+\r
+        action->setAction(expectedContent);\r
+        action->setNamespace(expectedNamespace);\r
+        assertEquals(expectedDOM, action);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Advice20Test.h b/samltest/saml2/core/impl/Advice20Test.h
new file mode 100644 (file)
index 0000000..66e0c41
--- /dev/null
@@ -0,0 +1,89 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Advice20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+\r
+//TODO test with some non-SAML Other children\r
+\r
+public:\r
+    void setUp() {\r
+        singleElementFile = data_path + "saml2/core/impl/Advice.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AdviceChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Advice* advice = dynamic_cast<Advice*>(xo.get());\r
+        TS_ASSERT(advice!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, advice->getAssertionIDRefs().size());\r
+        TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, advice->getAssertionURIRefs().size());\r
+        TSM_ASSERT_EQUALS("# of Assertion child elements", 0, advice->getAssertions().size());\r
+        TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, advice->getEncryptedAssertions().size());\r
+        TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        Advice* advice= dynamic_cast<Advice*>(xo.get());\r
+        TS_ASSERT(advice!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, advice->getAssertionIDRefs().size());\r
+        TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, advice->getAssertionURIRefs().size());\r
+        TSM_ASSERT_EQUALS("# of Assertion child elements", 2, advice->getAssertions().size());\r
+        TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, advice->getEncryptedAssertions().size());\r
+        TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        Advice* advice=AdviceBuilder::buildAdvice();\r
+        assertEquals(expectedDOM, advice);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        Advice* advice=AdviceBuilder::buildAdvice();\r
+\r
+        Assertion* assertion1 = AssertionBuilder::buildAssertion();\r
+        assertion1->setID(XMLString::transcode("abc123"));\r
+        assertion1->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
+\r
+        Assertion* assertion2 = AssertionBuilder::buildAssertion();\r
+        assertion2->setID(XMLString::transcode("def456"));\r
+        assertion2->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
+\r
+        advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
+        advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
+        advice->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
+        advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
+        advice->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
+        advice->getAssertions().push_back(assertion1);\r
+        advice->getEncryptedAssertions().push_back(EncryptedAssertionBuilder::buildEncryptedAssertion());\r
+        advice->getAssertions().push_back(assertion2);\r
+        assertEquals(expectedChildElementsDOM, advice);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Assertion20Test.h b/samltest/saml2/core/impl/Assertion20Test.h
new file mode 100644 (file)
index 0000000..4bd3ddb
--- /dev/null
@@ -0,0 +1,135 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Assertion20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    const XMLCh* expectedVersion;\r
+    XMLCh* expectedID;\r
+    DateTime* expectedIssueInstant;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedVersion = SAMLConstants::SAML20_VERSION;\r
+        expectedID = XMLString::transcode("abc123");\r
+        expectedIssueInstant = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
+        expectedIssueInstant->parseDateTime();\r
+    \r
+\r
+        singleElementFile = data_path + "saml2/core/impl/Assertion.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AssertionOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AssertionChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        delete expectedIssueInstant;\r
+        XMLString::release(&expectedID);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Assertion* assertion = dynamic_cast<Assertion*>(xo.get());\r
+        TS_ASSERT(assertion!=NULL);\r
+\r
+        assertEquals("ID attribute", expectedID, assertion->getID());\r
+        assertEquals("Version attribute", expectedVersion, assertion->getVersion());\r
+        TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion->getIssueInstant()->getEpoch());\r
+\r
+        TS_ASSERT(assertion->getIssuer()==NULL);\r
+        TS_ASSERT(assertion->getSignature()==NULL);\r
+        TS_ASSERT(assertion->getSubject()==NULL);\r
+        TS_ASSERT(assertion->getConditions()==NULL);\r
+        TS_ASSERT(assertion->getAdvice()==NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Statement child elements", 0, assertion->getStatements().size());\r
+        TSM_ASSERT_EQUALS("# of AuthnStatement child elements", 0, assertion->getAuthnStatements().size());\r
+        TSM_ASSERT_EQUALS("# of AttributeStatement child elements", 0, assertion->getAttributeStatements().size());\r
+        TSM_ASSERT_EQUALS("# of AuthzDecisionStatement child elements", 0, assertion->getAuthzDecisionStatements().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        Assertion* assertion= dynamic_cast<Assertion*>(xo.get());\r
+        TS_ASSERT(assertion!=NULL);\r
+\r
+        assertEquals("ID attribute", expectedID, assertion->getID());\r
+        assertEquals("Version attribute", expectedVersion, assertion->getVersion());\r
+        TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion->getIssueInstant()->getEpoch());\r
+\r
+        TS_ASSERT(assertion->getIssuer()!=NULL);\r
+        TS_ASSERT(assertion->getSignature()==NULL);\r
+        TS_ASSERT(assertion->getSubject()!=NULL);\r
+        TS_ASSERT(assertion->getConditions()!=NULL);\r
+        TS_ASSERT(assertion->getAdvice()!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Statement child elements", 0, assertion->getStatements().size());\r
+        TSM_ASSERT_EQUALS("# of AuthnStatement child elements", 1, assertion->getAuthnStatements().size());\r
+        TSM_ASSERT_EQUALS("# of AttributeStatement child elements", 3, assertion->getAttributeStatements().size());\r
+        TSM_ASSERT_EQUALS("# of AuthzDecisionStatement child elements", 2, assertion->getAuthzDecisionStatements().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        Assertion* assertion=AssertionBuilder::buildAssertion();\r
+        assertion->setID(expectedID);\r
+        assertion->setIssueInstant(expectedIssueInstant);\r
+        assertEquals(expectedDOM, assertion);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        Assertion* assertion=AssertionBuilder::buildAssertion();\r
+        assertion->setID(expectedID);\r
+        assertion->setIssueInstant(expectedIssueInstant);\r
+        assertion->setIssuer(IssuerBuilder::buildIssuer());\r
+        assertion->setSubject(SubjectBuilder::buildSubject());\r
+        assertion->setConditions(ConditionsBuilder::buildConditions());\r
+        assertion->setAdvice(AdviceBuilder::buildAdvice());\r
+\r
+        //Test storing children as their direct type \r
+        assertion->getAuthnStatements().push_back(AuthnStatementBuilder::buildAuthnStatement());\r
+        assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
+        assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
+        assertion->getAuthzDecisionStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
+        assertion->getAuthzDecisionStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
+        assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
+        assertEquals(expectedChildElementsDOM, assertion);\r
+\r
+        // Note: assertEquals() above has already 'delete'-ed the XMLObject* it was passed\r
+        assertion=NULL;\r
+        assertion=AssertionBuilder::buildAssertion();\r
+        assertion->setID(expectedID);\r
+        assertion->setIssueInstant(expectedIssueInstant);\r
+        assertion->setIssuer(IssuerBuilder::buildIssuer());\r
+        assertion->setSubject(SubjectBuilder::buildSubject());\r
+        assertion->setConditions(ConditionsBuilder::buildConditions());\r
+        assertion->setAdvice(AdviceBuilder::buildAdvice());\r
+\r
+        //Test storing children as a Statement (each is a derived type of StatementAbstractType)\r
+        assertion->getStatements().push_back(AuthnStatementBuilder::buildAuthnStatement());\r
+        assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
+        assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
+        assertion->getStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
+        assertion->getStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
+        assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
+        assertEquals(expectedChildElementsDOM, assertion);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/AssertionIDRef20Test.h b/samltest/saml2/core/impl/AssertionIDRef20Test.h
new file mode 100644 (file)
index 0000000..ab78cef
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class AssertionIDRef20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedContent;
+
+public:
+    void setUp() {
+        expectedContent=XMLString::transcode("assertion ID");
+        singleElementFile = data_path + "saml2/core/impl/AssertionIDRef.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedContent);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        AssertionIDRef* idref = dynamic_cast<AssertionIDRef*>(xo.get());
+        TS_ASSERT(idref!=NULL);
+        assertEquals("AssertionIDRef text content", expectedContent, idref->getAssertionID());
+    }
+
+    void testSingleElementMarshall() {
+        AssertionIDRef * idref = AssertionIDRefBuilder::buildAssertionIDRef();
+        idref->setAssertionID(expectedContent);
+        assertEquals(expectedDOM, idref);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/AssertionURIRef20Test.h b/samltest/saml2/core/impl/AssertionURIRef20Test.h
new file mode 100644 (file)
index 0000000..df02d0e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class AssertionURIRef20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedContent;
+
+public:
+    void setUp() {
+        expectedContent=XMLString::transcode("assertion URI");
+        singleElementFile = data_path + "saml2/core/impl/AssertionURIRef.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedContent);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        AssertionURIRef* uriref = dynamic_cast<AssertionURIRef*>(xo.get());
+        TS_ASSERT(uriref!=NULL);
+        assertEquals("AssertionURIRef text content", expectedContent, uriref->getAssertionURI());
+    }
+
+    void testSingleElementMarshall() {
+        AssertionURIRef * uriref = AssertionURIRefBuilder::buildAssertionURIRef();
+        uriref->setAssertionURI(expectedContent);
+        assertEquals(expectedDOM, uriref);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/Attribute20Test.h b/samltest/saml2/core/impl/Attribute20Test.h
new file mode 100644 (file)
index 0000000..18e37c6
--- /dev/null
@@ -0,0 +1,107 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Attribute20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedName;\r
+    XMLCh* expectedNameFormat;\r
+    XMLCh* expectedFriendlyName;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedName = XMLString::transcode("attribName");\r
+        expectedNameFormat = XMLString::transcode("urn:string:format");\r
+        expectedFriendlyName = XMLString::transcode("Attribute Name");\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/Attribute.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AttributeOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AttributeChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedName);\r
+        XMLString::release(&expectedNameFormat);\r
+        XMLString::release(&expectedFriendlyName);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Attribute* attribute = dynamic_cast<Attribute*>(xo.get());\r
+        TS_ASSERT(attribute!=NULL);\r
+\r
+        assertEquals("Name attribute", expectedName, attribute->getName());\r
+        TS_ASSERT(attribute->getNameFormat()==NULL);\r
+        TS_ASSERT(attribute->getFriendlyName()==NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of AttributeValue child elements", 0, attribute->getAttributeValues().size());\r
+\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        Attribute* attribute = dynamic_cast<Attribute*>(xo.get());\r
+        TS_ASSERT(attribute!=NULL);\r
+\r
+        assertEquals("Name attribute", expectedName, attribute->getName());\r
+        assertEquals("NameFormat attribute", expectedNameFormat, attribute->getNameFormat());\r
+        assertEquals("FriendlyName attribute", expectedFriendlyName, attribute->getFriendlyName());\r
+\r
+        TSM_ASSERT_EQUALS("# of AttributeValue child elements", 0, attribute->getAttributeValues().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        Attribute* attribute= dynamic_cast<Attribute*>(xo.get());\r
+        TS_ASSERT(attribute!=NULL);\r
+\r
+        TS_ASSERT(attribute->getName()==NULL);\r
+        TS_ASSERT(attribute->getNameFormat()==NULL);\r
+        TS_ASSERT(attribute->getFriendlyName()==NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of AttributeValue child elements", 3, attribute->getAttributeValues().size());\r
+\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        Attribute* attribute=AttributeBuilder::buildAttribute();\r
+        attribute->setName(expectedName);\r
+        assertEquals(expectedDOM, attribute);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        Attribute* attribute=AttributeBuilder::buildAttribute();\r
+        attribute->setName(expectedName);\r
+        attribute->setNameFormat(expectedNameFormat);\r
+        attribute->setFriendlyName(expectedFriendlyName);\r
+        assertEquals(expectedOptionalAttributesDOM, attribute);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        Attribute* attribute=AttributeBuilder::buildAttribute();\r
+        attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());\r
+        attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());\r
+        attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());\r
+        assertEquals(expectedChildElementsDOM, attribute);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/AttributeStatement20Test.h b/samltest/saml2/core/impl/AttributeStatement20Test.h
new file mode 100644 (file)
index 0000000..830d557
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class AttributeStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+\r
+public:\r
+    void setUp() {\r
+        singleElementFile = data_path + "saml2/core/impl/AttributeStatement.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AttributeStatementChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        AttributeStatement* statement = dynamic_cast<AttributeStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Attribute child elements", 0, statement->getAttributes().size());\r
+        TSM_ASSERT_EQUALS("# of EncryptedAttribute child elements", 0, statement->getEncryptedAttributes().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        AttributeStatement* statement= dynamic_cast<AttributeStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Attribute child elements", 3, statement->getAttributes().size());\r
+        TSM_ASSERT_EQUALS("# of EncryptedAttribute child elements", 1, statement->getEncryptedAttributes().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        AttributeStatement* statement=AttributeStatementBuilder::buildAttributeStatement();\r
+        assertEquals(expectedDOM, statement);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        AttributeStatement* statement=AttributeStatementBuilder::buildAttributeStatement();\r
+\r
+        statement->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
+        statement->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
+        statement->getEncryptedAttributes().push_back(EncryptedAttributeBuilder::buildEncryptedAttribute());\r
+        statement->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
+        assertEquals(expectedChildElementsDOM, statement);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Audience20Test.h b/samltest/saml2/core/impl/Audience20Test.h
new file mode 100644 (file)
index 0000000..22e4098
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class Audience20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedContent;
+
+public:
+    void setUp() {
+        expectedContent=XMLString::transcode("audience URI");
+        singleElementFile = data_path + "saml2/core/impl/Audience.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedContent);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        Audience* audience = dynamic_cast<Audience*>(xo.get());
+        TS_ASSERT(audience!=NULL);
+        assertEquals("Audience text content", expectedContent, audience->getAudienceURI());
+    }
+
+    void testSingleElementMarshall() {
+        Audience * audience = AudienceBuilder::buildAudience();
+        audience->setAudienceURI(expectedContent);
+        assertEquals(expectedDOM, audience);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/AudienceRestriction20Test.h b/samltest/saml2/core/impl/AudienceRestriction20Test.h
new file mode 100644 (file)
index 0000000..dedd2e5
--- /dev/null
@@ -0,0 +1,64 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class AudienceRestriction20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+\r
+public:\r
+    void setUp() {\r
+        singleElementFile = data_path + "saml2/core/impl/AudienceRestriction.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AudienceRestrictionChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        AudienceRestriction* ar = dynamic_cast<AudienceRestriction*>(xo.get());\r
+        TS_ASSERT(ar!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Audience child elements", 0, ar->getAudiences().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        AudienceRestriction* ar= dynamic_cast<AudienceRestriction*>(xo.get());\r
+        TS_ASSERT(ar!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Audience child elements", 2, ar->getAudiences().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        AudienceRestriction* ar=AudienceRestrictionBuilder::buildAudienceRestriction();\r
+        assertEquals(expectedDOM, ar);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        AudienceRestriction* ar=AudienceRestrictionBuilder::buildAudienceRestriction();\r
+        ar->getAudiences().push_back(AudienceBuilder::buildAudience());\r
+        ar->getAudiences().push_back(AudienceBuilder::buildAudience());\r
+        assertEquals(expectedChildElementsDOM, ar);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/AuthenticatingAuthority20Test.h b/samltest/saml2/core/impl/AuthenticatingAuthority20Test.h
new file mode 100644 (file)
index 0000000..cbffa1b
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class AuthenticatingAuthority20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedContent;
+
+public:
+    void setUp() {
+        expectedContent=XMLString::transcode("authenticating URI");
+        singleElementFile = data_path + "saml2/core/impl/AuthenticatingAuthority.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedContent);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        AuthenticatingAuthority* aa = dynamic_cast<AuthenticatingAuthority*>(xo.get());
+        TS_ASSERT(aa!=NULL);
+        assertEquals("AuthenticatingAuthority text content", expectedContent, aa->getID());
+    }
+
+    void testSingleElementMarshall() {
+        AuthenticatingAuthority * aa = AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority();
+        aa->setID(expectedContent);
+        assertEquals(expectedDOM, aa);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/AuthnContext20Test.h b/samltest/saml2/core/impl/AuthnContext20Test.h
new file mode 100644 (file)
index 0000000..360d144
--- /dev/null
@@ -0,0 +1,72 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class AuthnContext20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+\r
+public:\r
+    void setUp() {\r
+        singleElementFile = data_path + "saml2/core/impl/AuthnContext.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AuthnContextChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        AuthnContext* ac = dynamic_cast<AuthnContext*>(xo.get());\r
+        TS_ASSERT(ac!=NULL);\r
+\r
+        TS_ASSERT(ac->getAuthnContextClassRef()==NULL);\r
+        TS_ASSERT(ac->getAuthnContextDecl()==NULL);\r
+        TS_ASSERT(ac->getAuthnContextDeclRef()==NULL);\r
+        TSM_ASSERT_EQUALS("# of AuthenticatingAuthority child elements", 0, ac->getAuthenticatingAuthoritys().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        AuthnContext* ac= dynamic_cast<AuthnContext*>(xo.get());\r
+        TS_ASSERT(ac!=NULL);\r
+\r
+        TS_ASSERT(ac->getAuthnContextClassRef()!=NULL);\r
+        TS_ASSERT(ac->getAuthnContextDecl()==NULL);\r
+        TS_ASSERT(ac->getAuthnContextDeclRef()!=NULL);\r
+        TSM_ASSERT_EQUALS("# of AuthenticatingAuthority child elements", 2, ac->getAuthenticatingAuthoritys().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();\r
+        assertEquals(expectedDOM, ac);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();\r
+        ac->setAuthnContextClassRef(AuthnContextClassRefBuilder::buildAuthnContextClassRef());\r
+        ac->setAuthnContextDeclRef(AuthnContextDeclRefBuilder::buildAuthnContextDeclRef());\r
+        ac->getAuthenticatingAuthoritys().push_back(AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority());\r
+        ac->getAuthenticatingAuthoritys().push_back(AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority());\r
+        assertEquals(expectedChildElementsDOM, ac);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/AuthnContextClassRef20Test.h b/samltest/saml2/core/impl/AuthnContextClassRef20Test.h
new file mode 100644 (file)
index 0000000..56a4084
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class AuthnContextClassRef20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedContent;
+
+public:
+    void setUp() {
+        expectedContent=XMLString::transcode("class reference");
+        singleElementFile = data_path + "saml2/core/impl/AuthnContextClassRef.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedContent);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        AuthnContextClassRef* classref = dynamic_cast<AuthnContextClassRef*>(xo.get());
+        TS_ASSERT(classref!=NULL);
+        assertEquals("AuthnContextClassRef text content", expectedContent, classref->getReference());
+    }
+
+    void testSingleElementMarshall() {
+        AuthnContextClassRef * classref = AuthnContextClassRefBuilder::buildAuthnContextClassRef();
+        classref->setReference(expectedContent);
+        assertEquals(expectedDOM, classref);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/AuthnContextDeclRef20Test.h b/samltest/saml2/core/impl/AuthnContextDeclRef20Test.h
new file mode 100644 (file)
index 0000000..c912811
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class AuthnContextDeclRef20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedContent;
+
+public:
+    void setUp() {
+        expectedContent=XMLString::transcode("declaration reference");
+        singleElementFile = data_path + "saml2/core/impl/AuthnContextDeclRef.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedContent);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        AuthnContextDeclRef* declref = dynamic_cast<AuthnContextDeclRef*>(xo.get());
+        TS_ASSERT(declref!=NULL);
+        assertEquals("AuthnContextDeclRef text content", expectedContent, declref->getReference());
+    }
+
+    void testSingleElementMarshall() {
+        AuthnContextDeclRef * declref = AuthnContextDeclRefBuilder::buildAuthnContextDeclRef();
+        declref->setReference(expectedContent);
+        assertEquals(expectedDOM, declref);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/AuthnStatement20Test.h b/samltest/saml2/core/impl/AuthnStatement20Test.h
new file mode 100644 (file)
index 0000000..e4223be
--- /dev/null
@@ -0,0 +1,111 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class AuthnStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    DateTime* expectedAuthnInstant;\r
+    XMLCh* expectedSessionIndex;\r
+    DateTime* expectedSessionNotOnOrAfter;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedAuthnInstant = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
+        expectedAuthnInstant->parseDateTime();\r
+        expectedSessionIndex = (XMLString::transcode("abc123"));\r
+        expectedSessionNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
+        expectedSessionNotOnOrAfter->parseDateTime();\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/AuthnStatement.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnStatementOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AuthnStatementChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        delete expectedAuthnInstant;\r
+        XMLString::release(&expectedSessionIndex);\r
+        delete expectedSessionNotOnOrAfter;\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        AuthnStatement* statement = dynamic_cast<AuthnStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("AuthnInstant attribute", expectedAuthnInstant->getEpoch(), statement->getAuthnInstant()->getEpoch());\r
+        TS_ASSERT(statement->getSessionIndex()==NULL);\r
+        TS_ASSERT(statement->getSessionNotOnOrAfter()==NULL);\r
+\r
+        TS_ASSERT(statement->getSubjectLocality()==NULL);\r
+        TS_ASSERT(statement->getAuthnContext()==NULL);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        AuthnStatement* statement = dynamic_cast<AuthnStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("AuthnInstant attribute", expectedAuthnInstant->getEpoch(), statement->getAuthnInstant()->getEpoch());\r
+        assertEquals("SessionIndex attribute", expectedSessionIndex, statement->getSessionIndex());\r
+        TSM_ASSERT_EQUALS("SessionNotOnOrAfter attribute", expectedSessionNotOnOrAfter->getEpoch(), statement->getSessionNotOnOrAfter()->getEpoch());\r
+\r
+        TS_ASSERT(statement->getSubjectLocality()==NULL);\r
+        TS_ASSERT(statement->getAuthnContext()==NULL);\r
+\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        AuthnStatement* statement= dynamic_cast<AuthnStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        TS_ASSERT(statement->getAuthnInstant()==NULL);\r
+        TS_ASSERT(statement->getSessionIndex()==NULL);\r
+        TS_ASSERT(statement->getSessionNotOnOrAfter()==NULL);\r
+\r
+        TS_ASSERT(statement->getSubjectLocality()!=NULL);\r
+        TS_ASSERT(statement->getAuthnContext()!=NULL);\r
+\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
+        statement->setAuthnInstant(expectedAuthnInstant);\r
+        assertEquals(expectedDOM, statement);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
+        statement->setAuthnInstant(expectedAuthnInstant);\r
+        statement->setSessionIndex(expectedSessionIndex);\r
+        statement->setSessionNotOnOrAfter(expectedSessionNotOnOrAfter);\r
+        assertEquals(expectedOptionalAttributesDOM, statement);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
+        statement->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());\r
+        statement->setAuthnContext(AuthnContextBuilder::buildAuthnContext());\r
+        assertEquals(expectedChildElementsDOM, statement);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/AuthzDecisionStatement20Test.h b/samltest/saml2/core/impl/AuthzDecisionStatement20Test.h
new file mode 100644 (file)
index 0000000..fb0d5fd
--- /dev/null
@@ -0,0 +1,82 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class AuthzDecisionStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedResource; \r
+    const XMLCh* expectedDecision; \r
+\r
+public:\r
+    void setUp() {\r
+        expectedResource = XMLString::transcode("urn:string:resource"); \r
+        expectedDecision = AuthzDecisionStatement::DECISION_PERMIT;\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/AuthzDecisionStatement.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/AuthzDecisionStatementChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedResource);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        AuthzDecisionStatement* statement = dynamic_cast<AuthzDecisionStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        assertEquals("Resource attribute", expectedResource, statement->getResource());\r
+        assertEquals("Decision attribute", expectedDecision, statement->getDecision());\r
+\r
+        TSM_ASSERT_EQUALS("# of Action child elements", 0, statement->getActions().size());\r
+        TS_ASSERT(statement->getEvidence()==NULL);\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        AuthzDecisionStatement* statement= dynamic_cast<AuthzDecisionStatement*>(xo.get());\r
+        TS_ASSERT(statement!=NULL);\r
+\r
+        assertEquals("Resource attribute", NULL, statement->getResource());\r
+        assertEquals("Decision attribute", NULL, statement->getDecision());\r
+\r
+        TSM_ASSERT_EQUALS("# of Action child elements", 3, statement->getActions().size());\r
+        TS_ASSERT(statement->getEvidence()!=NULL);\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();\r
+        statement->setResource(expectedResource);\r
+        statement->setDecision(expectedDecision);\r
+        assertEquals(expectedDOM, statement);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();\r
+        statement->getActions().push_back(ActionBuilder::buildAction());\r
+        statement->getActions().push_back(ActionBuilder::buildAction());\r
+        statement->getActions().push_back(ActionBuilder::buildAction());\r
+        statement->setEvidence(EvidenceBuilder::buildEvidence());\r
+        assertEquals(expectedChildElementsDOM, statement);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Conditions20Test.h b/samltest/saml2/core/impl/Conditions20Test.h
new file mode 100644 (file)
index 0000000..e144e5a
--- /dev/null
@@ -0,0 +1,127 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Conditions20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    DateTime* expectedNotBefore;\r
+    DateTime* expectedNotOnOrAfter;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
+        expectedNotBefore->parseDateTime();\r
+        expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
+        expectedNotOnOrAfter->parseDateTime();\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/Conditions.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ConditionsOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/ConditionsChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        delete expectedNotBefore;\r
+        delete expectedNotOnOrAfter;\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Conditions* conditions = dynamic_cast<Conditions*>(xo.get());\r
+        TS_ASSERT(conditions!=NULL);\r
+\r
+\r
+        TS_ASSERT(conditions->getNotBefore()==NULL);\r
+        TS_ASSERT(conditions->getNotOnOrAfter()==NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());\r
+        TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 0, conditions->getAudienceRestrictions().size());\r
+        TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 0, conditions->getOneTimeUses().size());\r
+        TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 0, conditions->getProxyRestrictions().size());\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        Conditions* conditions = dynamic_cast<Conditions*>(xo.get());\r
+        TS_ASSERT(conditions!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), conditions->getNotBefore()->getEpoch());\r
+        TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), conditions->getNotOnOrAfter()->getEpoch());\r
+\r
+        TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());\r
+        TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 0, conditions->getAudienceRestrictions().size());\r
+        TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 0, conditions->getOneTimeUses().size());\r
+        TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 0, conditions->getProxyRestrictions().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        Conditions* conditions= dynamic_cast<Conditions*>(xo.get());\r
+        TS_ASSERT(conditions!=NULL);\r
+\r
+        TS_ASSERT(conditions->getNotBefore()==NULL);\r
+        TS_ASSERT(conditions->getNotOnOrAfter()==NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());\r
+        TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 3, conditions->getAudienceRestrictions().size());\r
+        TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 1, conditions->getOneTimeUses().size());\r
+        TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 2, conditions->getProxyRestrictions().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        Conditions* conditions=ConditionsBuilder::buildConditions();\r
+        assertEquals(expectedDOM, conditions);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        Conditions* conditions=ConditionsBuilder::buildConditions();\r
+        conditions->setNotBefore(expectedNotBefore);\r
+        conditions->setNotOnOrAfter(expectedNotOnOrAfter);\r
+        assertEquals(expectedOptionalAttributesDOM, conditions);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        Conditions* conditions=ConditionsBuilder::buildConditions();\r
+\r
+        //Test storing children as their direct type \r
+        conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
+        conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
+        conditions->getProxyRestrictions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
+        conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
+        conditions->getOneTimeUses().push_back(OneTimeUseBuilder::buildOneTimeUse());\r
+        conditions->getProxyRestrictions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
+        assertEquals(expectedChildElementsDOM, conditions);\r
+\r
+        // Note: assertEquals() above has already 'delete'-ed the XMLObject* it was passed\r
+        conditions=NULL;\r
+        conditions=ConditionsBuilder::buildConditions();\r
+\r
+        //Test storing children as a Condition (each is a derived type of ConditionAbstractType)\r
+        conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
+        conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
+        conditions->getConditions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
+        conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
+        conditions->getConditions().push_back(OneTimeUseBuilder::buildOneTimeUse());\r
+        conditions->getConditions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
+        assertEquals(expectedChildElementsDOM, conditions);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Evidence20Test.h b/samltest/saml2/core/impl/Evidence20Test.h
new file mode 100644 (file)
index 0000000..ae03184
--- /dev/null
@@ -0,0 +1,85 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Evidence20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+\r
+public:\r
+    void setUp() {\r
+        singleElementFile = data_path + "saml2/core/impl/Evidence.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/EvidenceChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Evidence* evidence = dynamic_cast<Evidence*>(xo.get());\r
+        TS_ASSERT(evidence!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, evidence->getAssertionIDRefs().size());\r
+        TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, evidence->getAssertionURIRefs().size());\r
+        TSM_ASSERT_EQUALS("# of Assertion child elements", 0, evidence->getAssertions().size());\r
+        TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, evidence->getEncryptedAssertions().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        Evidence* evidence= dynamic_cast<Evidence*>(xo.get());\r
+        TS_ASSERT(evidence!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, evidence->getAssertionIDRefs().size());\r
+        TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, evidence->getAssertionURIRefs().size());\r
+        TSM_ASSERT_EQUALS("# of Assertion child elements", 2, evidence->getAssertions().size());\r
+        TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, evidence->getEncryptedAssertions().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        Evidence* evidence=EvidenceBuilder::buildEvidence();\r
+        assertEquals(expectedDOM, evidence);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        Evidence* evidence=EvidenceBuilder::buildEvidence();\r
+\r
+        Assertion* assertion1 = AssertionBuilder::buildAssertion();\r
+        assertion1->setID(XMLString::transcode("abc123"));\r
+        assertion1->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
+\r
+        Assertion* assertion2 = AssertionBuilder::buildAssertion();\r
+        assertion2->setID(XMLString::transcode("def456"));\r
+        assertion2->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
+\r
+        evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
+        evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
+        evidence->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
+        evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
+        evidence->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
+        evidence->getAssertions().push_back(assertion1);\r
+        evidence->getEncryptedAssertions().push_back(EncryptedAssertionBuilder::buildEncryptedAssertion());\r
+        evidence->getAssertions().push_back(assertion2);\r
+        assertEquals(expectedChildElementsDOM, evidence);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Issuer20Test.h b/samltest/saml2/core/impl/Issuer20Test.h
new file mode 100644 (file)
index 0000000..849b436
--- /dev/null
@@ -0,0 +1,93 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Issuer20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedNameQualifier; \r
+    XMLCh* expectedSPNameQualifier; \r
+    XMLCh* expectedFormat; \r
+    XMLCh* expectedSPProvidedID; \r
+    XMLCh* expectedContent; \r
+\r
+public:\r
+    void setUp() {\r
+        expectedNameQualifier = XMLString::transcode("nq"); \r
+        expectedSPNameQualifier = XMLString::transcode("spnq"); \r
+        expectedFormat = XMLString::transcode("format"); \r
+        expectedSPProvidedID = XMLString::transcode("spID"); \r
+        expectedContent = XMLString::transcode("someIssuer"); \r
+\r
+        singleElementFile = data_path + "saml2/core/impl/Issuer.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/IssuerOptionalAttributes.xml";\r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedNameQualifier);\r
+        XMLString::release(&expectedSPNameQualifier);\r
+        XMLString::release(&expectedFormat);\r
+        XMLString::release(&expectedSPProvidedID);\r
+        XMLString::release(&expectedContent);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Issuer* issuer = dynamic_cast<Issuer*>(xo.get());\r
+        TS_ASSERT(issuer!=NULL);\r
+\r
+        assertEquals("Element content", expectedContent, issuer->getName());\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        Issuer* issuer = dynamic_cast<Issuer*>(xo.get());\r
+        TS_ASSERT(issuer!=NULL);\r
+\r
+        assertEquals("NameQualifier attribute", expectedNameQualifier, issuer->getNameQualifier());\r
+        assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, issuer->getSPNameQualifier());\r
+        assertEquals("Format attribute", expectedFormat, issuer->getFormat());\r
+        assertEquals("SPProvidedID attribute", expectedSPProvidedID, issuer->getSPProvidedID());\r
+        assertEquals("Element content", expectedContent, issuer->getName());\r
+    }\r
+\r
+\r
+    void testSingleElementMarshall() {\r
+        Issuer* issuer = IssuerBuilder::buildIssuer();\r
+        TS_ASSERT(issuer!=NULL);\r
+\r
+        issuer->setName(expectedContent);\r
+        assertEquals(expectedDOM, issuer);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        Issuer* issuer = IssuerBuilder::buildIssuer();\r
+        TS_ASSERT(issuer!=NULL);\r
+\r
+        issuer->setNameQualifier(expectedNameQualifier);\r
+        issuer->setSPNameQualifier(expectedSPNameQualifier);\r
+        issuer->setFormat(expectedFormat);\r
+        issuer->setSPProvidedID(expectedSPProvidedID);\r
+        issuer->setName(expectedContent);\r
+        assertEquals(expectedOptionalAttributesDOM, issuer);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/KeyInfoConfirmationDataType20Test.h b/samltest/saml2/core/impl/KeyInfoConfirmationDataType20Test.h
new file mode 100644 (file)
index 0000000..f4aefce
--- /dev/null
@@ -0,0 +1,124 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+using namespace xmlsignature;\r
+\r
+//TODO need testing for ElementProxy and wildcard attributes/elements\r
+\r
+class KeyInfoConfirmationDataType20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    DateTime* expectedNotBefore;\r
+    DateTime* expectedNotOnOrAfter;\r
+    XMLCh* expectedRecipient;\r
+    XMLCh* expectedInResponseTo;\r
+    XMLCh* expectedAddress;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
+        expectedNotBefore->parseDateTime();\r
+        expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
+        expectedNotOnOrAfter->parseDateTime();\r
+        expectedRecipient = (XMLString::transcode("recipient"));\r
+        expectedInResponseTo = (XMLString::transcode("inresponse"));\r
+        expectedAddress = (XMLString::transcode("address"));\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataType.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        delete expectedNotBefore;\r
+        delete expectedNotOnOrAfter;\r
+        XMLString::release(&expectedRecipient);\r
+        XMLString::release(&expectedInResponseTo);\r
+        XMLString::release(&expectedAddress);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        KeyInfoConfirmationDataType* scd = dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());\r
+        TS_ASSERT(scd!=NULL);\r
+\r
+        TS_ASSERT(scd->getNotBefore()==NULL);\r
+        TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
+        TS_ASSERT(scd->getRecipient()==NULL);\r
+        TS_ASSERT(scd->getInResponseTo()==NULL);\r
+        TS_ASSERT(scd->getAddress()==NULL);\r
+        TSM_ASSERT_EQUALS("# of KeyInfo child elements", 0, scd->getKeyInfos().size());\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        KeyInfoConfirmationDataType* scd = dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());\r
+        TS_ASSERT(scd!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), scd->getNotBefore()->getEpoch());\r
+        TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), scd->getNotOnOrAfter()->getEpoch());\r
+        assertEquals("Recipient attribute", expectedRecipient, scd->getRecipient());\r
+        assertEquals("InResponseTo attribute", expectedInResponseTo, scd->getInResponseTo());\r
+        assertEquals("Address attribute", expectedAddress, scd->getAddress());\r
+        TSM_ASSERT_EQUALS("# of KeyInfo child elements", 0, scd->getKeyInfos().size());\r
+\r
+        //TODO need to test with some wildcard attributes\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        KeyInfoConfirmationDataType* scd= dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());\r
+        TS_ASSERT(scd!=NULL);\r
+\r
+        TS_ASSERT(scd->getNotBefore()==NULL);\r
+        TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
+        TS_ASSERT(scd->getRecipient()==NULL);\r
+        TS_ASSERT(scd->getInResponseTo()==NULL);\r
+        TS_ASSERT(scd->getAddress()==NULL);\r
+        TSM_ASSERT_EQUALS("# of KeyInfo child elements", 1, scd->getKeyInfos().size());\r
+\r
+        //TODO need to test with some wildcard child elements\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();\r
+        assertEquals(expectedDOM, scd);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();\r
+        scd->setNotBefore(expectedNotBefore);\r
+        scd->setNotOnOrAfter(expectedNotOnOrAfter);\r
+        scd->setRecipient(expectedRecipient);\r
+        scd->setInResponseTo(expectedInResponseTo);\r
+        scd->setAddress(expectedAddress);\r
+        //TODO need to test with some wilcard attributes\r
+        assertEquals(expectedOptionalAttributesDOM, scd);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();\r
+        scd->getKeyInfos().push_back(KeyInfoBuilder::buildKeyInfo());\r
+        //TODO need to test with some wilcard child elements\r
+        assertEquals(expectedChildElementsDOM, scd);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/NameID20Test.h b/samltest/saml2/core/impl/NameID20Test.h
new file mode 100644 (file)
index 0000000..6948cab
--- /dev/null
@@ -0,0 +1,93 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class NameID20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedNameQualifier; \r
+    XMLCh* expectedSPNameQualifier; \r
+    XMLCh* expectedFormat; \r
+    XMLCh* expectedSPProvidedID; \r
+    XMLCh* expectedContent; \r
+\r
+public:\r
+    void setUp() {\r
+        expectedNameQualifier = XMLString::transcode("nq"); \r
+        expectedSPNameQualifier = XMLString::transcode("spnq"); \r
+        expectedFormat = XMLString::transcode("format"); \r
+        expectedSPProvidedID = XMLString::transcode("spID"); \r
+        expectedContent = XMLString::transcode("someNameID"); \r
+\r
+        singleElementFile = data_path + "saml2/core/impl/NameID.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDOptionalAttributes.xml";\r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedNameQualifier);\r
+        XMLString::release(&expectedSPNameQualifier);\r
+        XMLString::release(&expectedFormat);\r
+        XMLString::release(&expectedSPProvidedID);\r
+        XMLString::release(&expectedContent);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        NameID* nameid = dynamic_cast<NameID*>(xo.get());\r
+        TS_ASSERT(nameid!=NULL);\r
+\r
+        assertEquals("Element content", expectedContent, nameid->getName());\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        NameID* nameid = dynamic_cast<NameID*>(xo.get());\r
+        TS_ASSERT(nameid!=NULL);\r
+\r
+        assertEquals("NameQualifier attribute", expectedNameQualifier, nameid->getNameQualifier());\r
+        assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, nameid->getSPNameQualifier());\r
+        assertEquals("Format attribute", expectedFormat, nameid->getFormat());\r
+        assertEquals("SPProvidedID attribute", expectedSPProvidedID, nameid->getSPProvidedID());\r
+        assertEquals("Element content", expectedContent, nameid->getName());\r
+    }\r
+\r
+\r
+    void testSingleElementMarshall() {\r
+        NameID* nameid = NameIDBuilder::buildNameID();\r
+        TS_ASSERT(nameid!=NULL);\r
+\r
+        nameid->setName(expectedContent);\r
+        assertEquals(expectedDOM, nameid);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        NameID* nameid = NameIDBuilder::buildNameID();\r
+        TS_ASSERT(nameid!=NULL);\r
+\r
+        nameid->setNameQualifier(expectedNameQualifier);\r
+        nameid->setSPNameQualifier(expectedSPNameQualifier);\r
+        nameid->setFormat(expectedFormat);\r
+        nameid->setSPProvidedID(expectedSPProvidedID);\r
+        nameid->setName(expectedContent);\r
+        assertEquals(expectedOptionalAttributesDOM, nameid);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/NameIDType20Test.h b/samltest/saml2/core/impl/NameIDType20Test.h
new file mode 100644 (file)
index 0000000..aa87866
--- /dev/null
@@ -0,0 +1,139 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+/*\r
+   This tests building an element of type NameIDType with a non-SAML element name and namespace\r
+ */\r
+\r
+class NameIDType20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedNameQualifier; \r
+    XMLCh* expectedSPNameQualifier; \r
+    XMLCh* expectedFormat; \r
+    XMLCh* expectedSPProvidedID; \r
+    XMLCh* expectedContent; \r
+\r
+    //TODO possibly move these up to SAMLObjectBaseTestCase, for use in optional helper methods below\r
+    XMLCh* elementName;\r
+    XMLCh* elementNS;\r
+    XMLCh* elementPrefix;\r
+    const XMLCh* typeName;\r
+    const XMLCh* typeNS;\r
+    const XMLCh* typePrefix;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedNameQualifier = XMLString::transcode("nq"); \r
+        expectedSPNameQualifier = XMLString::transcode("spnq"); \r
+        expectedFormat = XMLString::transcode("format"); \r
+        expectedSPProvidedID = XMLString::transcode("spID"); \r
+        expectedContent = XMLString::transcode("someNameID"); \r
+\r
+        elementName = XMLString::transcode("Foo");;\r
+        elementNS = XMLString::transcode("http://www.example.org/test");\r
+        elementPrefix = XMLString::transcode("test");;\r
+        typeName = NameIDType::TYPE_NAME;\r
+        typeNS = SAMLConstants::SAML20_NS;\r
+        typePrefix = SAMLConstants::SAML20_PREFIX;\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/NameIDType.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDTypeOptionalAttributes.xml";\r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedNameQualifier);\r
+        XMLString::release(&expectedSPNameQualifier);\r
+        XMLString::release(&expectedFormat);\r
+        XMLString::release(&expectedSPProvidedID);\r
+        XMLString::release(&expectedContent);\r
+        XMLString::release(&elementName);\r
+        XMLString::release(&elementNS);\r
+        XMLString::release(&elementPrefix);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    //TODO possibly move this functionality up to SAMLObjectBaseTestCase, as optional helper method\r
+    void checkNameAndType(XMLObject* xo) {\r
+        assertEquals("Element name", elementName, xo->getElementQName().getLocalPart());\r
+        assertEquals("Element namespace", elementNS, xo->getElementQName().getNamespaceURI());\r
+        assertEquals("Element namespace prefix", elementPrefix, xo->getElementQName().getPrefix());\r
+\r
+        assertEquals("Schema type name", typeName, xo->getSchemaType()->getLocalPart());\r
+        assertEquals("Schema type namespace", typeNS, xo->getSchemaType()->getNamespaceURI());\r
+        assertEquals("Schema type namespace prefix", typePrefix, xo->getSchemaType()->getPrefix());\r
+    }\r
+\r
+    //TODO possibly move this functionality up to SAMLObjectBaseTestCase, as optional helper method\r
+    XMLObject * buildObject() {\r
+        const XMLObjectBuilder* builder = XMLObjectBuilder::getBuilder(QName(typeNS,typeName));\r
+        QName type(typeNS,typeName,typePrefix);\r
+        return builder->buildObject(elementNS, elementName, elementPrefix, &type);\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        NameIDType* nameid = dynamic_cast<NameIDType*>(xo.get());\r
+        TS_ASSERT(nameid!=NULL);\r
+\r
+        checkNameAndType(nameid);\r
+\r
+        assertEquals("Element content", expectedContent, nameid->getName());\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        NameIDType* nameid = dynamic_cast<NameIDType*>(xo.get());\r
+        TS_ASSERT(nameid!=NULL);\r
+\r
+        checkNameAndType(nameid);\r
+\r
+        assertEquals("NameQualifier attribute", expectedNameQualifier, nameid->getNameQualifier());\r
+        assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, nameid->getSPNameQualifier());\r
+        assertEquals("Format attribute", expectedFormat, nameid->getFormat());\r
+        assertEquals("SPProvidedID attribute", expectedSPProvidedID, nameid->getSPProvidedID());\r
+        assertEquals("Element content", expectedContent, nameid->getName());\r
+    }\r
+\r
+\r
+    void testSingleElementMarshall() {\r
+        NameIDType* nameid = dynamic_cast<NameIDType*>(buildObject());\r
+        TS_ASSERT(nameid!=NULL);\r
+        checkNameAndType(nameid);\r
+\r
+        nameid->setName(expectedContent);\r
+        assertEquals(expectedDOM, nameid);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        NameIDType* nameid = dynamic_cast<NameIDType*>(buildObject());\r
+        TS_ASSERT(nameid!=NULL);\r
+        checkNameAndType(nameid);\r
+\r
+        nameid->setNameQualifier(expectedNameQualifier);\r
+        nameid->setSPNameQualifier(expectedSPNameQualifier);\r
+        nameid->setFormat(expectedFormat);\r
+        nameid->setSPProvidedID(expectedSPProvidedID);\r
+        nameid->setName(expectedContent);\r
+        assertEquals(expectedOptionalAttributesDOM, nameid);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/OneTimeUse20Test.h b/samltest/saml2/core/impl/OneTimeUse20Test.h
new file mode 100644 (file)
index 0000000..53cfbe6
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+
+using namespace opensaml::saml2;
+
+class OneTimeUse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+    void setUp() {
+        singleElementFile = data_path + "saml2/core/impl/OneTimeUse.xml";
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        OneTimeUse* otu = dynamic_cast<OneTimeUse*>(xo.get());
+        TS_ASSERT(otu!=NULL);
+    }
+
+    void testSingleElementMarshall() {
+        OneTimeUse * otu = OneTimeUseBuilder::buildOneTimeUse();
+        assertEquals(expectedDOM, otu);
+    }
+
+
+};
diff --git a/samltest/saml2/core/impl/ProxyRestriction20Test.h b/samltest/saml2/core/impl/ProxyRestriction20Test.h
new file mode 100644 (file)
index 0000000..09416a4
--- /dev/null
@@ -0,0 +1,85 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class ProxyRestriction20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    int expectedCount;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedCount = 5;\r
+        singleElementFile = data_path + "saml2/core/impl/ProxyRestriction.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ProxyRestrictionOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/ProxyRestrictionChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        ProxyRestriction* pr = dynamic_cast<ProxyRestriction*>(xo.get());\r
+        TS_ASSERT(pr!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("Count attribute presence", false, pr->getCount().first);\r
+        TSM_ASSERT_EQUALS("# of Audience child elements", 0, pr->getAudiences().size());\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        ProxyRestriction* pr = dynamic_cast<ProxyRestriction*>(xo.get());\r
+        TS_ASSERT(pr!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("Count attribute presence", true, pr->getCount().first);\r
+        TSM_ASSERT_EQUALS("Count attribute value", expectedCount, pr->getCount().second);\r
+        TSM_ASSERT_EQUALS("# of Audience child elements", 0, pr->getAudiences().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        ProxyRestriction* pr= dynamic_cast<ProxyRestriction*>(xo.get());\r
+        TS_ASSERT(pr!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("Count attribute presence", false, pr->getCount().first);\r
+        TSM_ASSERT_EQUALS("# of Audience child elements", 2, pr->getAudiences().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();\r
+        assertEquals(expectedDOM, pr);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();\r
+        pr->setCount(expectedCount);\r
+        assertEquals(expectedOptionalAttributesDOM, pr);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();\r
+        pr->getAudiences().push_back(AudienceBuilder::buildAudience());\r
+        pr->getAudiences().push_back(AudienceBuilder::buildAudience());\r
+        assertEquals(expectedChildElementsDOM, pr);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/Subject20Test.h b/samltest/saml2/core/impl/Subject20Test.h
new file mode 100644 (file)
index 0000000..36f4ef0
--- /dev/null
@@ -0,0 +1,71 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class Subject20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+\r
+public:\r
+    void setUp() {\r
+        singleElementFile = data_path + "saml2/core/impl/Subject.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/SubjectChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        Subject* subject = dynamic_cast<Subject*>(xo.get());\r
+        TS_ASSERT(subject!=NULL);\r
+\r
+        TS_ASSERT(subject->getBaseID()==NULL);\r
+        TS_ASSERT(subject->getNameID()==NULL);\r
+        TS_ASSERT(subject->getEncryptedID()==NULL);\r
+        TSM_ASSERT_EQUALS("# of SubjectConfirmation child elements", 0, subject->getSubjectConfirmations().size());\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        Subject* subject= dynamic_cast<Subject*>(xo.get());\r
+        TS_ASSERT(subject!=NULL);\r
+\r
+        TS_ASSERT(subject->getBaseID()==NULL);\r
+        TS_ASSERT(subject->getNameID()!=NULL);\r
+        TS_ASSERT(subject->getEncryptedID()==NULL);\r
+        TSM_ASSERT_EQUALS("# of SubjectConfirmation child elements", 2, subject->getSubjectConfirmations().size());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        Subject* subject=SubjectBuilder::buildSubject();\r
+        assertEquals(expectedDOM, subject);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        Subject* subject=SubjectBuilder::buildSubject();\r
+        subject->setNameID(NameIDBuilder::buildNameID());\r
+        subject->getSubjectConfirmations().push_back(SubjectConfirmationBuilder::buildSubjectConfirmation());\r
+        subject->getSubjectConfirmations().push_back(SubjectConfirmationBuilder::buildSubjectConfirmation());\r
+        assertEquals(expectedChildElementsDOM, subject);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/SubjectConfirmation20Test.h b/samltest/saml2/core/impl/SubjectConfirmation20Test.h
new file mode 100644 (file)
index 0000000..cc12ece
--- /dev/null
@@ -0,0 +1,77 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class SubjectConfirmation20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedMethod; \r
+\r
+public:\r
+    void setUp() {\r
+        expectedMethod = XMLString::transcode("urn:string:cm"); \r
+\r
+        singleElementFile = data_path + "saml2/core/impl/SubjectConfirmation.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/SubjectConfirmationChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedMethod);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        SubjectConfirmation* sc = dynamic_cast<SubjectConfirmation*>(xo.get());\r
+        TS_ASSERT(sc!=NULL);\r
+\r
+        assertEquals("Method attribute", expectedMethod, sc->getMethod());\r
+\r
+        TS_ASSERT(sc->getBaseID()==NULL);\r
+        TS_ASSERT(sc->getNameID()==NULL);\r
+        TS_ASSERT(sc->getEncryptedID()==NULL);\r
+        TS_ASSERT(sc->getSubjectConfirmationData()==NULL);\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        SubjectConfirmation* sc= dynamic_cast<SubjectConfirmation*>(xo.get());\r
+        TS_ASSERT(sc!=NULL);\r
+\r
+        TS_ASSERT(sc->getBaseID()==NULL);\r
+        TS_ASSERT(sc->getNameID()!=NULL);\r
+        TS_ASSERT(sc->getEncryptedID()==NULL);\r
+        TS_ASSERT(sc->getSubjectConfirmationData()!=NULL);\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        SubjectConfirmation* sc=SubjectConfirmationBuilder::buildSubjectConfirmation();\r
+        sc->setMethod(expectedMethod);\r
+        assertEquals(expectedDOM, sc);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        SubjectConfirmation* sc=SubjectConfirmationBuilder::buildSubjectConfirmation();\r
+        sc->setNameID(NameIDBuilder::buildNameID());\r
+        sc->setSubjectConfirmationData(SubjectConfirmationDataBuilder::buildSubjectConfirmationData());\r
+        assertEquals(expectedChildElementsDOM, sc);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/SubjectConfirmationData20Test.h b/samltest/saml2/core/impl/SubjectConfirmationData20Test.h
new file mode 100644 (file)
index 0000000..fcf2e0c
--- /dev/null
@@ -0,0 +1,119 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+//TODO need testing for ElementProxy and wildcard attributes/elements\r
+\r
+class SubjectConfirmationData20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    DateTime* expectedNotBefore;\r
+    DateTime* expectedNotOnOrAfter;\r
+    XMLCh* expectedRecipient;\r
+    XMLCh* expectedInResponseTo;\r
+    XMLCh* expectedAddress;\r
+\r
+public:\r
+    void setUp() {\r
+        expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
+        expectedNotBefore->parseDateTime();\r
+        expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
+        expectedNotOnOrAfter->parseDateTime();\r
+        expectedRecipient = (XMLString::transcode("recipient"));\r
+        expectedInResponseTo = (XMLString::transcode("inresponse"));\r
+        expectedAddress = (XMLString::transcode("address"));\r
+\r
+        singleElementFile = data_path + "saml2/core/impl/SubjectConfirmationData.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectConfirmationDataOptionalAttributes.xml";\r
+        childElementsFile  = data_path + "saml2/core/impl/SubjectConfirmationDataChildElements.xml";    \r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        delete expectedNotBefore;\r
+        delete expectedNotOnOrAfter;\r
+        XMLString::release(&expectedRecipient);\r
+        XMLString::release(&expectedInResponseTo);\r
+        XMLString::release(&expectedAddress);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        SubjectConfirmationData* scd = dynamic_cast<SubjectConfirmationData*>(xo.get());\r
+        TS_ASSERT(scd!=NULL);\r
+\r
+        TS_ASSERT(scd->getNotBefore()==NULL);\r
+        TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
+        TS_ASSERT(scd->getRecipient()==NULL);\r
+        TS_ASSERT(scd->getInResponseTo()==NULL);\r
+        TS_ASSERT(scd->getAddress()==NULL);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        SubjectConfirmationData* scd = dynamic_cast<SubjectConfirmationData*>(xo.get());\r
+        TS_ASSERT(scd!=NULL);\r
+\r
+        TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), scd->getNotBefore()->getEpoch());\r
+        TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), scd->getNotOnOrAfter()->getEpoch());\r
+        assertEquals("Recipient attribute", expectedRecipient, scd->getRecipient());\r
+        assertEquals("InResponseTo attribute", expectedInResponseTo, scd->getInResponseTo());\r
+        assertEquals("Address attribute", expectedAddress, scd->getAddress());\r
+\r
+        //TODO need to test with some wildcard attributes\r
+    }\r
+\r
+    void testChildElementsUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
+        SubjectConfirmationData* scd= dynamic_cast<SubjectConfirmationData*>(xo.get());\r
+        TS_ASSERT(scd!=NULL);\r
+\r
+        TS_ASSERT(scd->getNotBefore()==NULL);\r
+        TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
+        TS_ASSERT(scd->getRecipient()==NULL);\r
+        TS_ASSERT(scd->getInResponseTo()==NULL);\r
+        TS_ASSERT(scd->getAddress()==NULL);\r
+\r
+        //TODO need to test with some wildcard child elements\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();\r
+        assertEquals(expectedDOM, scd);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();\r
+        scd->setNotBefore(expectedNotBefore);\r
+        scd->setNotOnOrAfter(expectedNotOnOrAfter);\r
+        scd->setRecipient(expectedRecipient);\r
+        scd->setInResponseTo(expectedInResponseTo);\r
+        scd->setAddress(expectedAddress);\r
+        //TODO need to test with some wilcard attributes\r
+        assertEquals(expectedOptionalAttributesDOM, scd);\r
+    }\r
+\r
+    void testChildElementsMarshall() {\r
+        SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();\r
+        //TODO need to test with some wilcard child elements\r
+        assertEquals(expectedChildElementsDOM, scd);\r
+    }\r
+\r
+};\r
diff --git a/samltest/saml2/core/impl/SubjectLocality20Test.h b/samltest/saml2/core/impl/SubjectLocality20Test.h
new file mode 100644 (file)
index 0000000..953c918
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ *  Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml2/core/Assertions.h>\r
+#include <saml/util/SAMLConstants.h>\r
+\r
+using namespace opensaml::saml2;\r
+\r
+class SubjectLocality20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
+    XMLCh* expectedAddress; \r
+    XMLCh* expectedDNSName; \r
+\r
+public:\r
+    void setUp() {\r
+        expectedAddress = XMLString::transcode("10.1.2.3");; \r
+        expectedDNSName = XMLString::transcode("client.example.org"); \r
+\r
+        singleElementFile = data_path + "saml2/core/impl/SubjectLocality.xml";\r
+        singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectLocalityOptionalAttributes.xml";\r
+        SAMLObjectBaseTestCase::setUp();\r
+    }\r
+    \r
+    void tearDown() {\r
+        XMLString::release(&expectedAddress);\r
+        XMLString::release(&expectedDNSName);\r
+        SAMLObjectBaseTestCase::tearDown();\r
+    }\r
+\r
+    void testSingleElementUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
+        SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());\r
+        TS_ASSERT(sl!=NULL);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesUnmarshall() {\r
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
+        SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());\r
+        TS_ASSERT(sl!=NULL);\r
+        assertEquals("Address attribute", expectedAddress, sl->getAddress());\r
+        assertEquals("DNSName attribute", expectedDNSName, sl->getDNSName());\r
+    }\r
+\r
+    void testSingleElementMarshall() {\r
+        SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();\r
+        assertEquals(expectedDOM, sl);\r
+    }\r
+\r
+    void testSingleElementOptionalAttributesMarshall() {\r
+        SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();\r
+        sl->setAddress(expectedAddress);\r
+        sl->setDNSName(expectedDNSName);\r
+        assertEquals(expectedOptionalAttributesDOM, sl);\r
+    }\r
+\r
+};\r