Class BrowserTest
- java.lang.Object
-
- com.boomi.connector.testutil.junit.ConnectorTest
-
- com.boomi.connector.testutil.junit.BrowserTest
-
public abstract class BrowserTest extends ConnectorTest
Base test class for testing browse operations withConnectorTester. Implementing classes will execute all defined tests.
-
-
Field Summary
-
Fields inherited from class com.boomi.connector.testutil.junit.ConnectorTest
connectorTester, testContext
-
-
Constructor Summary
Constructors Constructor Description BrowserTest(String label, String id, String expectedElementName, EnumSet<OperationType> expectedOperations)Creates a new test instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterTestBrowseProfile(ObjectDefinitions objectDefinitions)This method can be overridden to provide additional verification beyond the base verifications performed bytestBrowseProfile().protected static voidclearBrowseCache()This method can be used to clear the browse cache.Used in scenarios when testing object browse on different api version where different versions support different objects on same operation.protected intgetExpectedObjectCount(OperationType operationType)This method must be overridden to return the expected number of object types for the specified operation ifisStrict()has been overridden to return true.protected ObjectDefinitionsgetObjectDefinitions(OperationType operationType)A convenience method to get profile definitions for the requested operation typevoidgetObjectTypes()Setup method for browser testsprotected booleanisStrict()This method can be overridden to enable strict verification of the browse types test.voidtestBrowseProfile()Test method to verify the profile for current objectvoidtestBrowseTypesForCreateOperation()Test method to verify if the current object supports theOperationType.CREATEoperationvoidtestBrowseTypesForDeleteOperation()Test method to verify if the current object supports theOperationType.DELETEoperationvoidtestBrowseTypesForExecuteOperation()Test method to verify if the current object supports theOperationType.EXECUTEoperationvoidtestBrowseTypesForGetOperation()Test method to verify if the current object supports theOperationType.GEToperationvoidtestBrowseTypesForQueryOperation()Test method to verify if the current object supports theOperationType.QUERYoperationvoidtestBrowseTypesForUpdateOperation()Test method to verify if the current object supports theOperationType.UPDATEoperationvoidtestBrowseTypesForUpsertOperation()Test method to verify if the current object supports theOperationType.UPSERToperation-
Methods inherited from class com.boomi.connector.testutil.junit.ConnectorTest
browseProfile, browseTypes, clearObjectDefinitionCache, getBrowseContext, getConnectorTestContext, getOperationContext, setupConnectorTester
-
-
-
-
Constructor Detail
-
BrowserTest
public BrowserTest(String label, String id, String expectedElementName, EnumSet<OperationType> expectedOperations)
Creates a new test instance.Intended to be used as part of a
Parameterizedtest but can be run as a single test instance by invoking this constructor from the no argument constructor of the implementing class.- Parameters:
label- the label for the expectedObjectTypeid- the id for the expectedObjectTypeexpectedElementName- the expected name of the element in the profileObjectDefinitionexpectedOperations- the expectedOperationTypevalues supported for this object
-
-
Method Detail
-
getObjectTypes
public final void getObjectTypes()
Setup method for browser testsThis method will perform the browse for all operations and cache the response so that it does not need to be performed for each object under test.
-
testBrowseTypesForGetOperation
public final void testBrowseTypesForGetOperation()
Test method to verify if the current object supports theOperationType.GEToperation
-
testBrowseTypesForQueryOperation
public final void testBrowseTypesForQueryOperation()
Test method to verify if the current object supports theOperationType.QUERYoperation
-
testBrowseTypesForUpdateOperation
public final void testBrowseTypesForUpdateOperation()
Test method to verify if the current object supports theOperationType.UPDATEoperation
-
testBrowseTypesForUpsertOperation
public final void testBrowseTypesForUpsertOperation()
Test method to verify if the current object supports theOperationType.UPSERToperation
-
testBrowseTypesForCreateOperation
public final void testBrowseTypesForCreateOperation()
Test method to verify if the current object supports theOperationType.CREATEoperation
-
testBrowseTypesForDeleteOperation
public final void testBrowseTypesForDeleteOperation()
Test method to verify if the current object supports theOperationType.DELETEoperation
-
testBrowseTypesForExecuteOperation
public final void testBrowseTypesForExecuteOperation()
Test method to verify if the current object supports theOperationType.EXECUTEoperation
-
testBrowseProfile
public final void testBrowseProfile() throws ExceptionTest method to verify the profile for current objectBase verifications include verifying that a definition exists for the expected element and that definition has a schema defined. The test will use the expected operation with the most supported roles.
- Throws:
Exception- exception browsing profile
-
clearBrowseCache
protected static void clearBrowseCache()
This method can be used to clear the browse cache.Used in scenarios when testing object browse on different api version where different versions support different objects on same operation. Use @BeforeClass in a test
-
afterTestBrowseProfile
protected void afterTestBrowseProfile(ObjectDefinitions objectDefinitions) throws Exception
This method can be overridden to provide additional verification beyond the base verifications performed bytestBrowseProfile(). This method will only execute after other verifications have passed.- Parameters:
objectDefinitions- object definitions instance created bytestBrowseProfile()- Throws:
Exception- exception validating the object definitions
-
getObjectDefinitions
protected ObjectDefinitions getObjectDefinitions(OperationType operationType)
A convenience method to get profile definitions for the requested operation type
-
isStrict
protected boolean isStrict()
This method can be overridden to enable strict verification of the browse types test.If this method overridden to return true, then
getExpectedObjectCount(OperationType)must also be overridden as it is used to determine the expected number of object types for each operation.- Returns:
- boolean indicating if the number of object types should be verified for each operation
-
getExpectedObjectCount
protected int getExpectedObjectCount(OperationType operationType)
This method must be overridden to return the expected number of object types for the specified operation ifisStrict()has been overridden to return true.- Parameters:
operationType-OperationTypeunder test- Returns:
- the expected number of object types for the specified operation
-
-