1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.actions.teststep;
14
15 import com.eviware.soapui.SoapUI;
16 import com.eviware.soapui.impl.wsdl.actions.support.ShowDesktopPanelAction;
17 import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
18 import com.eviware.soapui.support.action.SoapUIActionGroup;
19 import com.eviware.soapui.support.action.SoapUIActionMapping;
20 import com.eviware.soapui.support.action.support.DefaultActionMapping;
21 import com.eviware.soapui.support.action.support.DefaultSoapUIActionGroup;
22 import com.eviware.soapui.support.action.support.SoapUIActionMappingList;
23
24 /***
25 * SoapUIActionGroup for WsdlTestSteps
26 *
27 * @author ole.matzura
28 */
29
30 public class WsdlTestStepSoapUIActionGroup extends DefaultSoapUIActionGroup<WsdlTestStep>
31 {
32 private boolean initialized;
33
34 public WsdlTestStepSoapUIActionGroup( String id, String name )
35 {
36 super( id, name );
37 }
38
39 public SoapUIActionMappingList<WsdlTestStep> getActionMappings( WsdlTestStep modelItem )
40 {
41 SoapUIActionMappingList<WsdlTestStep> actions = super.getActionMappings( modelItem );
42 SoapUIActionMapping<WsdlTestStep> toggleDisabledActionMapping = null;
43
44 if( !initialized )
45 {
46 int insertIndex = 0;
47
48
49 if( modelItem.hasEditor() )
50 {
51 DefaultActionMapping<WsdlTestStep> actionMapping = new DefaultActionMapping<WsdlTestStep>(
52 ShowDesktopPanelAction.SOAPUI_ACTION_ID, "ENTER", null, true, null );
53
54 actionMapping.setName( "Open Editor" );
55 actionMapping.setDescription( "Opens the editor for this TestStep" );
56
57 actions.add( 0, actionMapping );
58 insertIndex++ ;
59 }
60
61 toggleDisabledActionMapping = new DefaultActionMapping<WsdlTestStep>(
62 ToggleDisableTestStepAction.SOAPUI_ACTION_ID, null, null, false, null );
63
64 actions.add( insertIndex, toggleDisabledActionMapping );
65 insertIndex++ ;
66
67
68 SoapUIActionGroup<WsdlTestStep> actionGroup = SoapUI.getActionRegistry()
69 .getActionGroup( "WsdlTestStepActions" );
70 if( actionGroup != null )
71 {
72 actions.addAll( insertIndex, actionGroup.getActionMappings( modelItem ) );
73 }
74
75 initialized = true;
76 }
77 else
78 {
79 for( int c = 0; c < actions.size(); c++ )
80 {
81 if( actions.get( c ).getActionId().equals( ToggleDisableTestStepAction.SOAPUI_ACTION_ID ) )
82 {
83 toggleDisabledActionMapping = actions.get( c );
84 break;
85 }
86 }
87 }
88
89 if( toggleDisabledActionMapping != null )
90 {
91 if( modelItem.isDisabled() )
92 {
93 toggleDisabledActionMapping.setName( "Enable TestStep" );
94 toggleDisabledActionMapping.setDescription( "Enable this TestStep during TestCase execution" );
95 }
96 else
97 {
98 toggleDisabledActionMapping.setName( "Disable TestStep" );
99 toggleDisabledActionMapping.setDescription( "Disables this TestStep during TestCase execution" );
100 }
101 }
102
103 return actions;
104 }
105 }