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/Protocols.h>
\r
20 using namespace opensaml::saml2p;
\r
22 class StatusCode20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
\r
27 Value=XMLString::transcode("urn:string");
\r
28 singleElementFile = data_path + "saml2/core/impl/StatusCode.xml";
\r
29 childElementsFile = data_path + "saml2/core/impl/StatusCodeChildElements.xml";
\r
30 SAMLObjectBaseTestCase::setUp();
\r
34 XMLString::release(&Value);
\r
35 SAMLObjectBaseTestCase::tearDown();
\r
38 void testSingleElementUnmarshall() {
\r
39 auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
\r
40 StatusCode* sc = dynamic_cast<StatusCode*>(xo.get());
\r
41 TS_ASSERT(sc!=NULL);
\r
42 assertEquals("Value attribute", Value, sc->getValue());
\r
43 TSM_ASSERT("StatusCode child element", sc->getStatusCode()==NULL);
\r
46 void testChildElementsUnmarshall() {
\r
47 auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
\r
48 StatusCode* sc = dynamic_cast<StatusCode*>(xo.get());
\r
49 TS_ASSERT(sc!=NULL);
\r
50 TSM_ASSERT("StatusCode child element", sc->getStatusCode()!=NULL);
\r
53 void testSingleElementMarshall() {
\r
54 StatusCode* sc=StatusCodeBuilder::buildStatusCode();
\r
55 sc->setValue(Value);
\r
56 assertEquals(expectedDOM, sc);
\r
59 void testChildElementsMarshall() {
\r
60 StatusCode* sc=StatusCodeBuilder::buildStatusCode();
\r
61 StatusCode* scChild=StatusCodeBuilder::buildStatusCode();
\r
62 sc->setStatusCode(scChild);
\r
63 assertEquals(expectedChildElementsDOM, sc);
\r