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        {
57           table.addProperty( "Path", "path", true );
58        }
59        else
60        {
61           table.addProperty( "Endpoint", "endpoint", request.getInterface().getEndpoints() );
62           table.addProperty( "Service", "serviceName" );
63           table.addProperty( "Resource", "resourcePath" );
64  
65        }
66  
67        table.addProperty( "Bind Address", "bindAddress", true );
68        table.addProperty( "Follow Redirects", "followRedirects", JPropertiesTable.BOOLEAN_OPTIONS );
69  
70        // security / authentication
71        table.addProperty( "Username", "username", true );
72        table.addProperty( "Password", "password", true );
73        table.addProperty( "Domain", "domain", true );
74  
75        // post-processing
76        table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
77        table.addProperty( "Dump File", "dumpFile", true ).setDescription( "Dumps response message to specified file" );
78        table.addProperty( "Max Size", "maxSize", true ).setDescription( "The maximum number of bytes to receive" );
79  
80        table.setPropertyObject( request );
81  
82        return table;
83     }
84  
85     public boolean hasOverviewPanel()
86     {
87        return true;
88     }
89  }