Class IntegrationTestUtil
java.lang.Object
de.hybris.platform.servicelayer.ServicelayerTestLogic
de.hybris.platform.integrationservices.util.IntegrationTestUtil
Test utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertModelDoesNotExist(ItemModel model) static <T> TassertModelExists(T sample) static spock.util.concurrent.PollingConditionsstatic CatalogModelImports a Catalogstatic <T extends ItemModel>
Collection<T>Retrieves all model items existing in the persistent storage.static <T extends ItemModel>
Collection<T>Retrieves all model items matching the specified condition in the persistent storage.Retrieves an item model matching the specified condition.getClassificationAttributeCollectionValue(String productCode, String attributeName) static ObjectgetClassificationAttributeValue(String productCode, String attributeName) static <T> TgetModelByExample(T sample) static CatalogVersionModelimportCatalogVersion(String version, String catalog, boolean active) Imports a CatalogVersion and Catalogstatic voidimportClasspathImpEx(String path) Imports impex file located on the classpath into the platformstatic voidImports impex into the platformstatic voidimportImpEx(String... lines) Imports impex into the platformstatic voidimportImpEx(Collection<String> lines) Imports impex into the platformstatic <T extends ItemModel>
Trefresh(T item) Refreshes model to its current state in the persistent storage.static <T extends ItemModel>
voidDeletes all items matching the condition.static <T> voidremove(T model) Removes a specific instance of ItemModelstatic <T extends ItemModel>
Collection<T>Removes all model items existing in the persistent storage.static voidremoveAll(Collection<? extends ItemModel> items) Removes specified model items.static <T extends ItemModel>
voidremoveSafely(Class<T> type, Predicate<T> predicate) Removes items matching the predicate.Methods inherited from class de.hybris.platform.servicelayer.ServicelayerTestLogic
createCoreData, createDefaultCatalog, createDefaultUsers, createHardwareCatalog, importCsv, importData, importData, importData, importStream, importStream, isPrefetchModeNone
-
Constructor Details
-
IntegrationTestUtil
public IntegrationTestUtil()
-
-
Method Details
-
importCsv
Imports impex into the platform- Parameters:
content- IMPEX content to be imported.- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
importClasspathImpEx
Imports impex file located on the classpath into the platform- Parameters:
path- path of the IMPEX file resource on the classpath.- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
importImpEx
Imports impex into the platform- Parameters:
lines- IMPEX lines to be imported.- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
importImpEx
Imports impex into the platform- Parameters:
lines- IMPEX lines to be imported.- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
importCatalogVersion
public static CatalogVersionModel importCatalogVersion(String version, String catalog, boolean active) throws ImpExException Imports a CatalogVersion and Catalog- Parameters:
version- CatalogVersion version valuecatalog- Catalog idactive- Boolean set to the active attribute- Returns:
- The persisted CatalogVersionModel
- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
createCatalogWithId
Imports a Catalog- Parameters:
id- Catalog id- Returns:
- The persisted CatalogModel
- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
assertModelDoesNotExist
-
assertModelExists
public static <T> T assertModelExists(T sample) -
getModelByExample
public static <T> T getModelByExample(T sample) -
refresh
Refreshes model to its current state in the persistent storage.- Parameters:
item- an item model to get fresh state for. WARNING: this method has a side-effect and updates this parameter to the fresh state.- Returns:
- fresh state of the specified model in the persistent storage.
-
findAny
Retrieves an item model matching the specified condition.- Parameters:
type- type of the item to findcondition- a condition the item should match- Returns:
- an optional containing first found matching item (it's possible more than one item matches the condition) or an empty optional, if there are no items matching the condition in the persistent storage.
-
findAll
Retrieves all model items matching the specified condition in the persistent storage.- Parameters:
type- type of the items to search for.condition- condition the searched items should match.- Returns:
- a collection of all matching items or an empty collection, if the persistent storage does not have items matching the specified condition.
-
findAll
Retrieves all model items existing in the persistent storage.- Parameters:
type- type of the items to be found.- Returns:
- a collection of all items or an empty collection, if there are no items in the persistent storage.
-
removeAll
Removes all model items existing in the persistent storage.- Parameters:
type- type of the items to be deleted from the persistent storage.- Returns:
- a collection of all deleted items or an empty collection, if there are no items in the persistent storage.
-
removeAll
Removes specified model items.- Parameters:
items- items to be removed.
-
remove
public static <T> void remove(T model) Removes a specific instance of ItemModel- Parameters:
model- item model to remove
-
removeSafely
Removes items matching the predicate. This method catches possible exceptions thrown in the process of item removal and suppresses them.- Parameters:
type- type of the items to removepredicate- condition the items to be removed should match
-
remove
Deletes all items matching the condition.- Type Parameters:
T- type of the items being deleted- Parameters:
type- type of the items to be deleted.predicate- condition, the items to be deleted should match.
-
condition
public static spock.util.concurrent.PollingConditions condition() -
getClassificationAttributeValue
-
getClassificationAttributeCollectionValue
-