2 * Copyright 2001-2006 Internet2
\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
8 * http://www.apache.org/licenses/LICENSE-2.0
\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
17 #include "internal.h"
\r
18 #include <saml/saml2/core/Protocols.h>
\r
19 #include <saml/util/SAMLConstants.h>
\r
21 using namespace opensaml::saml2p;
\r
22 using namespace opensaml::saml2;
\r
24 class IDPEntry20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
\r
25 XMLCh* expectedProviderID;
\r
26 XMLCh* expectedName;
\r
31 expectedProviderID = XMLString::transcode("urn:string:providerid");;
\r
32 expectedName = XMLString::transcode("Example IdP");
\r
33 expectedLoc = XMLString::transcode("http://idp.example.org/endpoint");
\r
35 singleElementFile = data_path + "saml2/core/impl/IDPEntry.xml";
\r
36 singleElementOptionalAttributesFile = data_path + "saml2/core/impl/IDPEntryOptionalAttributes.xml";
\r
37 SAMLObjectBaseTestCase::setUp();
\r
41 XMLString::release(&expectedProviderID);
\r
42 XMLString::release(&expectedName);
\r
43 XMLString::release(&expectedLoc);
\r
44 SAMLObjectBaseTestCase::tearDown();
\r
47 void testSingleElementUnmarshall() {
\r
48 auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
\r
49 IDPEntry* entry = dynamic_cast<IDPEntry*>(xo.get());
\r
50 TS_ASSERT(entry!=NULL);
\r
51 assertEquals("ProviderID attribute", expectedProviderID, entry->getProviderID());
\r
54 void testSingleElementOptionalAttributesUnmarshall() {
\r
55 auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
\r
56 IDPEntry* entry = dynamic_cast<IDPEntry*>(xo.get());
\r
57 TS_ASSERT(entry!=NULL);
\r
58 assertEquals("ProviderID attribute", expectedProviderID, entry->getProviderID());
\r
59 assertEquals("Name attribute", expectedName, entry->getName());
\r
60 assertEquals("Loc attribute", expectedLoc, entry->getLoc());
\r
63 void testSingleElementMarshall() {
\r
64 IDPEntry* entry=IDPEntryBuilder::buildIDPEntry();
\r
65 entry->setProviderID(expectedProviderID);
\r
66 assertEquals(expectedDOM, entry);
\r
69 void testSingleElementOptionalAttributesMarshall() {
\r
70 IDPEntry* entry=IDPEntryBuilder::buildIDPEntry();
\r
71 entry->setProviderID(expectedProviderID);
\r
72 entry->setName(expectedName);
\r
73 entry->setLoc(expectedLoc);
\r
74 assertEquals(expectedOptionalAttributesDOM, entry);
\r