View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2009 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  package com.eviware.soapui.impl.wsdl.panels.teststeps;
14  
15  import javax.swing.JPanel;
16  
17  import com.eviware.soapui.impl.EmptyPanelBuilder;
18  import com.eviware.soapui.impl.wsdl.WsdlProject;
19  import com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestInterface;
20  import com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestStep;
21  import com.eviware.soapui.support.components.JPropertiesTable;
22  import com.eviware.soapui.support.types.StringList;
23  
24  /***
25   * PanelBuilder for HttpTestRequest
26   * 
27   * @author Ole.Matzura
28   */
29  
30  public class HttpTestRequestPanelBuilder extends EmptyPanelBuilder<HttpTestRequestStep>
31  {
32  	public HttpTestRequestPanelBuilder()
33  	{
34  	}
35  
36  	/*
37  	 * public HttpTestRequestDesktopPanel buildDesktopPanel( HttpTestRequestStep
38  	 * testStep ) { return new HttpTestRequestDesktopPanel( testStep ); }
39  	 */
40  	public HttpTestRequestDesktopPanel buildDesktopPanel( HttpTestRequestStep testStep )
41  	{
42  		return new HttpTestRequestDesktopPanel( testStep );
43  	}
44  
45  	public boolean hasDesktopPanel()
46  	{
47  		return true;
48  	}
49  
50  	public JPanel buildOverviewPanel( HttpTestRequestStep testStep )
51  	{
52  		HttpTestRequestInterface<?> request = testStep.getTestRequest();
53  		JPropertiesTable<HttpTestRequestInterface<?>> table = new JPropertiesTable<HttpTestRequestInterface<?>>(
54  				"REST TestRequest Properties" );
55  
56  		// basic properties
57  		table.addProperty( "Name", "name", true );
58  		table.addProperty( "Description", "description", true );
59  		// table.addProperty( "Message Size", "contentLength", false );
60  		table.addProperty( "Encoding", "encoding", new String[] { null, "UTF-8", "iso-8859-1" } );
61  
62  		/*
63  		 * if( request.getOperation() != null ) table.addProperty( "Endpoint",
64  		 * "endpoint", request.getInterface().getEndpoints() );
65  		 */
66  
67  		table.addProperty( "Endpoint", "endpoint", true );
68  
69  		table.addProperty( "Bind Address", "bindAddress", true );
70  		table.addProperty( "Follow Redirects", "followRedirects", JPropertiesTable.BOOLEAN_OPTIONS );
71  
72  		/*
73  		 * if( request.getOperation() != null ) { table.addProperty( "Service",
74  		 * "service" ); table.addProperty( "Resource", "path" ); }
75  		 */
76  
77  		// security / authentication
78  		table.addProperty( "Username", "username", true );
79  		table.addProperty( "Password", "password", true );
80  		table.addProperty( "Domain", "domain", true );
81  
82  		StringList keystores = new StringList( ( ( WsdlProject )request.getTestStep().getTestCase().getTestSuite()
83  				.getProject() ).getWssContainer().getCryptoNames() );
84  		keystores.add( "" );
85  		table.addProperty( "SSL Keystore", "sslKeystore", keystores.toStringArray() );
86  
87  		table.addProperty( "Strip whitespaces", "stripWhitespaces", JPropertiesTable.BOOLEAN_OPTIONS );
88  		table.addProperty( "Remove Empty Content", "removeEmptyContent", JPropertiesTable.BOOLEAN_OPTIONS );
89  		table.addProperty( "Entitize Properties", "entitizeProperties", JPropertiesTable.BOOLEAN_OPTIONS );
90  
91  		// post-processing
92  		table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
93  		table.addProperty( "Dump File", "dumpFile", true ).setDescription( "Dumps response message to specified file" );
94  		table.addProperty( "Max Size", "maxSize", true ).setDescription( "The maximum number of bytes to receive" );
95  		table.setPropertyObject( request );
96  
97  		return table;
98  	}
99  
100 	public boolean hasOverviewPanel()
101 	{
102 		return true;
103 	}
104 }