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 AudienceRestrictionConditionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
\r
25 singleElementFile = data_path + "saml1/core/impl/singleAudienceRestrictionCondition.xml";
\r
26 childElementsFile = data_path + "saml1/core/impl/AudienceRestrictionConditionWithChildren.xml";
\r
27 SAMLObjectBaseTestCase::setUp();
\r
31 SAMLObjectBaseTestCase::tearDown();
\r
34 void testSingleElementUnmarshall() {
\r
35 auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
\r
36 AudienceRestrictionCondition& a = dynamic_cast<AudienceRestrictionCondition&>(*xo.get());
\r
37 TSM_ASSERT_EQUALS("Count of child Audience elements !=0", 0, a.getAudiences().size());
\r
40 void testChildElementsUnmarshall() {
\r
41 auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
\r
42 AudienceRestrictionCondition& a = dynamic_cast<AudienceRestrictionCondition&>(*xo.get());
\r
43 TSM_ASSERT_EQUALS("Count of child Audience elements", 2, a.getAudiences().size());
\r
46 void testSingleElementMarshall() {
\r
47 assertEquals(expectedDOM, AudienceRestrictionConditionBuilder::buildAudienceRestrictionCondition());
\r
50 void testChildElementsMarshall(){
\r
51 AudienceRestrictionCondition* a=AudienceRestrictionConditionBuilder::buildAudienceRestrictionCondition();
\r
52 a->getAudiences().push_back(AudienceBuilder::buildAudience());
\r
53 a->getAudiences().push_back(AudienceBuilder::buildAudience());
\r
54 assertEquals(expectedChildElementsDOM, a);
\r