KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > handlers > util > TestUtil


1 package org.apache.axis2.handlers.util;
2
3 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
4
5 import javax.xml.stream.XMLInputFactory;
6 import javax.xml.stream.XMLStreamReader;
7 import java.io.File JavaDoc;
8 import java.io.FileReader JavaDoc;
9
10 /**
11  * Copyright 2001-2004 The Apache Software Foundation.
12  * <p/>
13  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
14  * use this file except in compliance with the License. You may obtain a copy of
15  * the License at
16  * <p/>
17  * http://www.apache.org/licenses/LICENSE-2.0
18  * <p/>
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
22  * License for the specific language governing permissions and limitations under
23  * the License.
24  * <p/>
25  */

26 public class TestUtil{
27
28     /**
29      * Eran Chinthaka (chinthaka@apache.org)
30      */

31
32     protected static final String JavaDoc IN_FILE_NAME = "soapmessage.xml";
33     protected StAXSOAPModelBuilder builder;
34     protected String JavaDoc testResourceDir = "test-resources";
35
36
37     public StAXSOAPModelBuilder getOMBuilder(String JavaDoc fileName) throws Exception JavaDoc {
38         if (fileName == "" || fileName == null) {
39             fileName = IN_FILE_NAME;
40         }
41         XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader JavaDoc(getTestResourceFile(fileName)));
42         builder = new StAXSOAPModelBuilder(parser);
43         return builder;
44     }
45
46      protected File JavaDoc getTestResourceFile(String JavaDoc relativePath) {
47         return new File JavaDoc(testResourceDir, relativePath);
48     }
49 }
50
Popular Tags