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 void
afterTestBrowseProfile(ObjectDefinitions objectDefinitions)
This method can be overridden to provide additional verification beyond the base verifications performed bytestBrowseProfile()
.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.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.protected ObjectDefinitions
getObjectDefinitions(OperationType operationType)
A convenience method to get profile definitions for the requested operation typevoid
getObjectTypes()
Setup method for browser testsprotected boolean
isStrict()
This method can be overridden to enable strict verification of the browse types test.void
testBrowseProfile()
Test method to verify the profile for current objectvoid
testBrowseTypesForCreateOperation()
Test method to verify if the current object supports theOperationType.CREATE
operationvoid
testBrowseTypesForDeleteOperation()
Test method to verify if the current object supports theOperationType.DELETE
operationvoid
testBrowseTypesForExecuteOperation()
Test method to verify if the current object supports theOperationType.EXECUTE
operationvoid
testBrowseTypesForGetOperation()
Test method to verify if the current object supports theOperationType.GET
operationvoid
testBrowseTypesForQueryOperation()
Test method to verify if the current object supports theOperationType.QUERY
operationvoid
testBrowseTypesForUpdateOperation()
Test method to verify if the current object supports theOperationType.UPDATE
operationvoid
testBrowseTypesForUpsertOperation()
Test method to verify if the current object supports theOperationType.UPSERT
operation-
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
Parameterized
test 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 expectedObjectType
id
- the id for the expectedObjectType
expectedElementName
- the expected name of the element in the profileObjectDefinition
expectedOperations
- the expectedOperationType
values 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.GET
operation
-
testBrowseTypesForQueryOperation
public final void testBrowseTypesForQueryOperation()
Test method to verify if the current object supports theOperationType.QUERY
operation
-
testBrowseTypesForUpdateOperation
public final void testBrowseTypesForUpdateOperation()
Test method to verify if the current object supports theOperationType.UPDATE
operation
-
testBrowseTypesForUpsertOperation
public final void testBrowseTypesForUpsertOperation()
Test method to verify if the current object supports theOperationType.UPSERT
operation
-
testBrowseTypesForCreateOperation
public final void testBrowseTypesForCreateOperation()
Test method to verify if the current object supports theOperationType.CREATE
operation
-
testBrowseTypesForDeleteOperation
public final void testBrowseTypesForDeleteOperation()
Test method to verify if the current object supports theOperationType.DELETE
operation
-
testBrowseTypesForExecuteOperation
public final void testBrowseTypesForExecuteOperation()
Test method to verify if the current object supports theOperationType.EXECUTE
operation
-
testBrowseProfile
public final void testBrowseProfile() throws Exception
Test 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
-OperationType
under test- Returns:
- the expected number of object types for the specified operation
-
-