View Javadoc

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  package com.eviware.soapui.impl.wsdl.panels.teststeps;
14  
15  import com.eviware.soapui.impl.EmptyPanelBuilder;
16  import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest;
17  import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep;
18  import com.eviware.soapui.support.components.JPropertiesTable;
19  
20  import javax.swing.*;
21  
22  /***
23   * PanelBuilder for RestTestRequest
24   * 
25   * @author Ole.Matzura
26   */
27  
28  public class RestTestRequestPanelBuilder extends EmptyPanelBuilder<RestTestRequestStep>
29  {
30     public RestTestRequestPanelBuilder()
31     {
32     }
33  
34     public RestTestRequestDesktopPanel buildDesktopPanel(RestTestRequestStep testStep)
35     {
36        return new RestTestRequestDesktopPanel(testStep);
37     }
38  
39     public boolean hasDesktopPanel()
40     {
41        return true;
42     }
43     
44     public JPanel buildOverviewPanel(RestTestRequestStep testStep)
45     {
46     	RestTestRequest request = testStep.getTestRequest();
47     	JPropertiesTable<RestTestRequest> table = new JPropertiesTable<RestTestRequest>( "REST TestRequest Properties" );
48     	
49     	// basic properties
50     	table.addProperty( "Name", "name", true );
51     	table.addProperty( "Description", "description", true );
52  //   	table.addProperty( "Message Size", "contentLength", false );
53     	table.addProperty( "Encoding", "encoding", new String[] {null, "UTF-8", "iso-8859-1" } );
54  
55        if( request.getOperation() == null )
56           table.addProperty( "Path", "path", true );
57        else
58           table.addProperty( "Endpoint", "endpoint", request.getInterface().getEndpoints() );
59        
60        table.addProperty( "Bind Address", "bindAddress", true );
61  
62  //      table.addProperty( "Service", "service" );
63  //   	table.addProperty( "Resource", "resourcePath" );
64  
65     	// security / authentication
66     	table.addProperty( "Username", "username", true );
67     	table.addProperty( "Password", "password", true );
68     	table.addProperty( "Domain", "domain", true );
69     	
70     	// post-processing
71     	table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
72     	table.addProperty( "Dump File", "dumpFile", true ).setDescription("Dumps response message to specified file" );
73     	table.addProperty( "Max Size", "maxSize", true ).setDescription("The maximum number of bytes to receive" );
74  
75     	
76     	table.setPropertyObject( request );
77     	
78     	return table;
79     }
80  
81     public boolean hasOverviewPanel()
82     {
83        return true;
84     }
85  }