KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > om > OMHeaderTest


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
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 package org.apache.axis2.om;
17
18 import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
19 import org.apache.axis2.soap.SOAPHeader;
20 import org.apache.axis2.soap.SOAPHeaderBlock;
21
22 import java.util.Iterator JavaDoc;
23
24 public class OMHeaderTest extends OMTestCase {
25     SOAPHeader soapHeader;
26
27     public OMHeaderTest(String JavaDoc testName) {
28         super(testName);
29     }
30
31     public static void main(String JavaDoc[] args) {
32     }
33
34     /*
35      * @see TestCase#setUp()
36      */

37     protected void setUp() throws Exception JavaDoc {
38         super.setUp();
39         soapHeader = soapEnvelope.getHeader();
40     }
41
42     public void testAddHeaderElement() {
43         String JavaDoc newElementName = "MyHeaderElement";
44         SOAPHeaderBlock soapHeaderElement = soapHeader.addHeaderBlock(newElementName, new OMNamespaceImpl("http://opensource.lk", "lsf"));
45         assertTrue("Header Element added has different parent than it should have", soapHeaderElement.getParent() == soapHeader);
46         assertTrue("Header Element added has different localname than it was given", soapHeaderElement.getLocalName().equalsIgnoreCase(newElementName));
47     }
48
49     public void testExamineHeaderElements() {
50     }
51
52     public void testExtractHeaderElements() {
53         //TODO Implement extractHeaderBlocks().
54
}
55
56     public void testExamineMustUnderstandHeaderElements() {
57         //TODO Implement examineMustUnderstandHeaderBlocks().
58
}
59
60     public void testExamineAllHeaderElements() {
61         Iterator JavaDoc iterator = soapHeader.examineAllHeaderBlocks();
62         int headerElementCount = 0;
63         while (iterator.hasNext()) {
64             iterator.next();
65             headerElementCount++;
66         }
67         assertTrue("Number of header elements in the header differs from expected value of 3", headerElementCount == 3);
68     }
69
70     public void testExtractAllHeaderElements() {
71         //TODO Implement extractAllHeaderBlocks().
72
}
73
74 }
75
Popular Tags