Convert from NULL macro to nullptr, remove unused zlib code.
[shibboleth/cpp-opensaml.git] / samltest / saml1 / core / impl / AudienceTest.h
1 /*
2  *  Copyright 2001-2010 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "internal.h"
18 #include <saml/saml1/core/Assertions.h>
19
20 using namespace opensaml::saml1;
21
22 class AudienceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
23     XMLCh* expectedUri;
24
25 public:
26     void setUp() {
27         expectedUri=XMLString::transcode("urn:oasis:names:tc:SAML:1.0:assertion");
28         singleElementFile = data_path + "saml1/core/impl/singleAudience.xml";
29         singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAudienceAttributes.xml";
30         SAMLObjectBaseTestCase::setUp();
31     }
32     
33     void tearDown() {
34         XMLString::release(&expectedUri);
35         SAMLObjectBaseTestCase::tearDown();
36     }
37
38     void testSingleElementUnmarshall() {
39         auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
40         Audience& a = dynamic_cast<Audience&>(*xo.get());
41         TSM_ASSERT("Uri is non-null", a.getAudienceURI()==nullptr);
42     }
43
44     void testSingleElementOptionalAttributesUnmarshall() {
45         auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
46         Audience& a = dynamic_cast<Audience&>(*xo.get());
47         assertEquals("Uri", expectedUri, a.getAudienceURI());
48     }
49
50     void testSingleElementMarshall() {
51         assertEquals(expectedDOM, AudienceBuilder::buildAudience());
52     }
53
54     void testSingleElementOptionalAttributesMarshall() {
55         Audience* a=AudienceBuilder::buildAudience();
56         a->setAudienceURI(expectedUri);
57         assertEquals(expectedOptionalAttributesDOM, a);
58     }
59
60 };