1   /*
2    *  soapui, copyright (C) 2005 Ole Matzura / eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
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  package com.eviware.soapui.impl.wsdl;
14  
15  import junit.framework.TestCase;
16  
17  import com.eviware.soapui.config.InterfaceConfig;
18  import com.eviware.soapui.impl.wsdl.WsdlInterface;
19  import com.eviware.soapui.impl.wsdl.WsdlProject;
20  
21  public class WsdlInterfaceTestCase extends TestCase
22  {
23  	private WsdlProject project;
24  	private InterfaceConfig interfaceConfig;
25  	private WsdlInterface iface;
26  
27  	public void setUp() throws Exception
28  	{
29  		project = new WsdlProject();
30  		interfaceConfig = InterfaceConfig.Factory.newInstance();
31  		iface = new WsdlInterface( project, interfaceConfig );
32  
33  		assertEquals( 0, iface.getEndpoints().length );
34  	}
35  	
36  	public void testAddEndpoints() throws Exception
37  	{
38  		iface.addEndpoint( "testEndpoint" );
39  		assertEquals( 1, iface.getEndpoints().length );
40  		assertEquals( "testEndpoint", iface.getEndpoints()[0] );
41  
42  		iface.addEndpoint( "testEndpoint" );
43  		assertEquals( 1, iface.getEndpoints().length );
44  		assertEquals( "testEndpoint", iface.getEndpoints()[0] );
45  		
46  		iface.addEndpoint( "testEndpoint2" );
47  		assertEquals( 2, iface.getEndpoints().length );
48  		assertEquals( "testEndpoint", iface.getEndpoints()[0] );
49  		assertEquals( "testEndpoint2", iface.getEndpoints()[1] );
50  	}
51  
52  	public void testRemoveEndpoints() throws Exception
53  	{
54  		iface.addEndpoint( "testEndpoint" );
55  		iface.addEndpoint( "testEndpoint2" );
56  		
57  		iface.removeEndpoint( "testEndpoint" );
58  		assertEquals( 1, iface.getEndpoints().length );
59  		
60  		iface.removeEndpoint( "testEndpoint2" );
61  		assertEquals( 0, iface.getEndpoints().length );
62  	}
63  }