View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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.loadtest.strategy;
14  
15  import java.beans.PropertyChangeListener;
16  import java.beans.PropertyChangeSupport;
17  
18  import javax.swing.JComponent;
19  
20  import org.apache.xmlbeans.XmlObject;
21  
22  import com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTest;
23  import com.eviware.soapui.model.testsuite.LoadTestRunContext;
24  import com.eviware.soapui.model.testsuite.LoadTestRunner;
25  import com.eviware.soapui.model.testsuite.TestRunContext;
26  import com.eviware.soapui.model.testsuite.TestRunner;
27  import com.eviware.soapui.model.testsuite.TestStep;
28  import com.eviware.soapui.model.testsuite.TestStepResult;
29  
30  /***
31   * LoadStrategy allowing maximum runs and request delays
32   * 
33   * @author Ole.Matzura
34   */
35  
36  public abstract class AbstractLoadStrategy implements LoadStrategy
37  {
38  	private PropertyChangeSupport propertyChangeSupport;
39  	private final String type;
40  	private final WsdlLoadTest loadTest;
41  	
42  	public AbstractLoadStrategy( String type, WsdlLoadTest loadTest )
43  	{
44  		this.type = type;
45  		this.loadTest = loadTest;
46  		propertyChangeSupport = new PropertyChangeSupport( this );
47  	}
48  	
49  	public XmlObject getConfig()
50  	{
51        return null;
52  	}
53  
54  	public JComponent getConfigurationPanel()
55  	{
56  		return null;
57  	}
58  
59  	public String getType()
60  	{
61  		return type;
62  	}
63  	
64  	public WsdlLoadTest getLoadTest()
65  	{
66  		return loadTest;
67  	}
68  
69  	public void addConfigurationChangeListener(PropertyChangeListener listener)
70  	{
71  		propertyChangeSupport.addPropertyChangeListener( CONFIGURATION_PROPERTY, listener );
72  	}
73  
74  	public void removeConfigurationChangeListener(PropertyChangeListener listener)
75  	{
76  		propertyChangeSupport.removePropertyChangeListener( CONFIGURATION_PROPERTY, listener );
77  	}
78  
79  	public void notifyConfigurationChanged()
80  	{
81  		propertyChangeSupport.firePropertyChange( CONFIGURATION_PROPERTY, null, null );
82  	}
83  	
84  	public boolean allowThreadCountChangeDuringRun()
85  	{
86  		return true;
87  	}
88  
89  	public void afterLoadTest(LoadTestRunner loadTestRunner, LoadTestRunContext context)
90  	{
91  	}
92  
93  	public void afterTestCase(LoadTestRunner loadTestRunner, LoadTestRunContext context, TestRunner testRunner, TestRunContext runContext)
94  	{
95  	}
96  
97  	public void afterTestStep(LoadTestRunner loadTestRunner, LoadTestRunContext context, TestRunner testRunner, TestRunContext runContext, TestStepResult testStepResult)
98  	{
99  	}
100 
101 	public void beforeLoadTest(LoadTestRunner loadTestRunner, LoadTestRunContext context)
102 	{
103 	}
104 
105 	public void beforeTestCase(LoadTestRunner loadTestRunner, LoadTestRunContext context, TestRunner testRunner, TestRunContext runContext)
106 	{
107 	}
108 
109 	public void beforeTestStep(LoadTestRunner loadTestRunner, LoadTestRunContext context, TestRunner testRunner, TestRunContext runContext, TestStep testStep)
110 	{
111 	}
112 	
113 	public void loadTestStarted(LoadTestRunner loadTestRunner, LoadTestRunContext context)
114 	{
115 	}
116 
117 	public void loadTestStopped(LoadTestRunner loadTestRunner, LoadTestRunContext context)
118 	{
119 	}
120 	
121 	public void recalculate(LoadTestRunner loadTestRunner, LoadTestRunContext context)
122 	{
123 	}
124 
125 	public void updateConfig( XmlObject config )
126 	{
127 	}
128 }