View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 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  	public HttpTestRequestDesktopPanel buildDesktopPanel( HttpTestRequestStep testStep )
37  	{
38  		return new HttpTestRequestDesktopPanel( testStep );
39  	}
40  
41  	public boolean hasDesktopPanel()
42  	{
43  		return true;
44  	}
45  
46  	public JPanel buildOverviewPanel( HttpTestRequestStep testStep )
47  	{
48  		HttpTestRequestInterface<?> request = testStep.getTestRequest();
49  		JPropertiesTable<HttpTestRequestInterface<?>> table = new JPropertiesTable<HttpTestRequestInterface<?>>(
50  				"REST TestRequest Properties" );
51  
52  		// basic properties
53  		table.addProperty( "Name", "name", true );
54  		table.addProperty( "Description", "description", true );
55  		// table.addProperty( "Message Size", "contentLength", false );
56  		table.addProperty( "Encoding", "encoding", new String[] { null, "UTF-8", "iso-8859-1" } );
57  
58  		/*
59  		 * if( request.getOperation() != null ) table.addProperty( "Endpoint",
60  		 * "endpoint", request.getInterface().getEndpoints() );
61  		 */
62  
63  		table.addProperty( "Endpoint", "endpoint", true );
64  		table.addProperty( "Timeout", "timeout", true );
65  
66  		table.addProperty( "Bind Address", "bindAddress", true );
67  		table.addProperty( "Follow Redirects", "followRedirects", JPropertiesTable.BOOLEAN_OPTIONS );
68  
69  		/*
70  		 * if( request.getOperation() != null ) { table.addProperty( "Service",
71  		 * "service" ); table.addProperty( "Resource", "path" ); }
72  		 */
73  
74  		// security / authentication
75  		table.addProperty( "Username", "username", true );
76  		table.addProperty( "Password", "password", true );
77  		table.addProperty( "Domain", "domain", true );
78  
79  		StringList keystores = new StringList( ( ( WsdlProject )request.getTestStep().getTestCase().getTestSuite()
80  				.getProject() ).getWssContainer().getCryptoNames() );
81  		keystores.add( "" );
82  		table.addProperty( "SSL Keystore", "sslKeystore", keystores.toStringArray() );
83  
84  		table.addProperty( "Strip whitespaces", "stripWhitespaces", JPropertiesTable.BOOLEAN_OPTIONS );
85  		table.addProperty( "Remove Empty Content", "removeEmptyContent", JPropertiesTable.BOOLEAN_OPTIONS );
86  		table.addProperty( "Entitize Properties", "entitizeProperties", JPropertiesTable.BOOLEAN_OPTIONS );
87  
88  		// post-processing
89  		table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
90  		table.addProperty( "Dump File", "dumpFile", true ).setDescription( "Dumps response message to specified file" );
91  		table.addProperty( "Max Size", "maxSize", true ).setDescription( "The maximum number of bytes to receive" );
92  		table.setPropertyObject( request );
93  
94  		return table;
95  	}
96  
97  	public boolean hasOverviewPanel()
98  	{
99  		return true;
100 	}
101 }