KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > engine > ServiceDescriptionBuilderTest


1 package org.apache.axis2.engine;
2
3 import junit.framework.TestCase;
4 import org.apache.axis2.description.AxisDescWSDLComponentFactory;
5 import org.apache.axis2.description.ServiceDescription;
6 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
7 import org.apache.wsdl.WSDLDescription;
8
9 import java.io.File JavaDoc;
10 import java.io.FileInputStream JavaDoc;
11 import java.io.InputStream JavaDoc;
12 import java.util.Iterator JavaDoc;
13 /*
14 * Copyright 2004,2005 The Apache Software Foundation.
15 *
16 * Licensed under the Apache License, Version 2.0 (the "License");
17 * you may not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS,
24 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 *
28 *
29 */

30
31 /**
32  * Author : Deepal Jayasinghe
33  * Date: Jun 20, 2005
34  * Time: 4:48:22 PM
35  */

36 public class ServiceDescriptionBuilderTest extends TestCase {
37     private ServiceDescription service = null;
38
39     private void initialize() throws Exception JavaDoc {
40
41         if (null == this.service) {
42            InputStream JavaDoc in = new FileInputStream JavaDoc(new File JavaDoc("./test-resources/service.wsdl")) ;
43             if(in == null){
44                 throw new Exception JavaDoc("Input Stream is null , fileNot Found") ;
45             }
46             WSDLDescription womDescription = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in, new AxisDescWSDLComponentFactory()).getDescription();
47             Iterator JavaDoc iterator = womDescription.getServices().keySet().iterator();
48             if(iterator.hasNext()){
49                 this.service = (ServiceDescription)iterator.next();
50             }
51             //todo fix me ajith , deepal
52
// assertNotNull(this.service);
53
}
54
55     }
56
57     public void test(){
58         try {
59             this.initialize();
60         } catch (Exception JavaDoc e) {
61             e.printStackTrace();
62         }
63     }
64 }
65
66
Popular Tags