Multi-line svn commit, see body.
[shibboleth/cpp-opensaml.git] / samltest / saml2 / core / impl / IDPList20Test.h
1 /*\r
2  *  Copyright 2001-2006 Internet2\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 #include "internal.h"\r
18 #include <saml/saml2/core/Protocols.h>\r
19 #include <saml/util/SAMLConstants.h>\r
20 \r
21 using namespace opensaml::saml2p;\r
22 using namespace opensaml::saml2;\r
23 \r
24 class IDPList20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
25 \r
26 public:\r
27     void setUp() {\r
28         singleElementFile = data_path + "saml2/core/impl/IDPList.xml";\r
29         childElementsFile  = data_path + "saml2/core/impl/IDPListChildElements.xml";    \r
30         SAMLObjectBaseTestCase::setUp();\r
31     }\r
32     \r
33     void tearDown() {\r
34         SAMLObjectBaseTestCase::tearDown();\r
35     }\r
36 \r
37     void testSingleElementUnmarshall() {\r
38         auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
39         IDPList* list = dynamic_cast<IDPList*>(xo.get());\r
40         TS_ASSERT(list!=NULL);\r
41 \r
42         TS_ASSERT(list->getGetComplete()==NULL);\r
43         TSM_ASSERT_EQUALS("# of IDPEntry child elements", 0, list->getIDPEntrys().size());\r
44     }\r
45 \r
46     void testChildElementsUnmarshall() {\r
47         auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
48         IDPList* list= dynamic_cast<IDPList*>(xo.get());\r
49         TS_ASSERT(list!=NULL);\r
50         TS_ASSERT(list->getGetComplete()!=NULL);\r
51         TSM_ASSERT_EQUALS("# of IDPEntry child elements", 3, list->getIDPEntrys().size());\r
52     }\r
53 \r
54     void testSingleElementMarshall() {\r
55         IDPList* list=IDPListBuilder::buildIDPList();\r
56         assertEquals(expectedDOM, list);\r
57     }\r
58 \r
59     void testChildElementsMarshall() {\r
60         IDPList* list=IDPListBuilder::buildIDPList();\r
61         list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());\r
62         list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());\r
63         list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());\r
64         list->setGetComplete(GetCompleteBuilder::buildGetComplete());\r
65         assertEquals(expectedChildElementsDOM, list);\r
66     }\r
67 \r
68 };\r