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