-/*\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 AdviceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* AssertionID;\r
- XMLCh* IssueInstant;\r
-\r
-public:\r
- void setUp() {\r
- AssertionID=XMLString::transcode("_123456789");\r
- IssueInstant=XMLString::transcode("1971-03-19T13:23:00Z");\r
- singleElementFile = data_path + "saml1/core/impl/singleAdvice.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AdviceWithChildren.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&AssertionID);\r
- XMLString::release(&IssueInstant);\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
- TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 0, advice->getAssertionIDReferences().size());\r
- TSM_ASSERT_EQUALS("Number of child Assertion elements", 0, advice->getAssertions().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Advice* advice = dynamic_cast<Advice*>(xo.get());\r
- TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 2, advice->getAssertionIDReferences().size());\r
- TSM_ASSERT_EQUALS("Number of child Assertion elements", 1, advice->getAssertions().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AdviceBuilder::buildAdvice());\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Advice* advice=AdviceBuilder::buildAdvice();\r
- \r
- advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setAssertionID(AssertionID);\r
- assertion->setIssueInstant(IssueInstant);\r
- advice->getAssertions().push_back(assertion);\r
- advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());\r
-\r
- assertEquals(expectedChildElementsDOM, advice);\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 AdviceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* AssertionID;
+ XMLCh* IssueInstant;
+
+public:
+ void setUp() {
+ AssertionID=XMLString::transcode("_123456789");
+ IssueInstant=XMLString::transcode("1971-03-19T13:23:00Z");
+ singleElementFile = data_path + "saml1/core/impl/singleAdvice.xml";
+ childElementsFile = data_path + "saml1/core/impl/AdviceWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&AssertionID);
+ XMLString::release(&IssueInstant);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Advice* advice = dynamic_cast<Advice*>(xo.get());
+ TS_ASSERT(advice!=NULL);
+ TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 0, advice->getAssertionIDReferences().size());
+ TSM_ASSERT_EQUALS("Number of child Assertion elements", 0, advice->getAssertions().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Advice* advice = dynamic_cast<Advice*>(xo.get());
+ TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 2, advice->getAssertionIDReferences().size());
+ TSM_ASSERT_EQUALS("Number of child Assertion elements", 1, advice->getAssertions().size());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AdviceBuilder::buildAdvice());
+ }
+
+ void testChildElementsMarshall() {
+ Advice* advice=AdviceBuilder::buildAdvice();
+
+ advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setAssertionID(AssertionID);
+ assertion->setIssueInstant(IssueInstant);
+ advice->getAssertions().push_back(assertion);
+ advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());
+
+ assertEquals(expectedChildElementsDOM, advice);
+ }
+
+};