X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fsaml1%2Fcore%2Fimpl%2FAssertionIDReferenceTest.h;h=d47917a99c06c5f59bd21c1f2f8625900c89b82d;hb=04482c5c0e5fac5b688b0d23713526a15c51bd31;hp=a2b98460cb788efd13cd83155fcc7efb9e41b943;hpb=7ad96e97599881b4fbaf67da4a85155398dd4787;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/saml1/core/impl/AssertionIDReferenceTest.h b/samltest/saml1/core/impl/AssertionIDReferenceTest.h index a2b9846..d47917a 100644 --- a/samltest/saml1/core/impl/AssertionIDReferenceTest.h +++ b/samltest/saml1/core/impl/AssertionIDReferenceTest.h @@ -1,61 +1,65 @@ -/* - * Copyright 2001-2006 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 - -using namespace opensaml::saml1; - -class AssertionIDReferenceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase { - XMLCh* expectedNCName; - -public: - void setUp() { - singleElementFile = data_path + "saml1/core/impl/singleAssertionIDReference.xml"; - singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAssertionIDReferenceContents.xml"; - expectedNCName = XMLString::transcode("NibbleAHappyWarthog"); - SAMLObjectBaseTestCase::setUp(); - } - - void tearDown() { - XMLString::release(&expectedNCName); - SAMLObjectBaseTestCase::tearDown(); - } - - void testSingleElementUnmarshall() { - auto_ptr xo(unmarshallElement(singleElementFile)); - AssertionIDReference* assertionIDReference = dynamic_cast(xo.get()); - TS_ASSERT(assertionIDReference!=NULL); - TSM_ASSERT("NCName present", assertionIDReference->getAssertionID()==NULL); - } - - void testSingleElementOptionalAttributesUnmarshall() { - auto_ptr xo(unmarshallElement(singleElementOptionalAttributesFile)); - AssertionIDReference* assertionIDReference = dynamic_cast(xo.get()); - TSM_ASSERT_SAME_DATA("NCName ", expectedNCName, assertionIDReference->getAssertionID(), XMLString::stringLen(expectedNCName)); - } - - void testSingleElementMarshall() { - assertEquals(expectedDOM, AssertionIDReferenceBuilder::buildAssertionIDReference()); - } - - void testSingleElementOptionalAttributesMarshall() { - AssertionIDReference* assertionIDReference=AssertionIDReferenceBuilder::buildAssertionIDReference(); - assertionIDReference->setAssertionID(expectedNCName); - assertEquals(expectedOptionalAttributesDOM, assertionIDReference); - } - -}; +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + * + * UCAID licenses this file to you 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 + +using namespace opensaml::saml1; + +class AssertionIDReferenceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase { + XMLCh* expectedNCName; + +public: + void setUp() { + singleElementFile = data_path + "saml1/core/impl/singleAssertionIDReference.xml"; + singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAssertionIDReferenceContents.xml"; + expectedNCName = XMLString::transcode("NibbleAHappyWarthog"); + SAMLObjectBaseTestCase::setUp(); + } + + void tearDown() { + XMLString::release(&expectedNCName); + SAMLObjectBaseTestCase::tearDown(); + } + + void testSingleElementUnmarshall() { + auto_ptr xo(unmarshallElement(singleElementFile)); + AssertionIDReference* assertionIDReference = dynamic_cast(xo.get()); + TS_ASSERT(assertionIDReference!=nullptr); + TSM_ASSERT("NCName present", assertionIDReference->getAssertionID()==nullptr); + } + + void testSingleElementOptionalAttributesUnmarshall() { + auto_ptr xo(unmarshallElement(singleElementOptionalAttributesFile)); + AssertionIDReference* assertionIDReference = dynamic_cast(xo.get()); + assertEquals("NCName ", expectedNCName, assertionIDReference->getAssertionID()); + } + + void testSingleElementMarshall() { + assertEquals(expectedDOM, AssertionIDReferenceBuilder::buildAssertionIDReference()); + } + + void testSingleElementOptionalAttributesMarshall() { + AssertionIDReference* assertionIDReference=AssertionIDReferenceBuilder::buildAssertionIDReference(); + assertionIDReference->setAssertionID(expectedNCName); + assertEquals(expectedOptionalAttributesDOM, assertionIDReference); + } + +};