1   /*
2    * Copyright 2001-2004 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  
17  package org.apache.geronimo.ews.ws4j2ee.seviceRef;
18  
19  import java.io.FileInputStream;
20  
21  import junit.framework.Assert;
22  
23  import org.apache.geronimo.ews.AbstractTestCase;
24  import org.apache.geronimo.ews.ws4j2ee.context.webservices.client.interfaces.ServiceReferanceContext;
25  import org.apache.geronimo.ews.ws4j2ee.parsers.ServiceReferanceParser;
26  
27  /***
28   * @author hemapani
29   */
30  public class ServiceRefTest extends AbstractTestCase{
31  	/***
32  	 * @param testName
33  	 */
34  	public ServiceRefTest(String testName) {
35  		super(testName);
36  	}
37  
38  	public void testRefFile1() throws Exception{
39  		try {
40  			ServiceReferanceParser parser 
41  				= new ServiceReferanceParser(new FileInputStream(
42  					getTestFile(testDir+"org/apache/geronimo/ews/" +
43  						"ws4j2ee/seviceRef/service-ref1.xml")));
44  			ServiceReferanceContext ref = 	parser.getRef();
45  			Assert.assertEquals("service/Joe",ref.getServicerefName());
46  			Assert.assertEquals("javax.xml.rpc.Service",ref.getServiceInterface());
47  			Assert.assertEquals("WEB-INF/joe.xml",ref.getJaxrpcmappingFile());
48  			Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile());
49  		} catch (Exception e) {
50  			e.printStackTrace();
51  		   throw e;
52  		}
53  	}
54  	public void testRefFile2() throws Exception{
55  		try {
56  			ServiceReferanceParser parser 
57  				= new ServiceReferanceParser(new FileInputStream(
58  					getTestFile(testDir+"org/apache/geronimo/ews/ws4j2ee/" +
59  						"seviceRef/service-ref2.xml")));
60  			ServiceReferanceContext ref = 	parser.getRef();
61  			Assert.assertEquals("service/Joe",ref.getServicerefName());
62  			Assert.assertEquals("javax.xml.rpc.Service",ref.getServiceInterface());
63  
64  			Assert.assertEquals("WEB-INF/joe.xml",ref.getJaxrpcmappingFile());
65  			Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile());
66  		} catch (Exception e) {
67  			e.printStackTrace();
68  			throw e;
69  		}
70  	}
71  }