public class TestDataPreparator extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DELIMINATOR |
static String |
DEFAULT_FIELD_NAMES |
Constructor and Description |
---|
TestDataPreparator() |
Modifier and Type | Method and Description |
---|---|
static <T> Map<String,Object> |
buildCleanupCriteria(Class<? extends T> clazz,
Properties properties,
String propertyKey)
build the cleanup criteria for "clazz" from the given properties.
|
static <T> Map<String,Object> |
buildCleanupCriteria(Class<? extends T> clazz,
Properties properties,
String propertyKey,
String fieldNames,
String deliminator)
build the cleanup criteria for "clazz" from the given properties.
|
static <T> List<T> |
buildExpectedValueList(Class<? extends T> clazz,
Properties properties,
String propertyKeyPrefix,
int numberOfData)
build a list of objects of type "clazz" from the expected results provided by the given properties.
|
static <T> List<T> |
buildExpectedValueList(Class<? extends T> clazz,
Properties properties,
String propertyKeyPrefix,
String fieldNames,
String deliminator,
int numberOfData)
build a list of objects of type "clazz" from the expected results provided by the given properties
|
static <T> Map<String,Object> |
buildFieldValues(Class<T> clazz,
Properties properties,
String propertykey,
String fieldNames,
String deliminator)
build the field name and value pairs from the given properties in the specified properties file
|
static <T> List<T> |
buildTestDataList(Class<? extends T> clazz,
Properties properties,
String propertyKeyPrefix,
int numberOfData)
build a list of objects of type "clazz" from the test data provided by the given properties.
|
static <T> List<T> |
buildTestDataList(Class<? extends T> clazz,
Properties properties,
String propertyKeyPrefix,
String fieldNames,
String deliminator,
int numberOfData)
build a list of objects of type "clazz" from the test data provided by the given properties
|
static <T> T |
buildTestDataObject(Class<? extends T> clazz,
Properties properties)
Generates transaction data for a business object from properties
|
static <T> T |
buildTestDataObject(Class<? extends T> clazz,
Properties properties,
String propertyKey)
build an object of type "clazz" from the test data provided by the given properties
|
static <T> T |
buildTestDataObject(Class<? extends T> clazz,
Properties properties,
String propertyKey,
String fieldNames,
String deliminator)
build an object of type "clazz" from the test data provided by the given properties
|
static <T> boolean |
contains(List<T> collection,
T object,
List<String> keyFields)
test if the given object is in the given collection.
|
static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> |
doCleanUpWithoutReference(Class<T> clazz,
Properties properties,
String propertykey,
String fieldNames,
String deliminator)
remove the existing data from the database so that they cannot affact the test results
|
static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> |
doCleanUpWithReference(Class<T> clazz,
Properties properties,
String propertykey,
String fieldNames,
String deliminator)
remove the existing data from the database so that they cannot affact the test results
|
static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> |
findMatching(Class<T> clazz,
Properties properties,
String propertykey,
String fieldNames,
String deliminator)
remove the existing data from the database so that they cannot affact the test results
|
static <T> boolean |
hasSameElements(List<T> collection1,
List<T> collection2,
List<String> keyFields)
test if the given two collections contain the exactly same elements.
|
static Properties |
loadPropertiesFromClassPath(String classPath)
load properties from the given class path resource.
|
static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> |
persistDataObject(List<T> dataObjects)
persist the given data object if it is not in the persistent store
|
static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> |
persistDataObject(T dataObject)
persist the given data object if it is not in the persistent store
|
public static final String DEFAULT_FIELD_NAMES
public static final String DEFAULT_DELIMINATOR
public TestDataPreparator()
public static Properties loadPropertiesFromClassPath(String classPath)
classPath
- the given class path of a resourcepublic static <T> List<T> buildTestDataList(Class<? extends T> clazz, Properties properties, String propertyKeyPrefix, int numberOfData)
clazz
- the the specified object typeproperties
- the given properties that contain the test datapropertyKeyPrefix
- the test data with the given key prefix can be used to construct the return objectsnumberOfData
- the number of test data matching the search criteriapublic static <T> List<T> buildTestDataList(Class<? extends T> clazz, Properties properties, String propertyKeyPrefix, String fieldNames, String deliminator, int numberOfData)
clazz
- the the specified object typeproperties
- the given properties that contain the test datapropertyKeyPrefix
- the test data with the given key prefix can be used to construct the return objectsfieldNames
- the field names of the test data columnsdeliminator
- the deliminator that is used to separate the field from each othernumberOfData
- the number of test data matching the search criteriapublic static <T> T buildTestDataObject(Class<? extends T> clazz, Properties properties, String propertyKey, String fieldNames, String deliminator)
clazz
- the the specified object typeproperties
- the given properties that contain the test datapropertyKey
- the test data with the given keyfieldNames
- the field names of the test data columnsdeliminator
- the deliminator that is used to separate the field from each otherpublic static <T> T buildTestDataObject(Class<? extends T> clazz, Properties properties, String propertyKey)
clazz
- the the specified object typeproperties
- the given properties that contain the test datapropertyKey
- the test data with the given keypublic static <T> List<T> buildExpectedValueList(Class<? extends T> clazz, Properties properties, String propertyKeyPrefix, int numberOfData)
clazz
- the the specified object type. The instance of this type should be comparable through overriding Object.equals()properties
- the given properties that contain the expected resultspropertyKeyPrefix
- the expected results with the given key prefix can be used to construct the return objectsnumberOfData
- the number of the expected results matching the search criteriapublic static <T> List<T> buildExpectedValueList(Class<? extends T> clazz, Properties properties, String propertyKeyPrefix, String fieldNames, String deliminator, int numberOfData)
clazz
- the the specified object type. The instance of this type should be comparable through overriding Object.equals()properties
- the given properties that contain the expected resultspropertyKeyPrefix
- the expected results with the given key prefix can be used to construct the return objectsfieldNames
- the field names of the expected results columnsdeliminator
- the deliminator that is used to separate the field from each othernumberOfData
- the number of the expected results matching the search criteriapublic static <T> Map<String,Object> buildCleanupCriteria(Class<? extends T> clazz, Properties properties, String propertyKey)
clazz
- the the specified object type.properties
- the given properties that contain the cleanup criteria fields and valuespropertyKey
- the given property whose value provides the cleanup criteria valuespublic static <T> Map<String,Object> buildCleanupCriteria(Class<? extends T> clazz, Properties properties, String propertyKey, String fieldNames, String deliminator)
clazz
- the the specified object type.properties
- the given properties that contain the cleanup criteria fields and valuespropertyKey
- the given property whose value provides the cleanup criteria valuesfieldNames
- the field names of the cleanup columnsdeliminator
- the deliminator that is used to separate the field from each otherpublic static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> T persistDataObject(T dataObject)
dataObject
- the given data objectpublic static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> void persistDataObject(List<T> dataObjects)
dataObject
- the given data objectpublic static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> void doCleanUpWithoutReference(Class<T> clazz, Properties properties, String propertykey, String fieldNames, String deliminator) throws Exception
Exception
public static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> void doCleanUpWithReference(Class<T> clazz, Properties properties, String propertykey, String fieldNames, String deliminator) throws Exception
Exception
public static <T extends org.kuali.rice.krad.bo.PersistableBusinessObject> List<T> findMatching(Class<T> clazz, Properties properties, String propertykey, String fieldNames, String deliminator) throws Exception
Exception
public static <T> Map<String,Object> buildFieldValues(Class<T> clazz, Properties properties, String propertykey, String fieldNames, String deliminator) throws Exception
Exception
public static <T> boolean contains(List<T> collection, T object, List<String> keyFields)
public static <T> boolean hasSameElements(List<T> collection1, List<T> collection2, List<String> keyFields)
public static <T> T buildTestDataObject(Class<? extends T> clazz, Properties properties)
businessObject
- the transction business objectException
- thrown if an exception is encountered for any reasonCopyright © 2004–2015 The Kuali Foundation. All rights reserved.