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.support.editor.inspectors.wsa;
14  
15  import java.awt.event.ItemEvent;
16  import java.awt.event.ItemListener;
17  
18  import javax.swing.JCheckBox;
19  import javax.swing.JTextField;
20  
21  import com.eviware.soapui.config.MustUnderstandTypeConfig;
22  import com.eviware.soapui.config.WsaVersionTypeConfig;
23  import com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse;
24  import com.eviware.soapui.support.components.SimpleBindingForm;
25  import com.eviware.soapui.support.editor.xml.XmlInspector;
26  
27  public class WsdlMockresponseWsaInspector extends AbstractWsaInspector implements XmlInspector
28  {
29  	private final WsdlMockResponse response;
30  	private JCheckBox generateMessageIdCheckBox;
31  	private JTextField messageIdTextField;
32  	private JCheckBox addDefaultToCheckBox;
33  	private JTextField toTextField;
34  	private JCheckBox addDefaultActionCheckBox;
35  	private JTextField actionTextField;
36  
37  	public WsdlMockresponseWsaInspector( WsdlMockResponse response )
38  	{
39  		super( response );
40  		this.response = response;
41  	}
42  
43  	public void buildContent( SimpleBindingForm form )
44  	{
45  		form.addSpace( 5 );
46  		form.appendCheckBox( "wsaEnabled", "Enable WS-A addressing", "Enable/Disable WS-A addressing" );
47  		form.addSpace( 5 );
48  		// add mustUnderstand drop down list
49  		form.appendComboBox( "mustUnderstand", "Must understand", new String[] {
50  				MustUnderstandTypeConfig.NONE.toString(), MustUnderstandTypeConfig.TRUE.toString(),
51  				MustUnderstandTypeConfig.FALSE.toString() },
52  				"The  property for controlling use of the mustUnderstand attribute" );
53  
54  		form.appendComboBox( "version", "WS-A Version", new String[] { WsaVersionTypeConfig.X_200508.toString(),
55  				WsaVersionTypeConfig.X_200408.toString() }, "The  property for managing WS-A version" );
56  
57  		addDefaultActionCheckBox = form.appendCheckBox( "addDefaultAction", "Add default wsa:Action",
58  				"Add default wsa:Action" );
59  		actionTextField = form
60  				.appendTextField( "action", "Action",
61  						"The action related to a message, will be generated if left empty and ws-a settings 'use default action...' checked " );
62  		actionTextField.setEnabled( !addDefaultActionCheckBox.isSelected() );
63  		addDefaultActionCheckBox.addItemListener( new ItemListener()
64  		{
65  
66  			public void itemStateChanged( ItemEvent arg0 )
67  			{
68  				actionTextField.setEnabled( !addDefaultActionCheckBox.isSelected() );
69  			}
70  		} );
71  
72  		addDefaultToCheckBox = form.appendCheckBox( "addDefaultTo", "Add default wsa:To", "Add default wsa:To" );
73  		toTextField = form.appendTextField( "to", "To",
74  				"The destination endpoint reference, will be generated if left empty" );
75  		toTextField.setEnabled( !addDefaultToCheckBox.isSelected() );
76  		addDefaultToCheckBox.addItemListener( new ItemListener()
77  		{
78  
79  			public void itemStateChanged( ItemEvent arg0 )
80  			{
81  				toTextField.setEnabled( !addDefaultToCheckBox.isSelected() );
82  			}
83  		} );
84  
85  		form
86  				.appendTextField(
87  						"relatesTo",
88  						"Relates to",
89  						"The endpoint reference Mock Response relates to, will be set to 'unspecified' if left empty and ws-a settings 'use default...' checked  " );
90  		form.appendTextField( "relationshipType", "Relationship type",
91  				"Relationship type, will be set to 'reply' if left empty and ws-a settings 'use default...' checked  " );
92  		form.addSpace( 10 );
93  		form.appendTextField( "from", "From", "The source endpoint reference" );
94  		form.appendTextField( "faultTo", "Fault to", "The fault endpoint reference" );
95  		form.appendTextField( "replyTo", "Reply to", "The reply endpoint reference" );
96  		generateMessageIdCheckBox = form.appendCheckBox( "generateMessageId", "Generate MessageID",
97  				"Randomly generate MessageId" );
98  		messageIdTextField = form
99  				.appendTextField(
100 						"messageID",
101 						"MessageID",
102 						" The ID of a message that can be used to uniquely identify a message, will be generated if left empty and ws-a settings 'generate message id' checked " );
103 		messageIdTextField.setEnabled( !generateMessageIdCheckBox.isSelected() );
104 		generateMessageIdCheckBox.addItemListener( new ItemListener()
105 		{
106 
107 			public void itemStateChanged( ItemEvent arg0 )
108 			{
109 				messageIdTextField.setEnabled( !generateMessageIdCheckBox.isSelected() );
110 			}
111 		} );
112 		form.addSpace( 5 );
113 	}
114 }