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.mockoperation;
14  
15  import java.awt.Component;
16  
17  import com.eviware.soapui.impl.EmptyPanelBuilder;
18  import com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse;
19  import com.eviware.soapui.impl.wsdl.support.CompressionSupport;
20  import com.eviware.soapui.support.components.JPropertiesTable;
21  import com.eviware.soapui.support.types.StringList;
22  import com.eviware.soapui.ui.desktop.DesktopPanel;
23  
24  /***
25   * PanelBuilder for WsdlMockResponses
26   * 
27   * @author ole.matzura
28   */
29  
30  public class WsdlMockResponsePanelBuilder extends EmptyPanelBuilder<WsdlMockResponse>
31  {
32  	public DesktopPanel buildDesktopPanel( WsdlMockResponse mockResponse )
33  	{
34  		return new WsdlMockResponseDesktopPanel( mockResponse );
35  	}
36  
37  	public boolean hasDesktopPanel()
38  	{
39  		return true;
40  	}
41  
42  	public boolean hasOverviewPanel()
43  	{
44  		return true;
45  	}
46  
47  	public Component buildOverviewPanel( WsdlMockResponse mockResponse )
48  	{
49  		JPropertiesTable<WsdlMockResponse> table = new JPropertiesTable<WsdlMockResponse>( "MockResponse 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  		StringList outgoingNames = new StringList( mockResponse.getMockOperation().getMockService().getProject()
56  				.getWssContainer().getOutgoingWssNames() );
57  		outgoingNames.add( "" );
58  		table.addProperty( "Outgoing WSS", "outgoingWss", outgoingNames.toStringArray() );
59  
60  		// attachments
61  		table.addProperty( "Enable MTOM", "mtomEnabled", JPropertiesTable.BOOLEAN_OPTIONS );
62  		table.addProperty( "Force MTOM", "forceMtom", JPropertiesTable.BOOLEAN_OPTIONS );
63  		table.addProperty( "Enable multiparts", "multipartEnabled", JPropertiesTable.BOOLEAN_OPTIONS );
64  		table.addProperty( "Encode Attachments", "encodeAttachments", JPropertiesTable.BOOLEAN_OPTIONS );
65  
66  		// preprocessing
67  		table.addProperty( "Strip whitespaces", "stripWhitespaces", JPropertiesTable.BOOLEAN_OPTIONS );
68  		table.addProperty( "Remove Empty Content", "removeEmptyContent", JPropertiesTable.BOOLEAN_OPTIONS );
69  		table.addProperty( "Entitize Properties", "entitizeProperties", JPropertiesTable.BOOLEAN_OPTIONS );
70  
71  		// others
72  		table.addProperty( "Enable Inline Files", "inlineFilesEnabled", JPropertiesTable.BOOLEAN_OPTIONS )
73  				.setDescription( "Enables inline file references [file:<path>] in elements with binary content" );
74  		table.addProperty( "Response HTTP-Status", "responseHttpStatus", true );
75  		table.addProperty( "Response Delay", "responseDelay", true );
76  		table.addProperty( "Response Compression", "responseCompression", new String[] {
77  				WsdlMockResponse.AUTO_RESPONSE_COMPRESSION, WsdlMockResponse.NO_RESPONSE_COMPRESSION,
78  				CompressionSupport.ALG_DEFLATE, CompressionSupport.ALG_GZIP } );
79  
80  		table.addProperty( "WS-Addressing", "wsAddressing", JPropertiesTable.BOOLEAN_OPTIONS );
81  
82  		table.setPropertyObject( mockResponse );
83  
84  		return table;
85  	}
86  }