1   /*
2    *  soapUI, copyright (C) 2004-2008 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  
14  package com.eviware.soapui.impl.wsdl;
15  
16  import junit.framework.TestCase;
17  
18  import com.eviware.soapui.config.WsdlInterfaceConfig;
19  
20  public class WsdlInterfaceTestCase extends TestCase
21  {
22  	private WsdlProject project;
23  	private WsdlInterfaceConfig interfaceConfig;
24  	private WsdlInterface iface;
25  
26  	public void setUp() throws Exception
27  	{
28  		project = new WsdlProject();
29  		interfaceConfig = WsdlInterfaceConfig.Factory.newInstance();
30  		iface = new WsdlInterface( project, interfaceConfig );
31  
32  		assertEquals( 0, iface.getEndpoints().length );
33  	}
34  	
35  	public void testAddEndpoints() throws Exception
36  	{
37  		iface.addEndpoint( "testEndpoint" );
38  		assertEquals( 1, iface.getEndpoints().length );
39  		assertEquals( "testEndpoint", iface.getEndpoints()[0] );
40  
41  		iface.addEndpoint( "testEndpoint" );
42  		assertEquals( 1, iface.getEndpoints().length );
43  		assertEquals( "testEndpoint", iface.getEndpoints()[0] );
44  		
45  		iface.addEndpoint( "testEndpoint2" );
46  		assertEquals( 2, iface.getEndpoints().length );
47  		assertEquals( "testEndpoint", iface.getEndpoints()[0] );
48  		assertEquals( "testEndpoint2", iface.getEndpoints()[1] );
49  	}
50  
51  	public void testRemoveEndpoints() throws Exception
52  	{
53  		iface.addEndpoint( "testEndpoint" );
54  		iface.addEndpoint( "testEndpoint2" );
55  		
56  		iface.removeEndpoint( "testEndpoint" );
57  		assertEquals( 1, iface.getEndpoints().length );
58  		
59  		iface.removeEndpoint( "testEndpoint2" );
60  		assertEquals( 0, iface.getEndpoints().length );
61  	}
62  }