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/saml1/core/Assertions.h>
\r
20 using namespace opensaml::saml1;
\r
22 class AttributeDesignatorTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
\r
23 XMLCh* expectedAttributeName;
\r
24 XMLCh* expectedAttributeNamespace;
\r
28 expectedAttributeName=XMLString::transcode("AttributeName");
\r
29 expectedAttributeNamespace=XMLString::transcode("namespace");
\r
30 singleElementFile = data_path + "saml1/core/impl/singleAttributeDesignator.xml";
\r
31 singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAttributeDesignatorAttributes.xml";
\r
32 SAMLObjectBaseTestCase::setUp();
\r
36 XMLString::release(&expectedAttributeName);
\r
37 XMLString::release(&expectedAttributeNamespace);
\r
38 SAMLObjectBaseTestCase::tearDown();
\r
41 void testSingleElementUnmarshall() {
\r
42 auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
\r
43 AttributeDesignator& ad = dynamic_cast<AttributeDesignator&>(*xo.get());
\r
44 TSM_ASSERT("AttributeName", ad.getAttributeName()==NULL);
\r
45 TSM_ASSERT("AttributeNamespace", ad.getAttributeNamespace()==NULL);
\r
48 void testSingleElementOptionalAttributesUnmarshall() {
\r
49 auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
\r
50 AttributeDesignator& ad = dynamic_cast<AttributeDesignator&>(*xo.get());
\r
51 assertEquals("AttributeName", expectedAttributeName, ad.getAttributeName());
\r
52 assertEquals("AttributeNamespace", expectedAttributeNamespace, ad.getAttributeNamespace());
\r
55 void testSingleElementMarshall() {
\r
56 assertEquals(expectedDOM, AttributeDesignatorBuilder::buildAttributeDesignator());
\r
59 void testSingleElementOptionalAttributesMarshall() {
\r
60 AttributeDesignator* ad=AttributeDesignatorBuilder::buildAttributeDesignator();
\r
61 ad->setAttributeName(expectedAttributeName);
\r
62 ad->setAttributeNamespace(expectedAttributeNamespace);
\r
63 assertEquals(expectedOptionalAttributesDOM, ad);
\r