01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * 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.actions.testcase;
14:
15: import java.util.ArrayList;
16: import java.util.List;
17:
18: import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
19: import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepFactory;
20: import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepRegistry;
21: import com.eviware.soapui.support.action.SoapUIActionMapping;
22: import com.eviware.soapui.support.action.support.DefaultActionMapping;
23: import com.eviware.soapui.support.action.support.DefaultSoapUIActionGroup;
24:
25: /**
26: * SoapUIActionGroup for WsdlTestCases, dynamically creates "Append Step" submenu contents from
27: * the WsdlTestStepRegistry
28: *
29: * @author ole.matzura
30: *
31: */
32: public class WsdlTestCaseAddStepSoapUIActionGroup extends
33: DefaultSoapUIActionGroup<WsdlTestCase> {
34: public WsdlTestCaseAddStepSoapUIActionGroup(String id, String name) {
35: super (id, name);
36: }
37:
38: public List<SoapUIActionMapping<WsdlTestCase>> getActionMappings(
39: WsdlTestCase modelItem) {
40: List<SoapUIActionMapping<WsdlTestCase>> actions = new ArrayList<SoapUIActionMapping<WsdlTestCase>>();
41:
42: WsdlTestStepRegistry registry = WsdlTestStepRegistry
43: .getInstance();
44: WsdlTestStepFactory[] factories = (WsdlTestStepFactory[]) registry
45: .getFactories();
46:
47: for (int c = 0; c < factories.length; c++) {
48: WsdlTestStepFactory factory = factories[c];
49: if (factory.canCreate()) {
50: DefaultActionMapping<WsdlTestCase> actionMapping = new DefaultActionMapping<WsdlTestCase>(
51: AddWsdlTestStepAction.SOAPUI_ACTION_ID, null,
52: factory.getTestStepIconPath(), false, factory);
53:
54: actionMapping.setName(factory.getTestStepName());
55: actionMapping.setDescription(factory
56: .getTestStepDescription());
57:
58: actions.add(actionMapping);
59: }
60: }
61:
62: return actions;
63: }
64: }
|