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/Assertions.h>
\r
19 #include <saml/util/SAMLConstants.h>
\r
21 using namespace opensaml::saml2;
\r
23 class SubjectLocality20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
\r
24 XMLCh* expectedAddress;
\r
25 XMLCh* expectedDNSName;
\r
29 expectedAddress = XMLString::transcode("10.1.2.3");;
\r
30 expectedDNSName = XMLString::transcode("client.example.org");
\r
32 singleElementFile = data_path + "saml2/core/impl/SubjectLocality.xml";
\r
33 singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectLocalityOptionalAttributes.xml";
\r
34 SAMLObjectBaseTestCase::setUp();
\r
38 XMLString::release(&expectedAddress);
\r
39 XMLString::release(&expectedDNSName);
\r
40 SAMLObjectBaseTestCase::tearDown();
\r
43 void testSingleElementUnmarshall() {
\r
44 auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
\r
45 SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());
\r
46 TS_ASSERT(sl!=NULL);
\r
49 void testSingleElementOptionalAttributesUnmarshall() {
\r
50 auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
\r
51 SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());
\r
52 TS_ASSERT(sl!=NULL);
\r
53 assertEquals("Address attribute", expectedAddress, sl->getAddress());
\r
54 assertEquals("DNSName attribute", expectedDNSName, sl->getDNSName());
\r
57 void testSingleElementMarshall() {
\r
58 SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();
\r
59 assertEquals(expectedDOM, sl);
\r
62 void testSingleElementOptionalAttributesMarshall() {
\r
63 SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();
\r
64 sl->setAddress(expectedAddress);
\r
65 sl->setDNSName(expectedDNSName);
\r
66 assertEquals(expectedOptionalAttributesDOM, sl);
\r