com.eviware.soapui.security
Class SecurityTest

java.lang.Object
  extended by com.eviware.soapui.model.support.AbstractModelItem
      extended by com.eviware.soapui.model.support.AbstractAnimatableModelItem<com.eviware.soapui.config.ModelItemConfig>
          extended by com.eviware.soapui.impl.wsdl.AbstractWsdlModelItem<T>
              extended by com.eviware.soapui.impl.wsdl.AbstractTestPropertyHolderWsdlModelItem<com.eviware.soapui.config.SecurityTestConfig>
                  extended by com.eviware.soapui.security.SecurityTest
All Implemented Interfaces:
MutableTestPropertyHolder, ModelItem, TestModelItem, TestPropertyHolder, TestRunnable, PropertyChangeNotifier

public class SecurityTest
extends AbstractTestPropertyHolderWsdlModelItem<com.eviware.soapui.config.SecurityTestConfig>
implements TestModelItem, TestRunnable

This class is used to connect a TestCase with a set of security scans

Author:
soapUI team

Field Summary
static java.lang.String FAIL_ON_ERROR_PROPERTY
           
static java.lang.String FAIL_ON_SCANS_ERRORS_PROPERTY
           
static java.lang.String SKIP_DATASOURCE_LOOP_PROPERTY
           
static java.lang.String STARTUP_SCRIPT_PROPERTY
           
static java.lang.String TEARDOWN_SCRIPT_PROPERTY
           
 
Fields inherited from interface com.eviware.soapui.model.ModelItem
DESCRIPTION_PROPERTY, ICON_PROPERTY, LABEL_PROPERTY, NAME_PROPERTY
 
Constructor Summary
SecurityTest(WsdlTestCase testCase, com.eviware.soapui.config.SecurityTestConfig config)
           
 
Method Summary
 SecurityScan addNewSecurityScan(TestStep testStep, java.lang.String securityScanName)
          Adds new securityScan for the specific TestStep by Security Scan Type
 SecurityScan addSecurityScan(TestStep testStep, SecurityScanFactory factory, com.eviware.soapui.config.SecurityScanConfig newScanConfig)
          Adds a securityScan for the specific TestStep
 void addSecurityTestListener(SecurityTestListener listener)
           
 void addSecurityTestRunListener(SecurityTestRunListener listener)
           
 void addTestStepRunListener(TestStep testStep, SecurityTestRunListener listener)
           
 boolean canAddSecurityScan(TestStep testStep, java.lang.String securityScanName)
          Checks if we can add new SecurityScan for the specific TestStep (only one type of SecurityScan for TestStep is allowed)
 void clearSecurityTestStepResultMap()
           
 java.lang.String findTestStepScanUniqueName(java.lang.String testStepId, java.lang.String type)
           
 java.lang.String[] getAvailableSecurityScanNames(TestStep testStep, java.lang.String[] securityScanNames)
          Creates array of all available security scan names (those that have not been added to test step).
 java.util.List<? extends ModelItem> getChildren()
           
 boolean getFailOnError()
           
 boolean getFailSecurityTestOnScanErrors()
           
 int getSecurityScanCount()
           
 java.util.HashMap<java.lang.String,java.util.List<SecurityScan>> getSecurityScansMap()
          Returns a map of testids to security scans
 SecurityTestRunListener[] getSecurityTestRunListeners()
           
 java.util.Map<TestStep,SecurityTestStepResult> getSecurityTestStepResultMap()
           
 boolean getSkipDataSourceLoops()
           
 java.lang.String getStartupScript()
           
 int getStepSecurityApplicableScansCount(TestStepResult tsr)
           
 java.lang.String getTearDownScript()
           
 WsdlTestCase getTestCase()
           
 SecurityTestRunListener[] getTestStepRunListeners(TestStep testStep)
           
 SecurityScan getTestStepSecurityScanAt(java.lang.String testStepId, int index)
           
 SecurityScan getTestStepSecurityScanByName(java.lang.String testStepId, java.lang.String securityScanName)
           
<T extends SecurityScan>
java.util.List<T>
getTestStepSecurityScanByType(java.lang.String testStepId, java.lang.Class<T> securityScanType)
           
 java.util.List<SecurityScan> getTestStepSecurityScans(java.lang.String testStepId)
           
 int getTestStepSecurityScansCount(java.lang.String testStepId)
           
 boolean importSecurityScan(TestStep targetTestStep, SecurityScan securityScanToClone, boolean overwrite)
           
 boolean isRunning()
           
 SecurityScan moveTestStepSecurityScan(TestStep testStep, SecurityScan securityScan, int index, int offset)
          Moves specified SecurityScan of a TestStep in a list
 void putSecurityTestStepResult(TestStep testStep, SecurityTestStepResult securityTestStepResult)
          Puts result of a SecurityTest on a TestStep level to a map, if map previously contained value for specified TestStep it is being replaced with the new result value
 void release()
           
 void removeSecurityScan(TestStep testStep, SecurityScan securityScan)
          Remove securityScan for the specific TestStep
 void removeSecurityScanWhenRemoveTestStep(TestStep testStep, SecurityScan securityScan)
           
 void removeSecurityTestListener(SecurityTestListener listener)
           
 void removeSecurityTestRunListener(SecurityTestRunListener listener)
           
 void removeTestStepRunListener(TestStep testStep, SecurityTestRunListener listener)
           
 void resetAllScansSkipFurtherRunning()
           
 void resetConfigOnMove(com.eviware.soapui.config.SecurityTestConfig securityTestConfig)
           
 SecurityTestRunner run(StringToObjectMap context, boolean async)
           
 java.lang.Object runStartupScript(SecurityTestRunContext runContext, SecurityTestRunner runner)
          Executes the startup Script
 java.lang.Object runTearDownScript(SecurityTestRunContext runContext, SecurityTestRunner runner)
          Executes the teardown Script
 void setFailOnError(boolean failOnError)
           
 void setFailSecurityTestOnScanErrors(boolean failSecurityTestOnErrors)
           
 void setSkipDataSourceLoops(boolean skipDataSourceLoops)
           
 void setStartupScript(java.lang.String script)
          Sets the script to be used on startup
 void setTearDownScript(java.lang.String script)
          Sets the script to be used on teardown
protected  boolean skipTest(TestStep testStep)
           
 
Methods inherited from class com.eviware.soapui.impl.wsdl.AbstractTestPropertyHolderWsdlModelItem
addPropertiesFromFile, addProperty, addTestPropertyListener, getModelItem, getProperties, getPropertiesLabel, getProperty, getPropertyAt, getPropertyCount, getPropertyList, getPropertyNames, getPropertyValue, hasProperty, moveProperty, removeProperty, removeTestPropertyListener, renameProperty, setPropertiesConfig, setPropertyValue
 
Methods inherited from class com.eviware.soapui.impl.wsdl.AbstractWsdlModelItem
addExternalDependencies, afterLoad, beforeSave, dependsOn, getConfig, getDescription, getExternalDependencies, getIcon, getId, getName, getParent, getSettings, getWsdlModelItemByName, resolve, setConfig, setDescription, setIcon, setName, setSettings
 
Methods inherited from class com.eviware.soapui.model.support.AbstractModelItem
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, notifyPropertyChanged, notifyPropertyChanged, notifyPropertyChanged, notifyPropertyChanged, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.eviware.soapui.model.TestPropertyHolder
addTestPropertyListener, getModelItem, getProperties, getPropertiesLabel, getProperty, getPropertyAt, getPropertyCount, getPropertyList, getPropertyNames, getPropertyValue, hasProperty, removeTestPropertyListener, setPropertyValue
 
Methods inherited from interface com.eviware.soapui.model.ModelItem
getDescription, getIcon, getId, getName, getParent, getSettings
 
Methods inherited from interface com.eviware.soapui.support.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

STARTUP_SCRIPT_PROPERTY

public static final java.lang.String STARTUP_SCRIPT_PROPERTY

TEARDOWN_SCRIPT_PROPERTY

public static final java.lang.String TEARDOWN_SCRIPT_PROPERTY

FAIL_ON_SCANS_ERRORS_PROPERTY

public static final java.lang.String FAIL_ON_SCANS_ERRORS_PROPERTY

FAIL_ON_ERROR_PROPERTY

public static final java.lang.String FAIL_ON_ERROR_PROPERTY

SKIP_DATASOURCE_LOOP_PROPERTY

public static final java.lang.String SKIP_DATASOURCE_LOOP_PROPERTY
Constructor Detail

SecurityTest

public SecurityTest(WsdlTestCase testCase,
                    com.eviware.soapui.config.SecurityTestConfig config)
Method Detail

release

public void release()
Overrides:
release in class AbstractWsdlModelItem<com.eviware.soapui.config.SecurityTestConfig>

addNewSecurityScan

public SecurityScan addNewSecurityScan(TestStep testStep,
                                       java.lang.String securityScanName)
Adds new securityScan for the specific TestStep by Security Scan Type

Parameters:
testStep -
securityScanName -
Returns:
SecurityScan

addSecurityScan

public SecurityScan addSecurityScan(TestStep testStep,
                                    SecurityScanFactory factory,
                                    com.eviware.soapui.config.SecurityScanConfig newScanConfig)
Adds a securityScan for the specific TestStep

Parameters:
testStep -
factory -
newScanConfig -
Returns:

removeSecurityScan

public void removeSecurityScan(TestStep testStep,
                               SecurityScan securityScan)
Remove securityScan for the specific TestStep

Parameters:
testStep -
securityScan -

removeSecurityScanWhenRemoveTestStep

public void removeSecurityScanWhenRemoveTestStep(TestStep testStep,
                                                 SecurityScan securityScan)

getSecurityScansMap

public java.util.HashMap<java.lang.String,java.util.List<SecurityScan>> getSecurityScansMap()
Returns a map of testids to security scans

Returns:
A map of TestStepIds to their relevant security scans

getSecurityScanCount

public int getSecurityScanCount()

getStepSecurityApplicableScansCount

public int getStepSecurityApplicableScansCount(TestStepResult tsr)

getSecurityTestStepResultMap

public java.util.Map<TestStep,SecurityTestStepResult> getSecurityTestStepResultMap()

clearSecurityTestStepResultMap

public void clearSecurityTestStepResultMap()

putSecurityTestStepResult

public void putSecurityTestStepResult(TestStep testStep,
                                      SecurityTestStepResult securityTestStepResult)
Puts result of a SecurityTest on a TestStep level to a map, if map previously contained value for specified TestStep it is being replaced with the new result value

Parameters:
testStep -
securityTestStepResult -

getTestCase

public WsdlTestCase getTestCase()
Returns:
the current testcase

run

public SecurityTestRunner run(StringToObjectMap context,
                              boolean async)
Specified by:
run in interface TestRunnable

setStartupScript

public void setStartupScript(java.lang.String script)
Sets the script to be used on startup

Parameters:
script -

getStartupScript

public java.lang.String getStartupScript()
Returns:
The current startup script

runStartupScript

public java.lang.Object runStartupScript(SecurityTestRunContext runContext,
                                         SecurityTestRunner runner)
                                  throws java.lang.Exception
Executes the startup Script

Parameters:
runContext -
runner -
Returns:
Throws:
java.lang.Exception

setTearDownScript

public void setTearDownScript(java.lang.String script)
Sets the script to be used on teardown

Parameters:
script -

getTearDownScript

public java.lang.String getTearDownScript()
Returns:
The current teardown script

runTearDownScript

public java.lang.Object runTearDownScript(SecurityTestRunContext runContext,
                                          SecurityTestRunner runner)
                                   throws java.lang.Exception
Executes the teardown Script

Parameters:
runContext -
runner -
Returns:
Throws:
java.lang.Exception

getTestStepSecurityScans

public java.util.List<SecurityScan> getTestStepSecurityScans(java.lang.String testStepId)

getTestStepSecurityScanByName

public SecurityScan getTestStepSecurityScanByName(java.lang.String testStepId,
                                                  java.lang.String securityScanName)

getTestStepSecurityScanByType

public <T extends SecurityScan> java.util.List<T> getTestStepSecurityScanByType(java.lang.String testStepId,
                                                                                java.lang.Class<T> securityScanType)

getTestStepSecurityScanAt

public SecurityScan getTestStepSecurityScanAt(java.lang.String testStepId,
                                              int index)

getTestStepSecurityScansCount

public int getTestStepSecurityScansCount(java.lang.String testStepId)

moveTestStepSecurityScan

public SecurityScan moveTestStepSecurityScan(TestStep testStep,
                                             SecurityScan securityScan,
                                             int index,
                                             int offset)
Moves specified SecurityScan of a TestStep in a list

Parameters:
testStep -
securityScan -
index -
offset - specifies position to move to , negative value means moving up while positive value means moving down
Returns:
new AbstractSecurityScan

findTestStepScanUniqueName

public java.lang.String findTestStepScanUniqueName(java.lang.String testStepId,
                                                   java.lang.String type)

addSecurityTestRunListener

public void addSecurityTestRunListener(SecurityTestRunListener listener)

removeSecurityTestRunListener

public void removeSecurityTestRunListener(SecurityTestRunListener listener)

getSecurityTestRunListeners

public SecurityTestRunListener[] getSecurityTestRunListeners()

getFailSecurityTestOnScanErrors

public boolean getFailSecurityTestOnScanErrors()

setFailSecurityTestOnScanErrors

public void setFailSecurityTestOnScanErrors(boolean failSecurityTestOnErrors)

getFailOnError

public boolean getFailOnError()

setFailOnError

public void setFailOnError(boolean failOnError)

getSkipDataSourceLoops

public boolean getSkipDataSourceLoops()

setSkipDataSourceLoops

public void setSkipDataSourceLoops(boolean skipDataSourceLoops)

addTestStepRunListener

public void addTestStepRunListener(TestStep testStep,
                                   SecurityTestRunListener listener)

removeTestStepRunListener

public void removeTestStepRunListener(TestStep testStep,
                                      SecurityTestRunListener listener)

getTestStepRunListeners

public SecurityTestRunListener[] getTestStepRunListeners(TestStep testStep)

getChildren

public java.util.List<? extends ModelItem> getChildren()
Specified by:
getChildren in interface ModelItem
Overrides:
getChildren in class AbstractModelItem

resetConfigOnMove

public void resetConfigOnMove(com.eviware.soapui.config.SecurityTestConfig securityTestConfig)

canAddSecurityScan

public boolean canAddSecurityScan(TestStep testStep,
                                  java.lang.String securityScanName)
Checks if we can add new SecurityScan for the specific TestStep (only one type of SecurityScan for TestStep is allowed)

Parameters:
testStep -
Returns:
boolean

getAvailableSecurityScanNames

public java.lang.String[] getAvailableSecurityScanNames(TestStep testStep,
                                                        java.lang.String[] securityScanNames)
Creates array of all available security scan names (those that have not been added to test step).

Parameters:
testStep -
Returns:
boolean

importSecurityScan

public boolean importSecurityScan(TestStep targetTestStep,
                                  SecurityScan securityScanToClone,
                                  boolean overwrite)

addSecurityTestListener

public void addSecurityTestListener(SecurityTestListener listener)

removeSecurityTestListener

public void removeSecurityTestListener(SecurityTestListener listener)

isRunning

public boolean isRunning()

skipTest

protected boolean skipTest(TestStep testStep)

resetAllScansSkipFurtherRunning

public void resetAllScansSkipFurtherRunning()


Copyright © 2005-2011 eviware.com. All Rights Reserved.