Class IntegrationTestUtil
- java.lang.Object
-
- de.hybris.platform.servicelayer.ServicelayerTestLogic
-
- de.hybris.platform.integrationservices.util.IntegrationTestUtil
-
public class IntegrationTestUtil extends ServicelayerTestLogic
Test utilities.
-
-
Constructor Summary
Constructors Constructor Description IntegrationTestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertModelDoesNotExist(ItemModel model)static <T> TassertModelExists(T sample)static spock.util.concurrent.PollingConditionscondition()static CatalogModelcreateCatalogWithId(java.lang.String id)Imports a Catalogstatic java.util.Collection<java.lang.Object>findAll(java.lang.Class<? extends ItemModel> type)Retrieves all model items existing in the persistent storage.static <T extends ItemModel>
java.util.Optional<T>findAny(java.lang.Class<T> type, java.util.function.Predicate<T> condition)Retrieves an item model matching the specified condition.static <T> TgetModelByExample(T sample)static <T> TgetService(java.lang.String name, java.lang.Class<T> type)static CatalogVersionModelimportCatalogVersion(java.lang.String version, java.lang.String catalog, boolean active)Imports a CatalogVersion and Catalogstatic voidimportCsv(java.lang.String content)Imports impex into the platformstatic voidimportImpEx(java.lang.String... lines)Imports impex into the platformstatic <T> voidremove(T model)Removes a specific instance of ItemModelstatic java.util.Collection<java.lang.Object>removeAll(java.lang.Class<? extends ItemModel> type)Removes all model items existing in the persistent storage.-
Methods inherited from class de.hybris.platform.servicelayer.ServicelayerTestLogic
createCoreData, createDefaultCatalog, createDefaultUsers, createHardwareCatalog, importCsv, importData, importData, importData, importStream, importStream, isPrefetchModeNone
-
-
-
-
Method Detail
-
importCsv
public static void importCsv(java.lang.String content) throws ImpExExceptionImports impex into the platform- Parameters:
content- IMPEX content to be imported.- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
importImpEx
public static void importImpEx(java.lang.String... lines) throws ImpExExceptionImports 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(java.lang.String version, java.lang.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
public static CatalogModel createCatalogWithId(java.lang.String id) throws ImpExException
Imports a Catalog- Parameters:
id- Catalog id- Returns:
- The persisted CatalogModel
- Throws:
ImpExException- when import failed. Most likely the IMPEX is invalid.
-
assertModelDoesNotExist
public static void assertModelDoesNotExist(ItemModel model)
-
assertModelExists
public static <T> T assertModelExists(T sample)
-
getModelByExample
public static <T> T getModelByExample(T sample)
-
findAny
public static <T extends ItemModel> java.util.Optional<T> findAny(java.lang.Class<T> type, java.util.function.Predicate<T> condition)
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
public static java.util.Collection<java.lang.Object> findAll(java.lang.Class<? extends ItemModel> type)
Retrieves all model items existing in the persistent storage.- Returns:
- a collection of all items or an empty collection, if there are no items in the persistent storage.
-
removeAll
public static java.util.Collection<java.lang.Object> removeAll(java.lang.Class<? extends ItemModel> type)
Removes all model items existing in the persistent storage.- Returns:
- a collection of all deleted items or an empty collection, if there are no items in the persistent storage.
-
remove
public static <T> void remove(T model)
Removes a specific instance of ItemModel- Parameters:
model- item model to remove
-
getService
public static <T> T getService(java.lang.String name, java.lang.Class<T> type)
-
condition
public static spock.util.concurrent.PollingConditions condition()
-
-