Fix linefeeds
[shibboleth/cpp-opensaml.git] / samltest / saml1 / core / impl / AuthenticationStatementTest.h
index 0bf3df1..e7689c7 100644 (file)
@@ -1,96 +1,96 @@
-/*\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/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AuthenticationStatementTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-    XMLCh* expectedAuthenticationMethod;\r
-    XMLCh* expectedAuthenticationInstant;\r
-\r
-public:\r
-    void setUp() {\r
-        expectedAuthenticationInstant=XMLString::transcode("1970-01-02T01:01:02.123Z");\r
-        expectedAuthenticationMethod=XMLString::transcode("trustme");\r
-        singleElementFile = data_path + "saml1/core/impl/singleAuthenticationStatement.xml";\r
-        singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAuthenticationStatementAttributes.xml";\r
-        childElementsFile  = data_path + "saml1/core/impl/AuthenticationStatementWithChildren.xml";    \r
-        SAMLObjectBaseTestCase::setUp();\r
-    }\r
-    \r
-    void tearDown() {\r
-        XMLString::release(&expectedAuthenticationInstant);\r
-        XMLString::release(&expectedAuthenticationMethod);\r
-        SAMLObjectBaseTestCase::tearDown();\r
-    }\r
-\r
-    void testSingleElementUnmarshall() {\r
-        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
-        AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());\r
-        TSM_ASSERT("AuthenticationMethod attribute present", as.getAuthenticationMethod()==NULL);\r
-        TSM_ASSERT("AuthenticationInstant attribute present", as.getAuthenticationInstant()==NULL);\r
-\r
-        TSM_ASSERT("Subject element", as.getSubject()==NULL);\r
-        TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()==NULL);\r
-        TSM_ASSERT_EQUALS("AuthorityBinding element count", 0, as.getAuthorityBindings().size());\r
-    }\r
-\r
-    void testSingleElementOptionalAttributesUnmarshall() {\r
-        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
-        AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());\r
-\r
-        assertEquals("AuthenticationMethod attribute", expectedAuthenticationMethod, as.getAuthenticationMethod());\r
-        assertEquals("AuthenticationInstant attribute", expectedAuthenticationInstant, as.getAuthenticationInstant()->getRawData());\r
-    }\r
-\r
-    void testChildElementsUnmarshall() {\r
-        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
-        AuthenticationStatement& as1 = dynamic_cast<AuthenticationStatement&>(*xo.get());\r
-        as1.releaseThisAndChildrenDOM();\r
-        auto_ptr<AuthenticationStatement> as2(as1.cloneAuthenticationStatement());\r
-        AuthenticationStatement& as=*as2.get();\r
-\r
-        TSM_ASSERT("Subject element", as.getSubject()!=NULL);\r
-        TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()!=NULL);\r
-\r
-        TSM_ASSERT_EQUALS("AuthorityBinding element count", 2, as.getAuthorityBindings().size());\r
-        as.getAuthorityBindings().erase(as.getAuthorityBindings().begin());\r
-        TSM_ASSERT_EQUALS("AuthorityBinding element count", 1, as.getAuthorityBindings().size());\r
-    }\r
-\r
-    void testSingleElementMarshall() {\r
-        assertEquals(expectedDOM, AuthenticationStatementBuilder::buildAuthenticationStatement());\r
-    }\r
-\r
-    void testSingleElementOptionalAttributesMarshall() {\r
-        AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();\r
-        as->setAuthenticationInstant(expectedAuthenticationInstant);\r
-        as->setAuthenticationMethod(expectedAuthenticationMethod);\r
-        assertEquals(expectedOptionalAttributesDOM, as);\r
-    }\r
-\r
-    void testChildElementsMarshall() {\r
-        AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();\r
-        as->setSubject(SubjectBuilder::buildSubject());\r
-        as->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());\r
-        as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());\r
-        as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());\r
-        assertEquals(expectedChildElementsDOM, as);\r
-    }\r
-\r
-};\r
+/*
+ *  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/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AuthenticationStatementTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+    XMLCh* expectedAuthenticationMethod;
+    XMLCh* expectedAuthenticationInstant;
+
+public:
+    void setUp() {
+        expectedAuthenticationInstant=XMLString::transcode("1970-01-02T01:01:02.123Z");
+        expectedAuthenticationMethod=XMLString::transcode("trustme");
+        singleElementFile = data_path + "saml1/core/impl/singleAuthenticationStatement.xml";
+        singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAuthenticationStatementAttributes.xml";
+        childElementsFile  = data_path + "saml1/core/impl/AuthenticationStatementWithChildren.xml";    
+        SAMLObjectBaseTestCase::setUp();
+    }
+    
+    void tearDown() {
+        XMLString::release(&expectedAuthenticationInstant);
+        XMLString::release(&expectedAuthenticationMethod);
+        SAMLObjectBaseTestCase::tearDown();
+    }
+
+    void testSingleElementUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+        AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());
+        TSM_ASSERT("AuthenticationMethod attribute present", as.getAuthenticationMethod()==NULL);
+        TSM_ASSERT("AuthenticationInstant attribute present", as.getAuthenticationInstant()==NULL);
+
+        TSM_ASSERT("Subject element", as.getSubject()==NULL);
+        TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()==NULL);
+        TSM_ASSERT_EQUALS("AuthorityBinding element count", 0, as.getAuthorityBindings().size());
+    }
+
+    void testSingleElementOptionalAttributesUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+        AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());
+
+        assertEquals("AuthenticationMethod attribute", expectedAuthenticationMethod, as.getAuthenticationMethod());
+        assertEquals("AuthenticationInstant attribute", expectedAuthenticationInstant, as.getAuthenticationInstant()->getRawData());
+    }
+
+    void testChildElementsUnmarshall() {
+        auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+        AuthenticationStatement& as1 = dynamic_cast<AuthenticationStatement&>(*xo.get());
+        as1.releaseThisAndChildrenDOM();
+        auto_ptr<AuthenticationStatement> as2(as1.cloneAuthenticationStatement());
+        AuthenticationStatement& as=*as2.get();
+
+        TSM_ASSERT("Subject element", as.getSubject()!=NULL);
+        TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()!=NULL);
+
+        TSM_ASSERT_EQUALS("AuthorityBinding element count", 2, as.getAuthorityBindings().size());
+        as.getAuthorityBindings().erase(as.getAuthorityBindings().begin());
+        TSM_ASSERT_EQUALS("AuthorityBinding element count", 1, as.getAuthorityBindings().size());
+    }
+
+    void testSingleElementMarshall() {
+        assertEquals(expectedDOM, AuthenticationStatementBuilder::buildAuthenticationStatement());
+    }
+
+    void testSingleElementOptionalAttributesMarshall() {
+        AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();
+        as->setAuthenticationInstant(expectedAuthenticationInstant);
+        as->setAuthenticationMethod(expectedAuthenticationMethod);
+        assertEquals(expectedOptionalAttributesDOM, as);
+    }
+
+    void testChildElementsMarshall() {
+        AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();
+        as->setSubject(SubjectBuilder::buildSubject());
+        as->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());
+        as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());
+        as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());
+        assertEquals(expectedChildElementsDOM, as);
+    }
+
+};