-/*\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
+/*
+ * Copyright 2001-2007 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>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class AuthzDecisionStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedResource;
+ const XMLCh* expectedDecision;
+
+public:
+ void setUp() {
+ expectedResource = XMLString::transcode("urn:string:resource");
+ expectedDecision = AuthzDecisionStatement::DECISION_PERMIT;
+
+ singleElementFile = data_path + "saml2/core/impl/AuthzDecisionStatement.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthzDecisionStatementChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedResource);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthzDecisionStatement* statement = dynamic_cast<AuthzDecisionStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ assertEquals("Resource attribute", expectedResource, statement->getResource());
+ assertEquals("Decision attribute", expectedDecision, statement->getDecision());
+
+ TSM_ASSERT_EQUALS("# of Action child elements", 0, statement->getActions().size());
+ TS_ASSERT(statement->getEvidence()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthzDecisionStatement* statement= dynamic_cast<AuthzDecisionStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ assertEquals("Resource attribute", NULL, statement->getResource());
+ assertEquals("Decision attribute", NULL, statement->getDecision());
+
+ TSM_ASSERT_EQUALS("# of Action child elements", 3, statement->getActions().size());
+ TS_ASSERT(statement->getEvidence()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();
+ statement->setResource(expectedResource);
+ statement->setDecision(expectedDecision);
+ assertEquals(expectedDOM, statement);
+ }
+
+ void testChildElementsMarshall() {
+ AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();
+ statement->getActions().push_back(ActionBuilder::buildAction());
+ statement->getActions().push_back(ActionBuilder::buildAction());
+ statement->getActions().push_back(ActionBuilder::buildAction());
+ statement->setEvidence(EvidenceBuilder::buildEvidence());
+ assertEquals(expectedChildElementsDOM, statement);
+ }
+
+};