Class IntegrationTestUtil

    • Constructor Detail

      • IntegrationTestUtil

        public IntegrationTestUtil()
    • Method Detail

      • importCsv

        public static void importCsv​(java.lang.String content)
                              throws ImpExException
        Imports 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 ImpExException
        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​(java.lang.String version,
                                                               java.lang.String catalog,
                                                               boolean active)
                                                        throws ImpExException
        Imports a CatalogVersion and Catalog
        Parameters:
        version - CatalogVersion version value
        catalog - Catalog id
        active - 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)
      • refresh

        public static <T extends ItemModel> T refresh​(T item)
        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

        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 find
        condition - 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 <T extends ItemModel> java.util.Collection<T> findAll​(java.lang.Class<T> type,
                                                                            java.util.function.Predicate<T> condition)
        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

        public static <T extends ItemModel> java.util.Collection<T> findAll​(java.lang.Class<T> type)
        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

        public static <T extends ItemModel> java.util.Collection<T> removeAll​(java.lang.Class<T> type)
        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.
      • remove

        public static <T> void remove​(T model)
        Removes a specific instance of ItemModel
        Parameters:
        model - item model to remove
      • removeSafely

        public static <T extends ItemModel> void removeSafely​(java.lang.Class<T> type,
                                                              java.util.function.Predicate<T> predicate)
        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 remove
        predicate - condition the items to be removed should match
      • remove

        public static <T extends ItemModel> void remove​(java.lang.Class<T> type,
                                                        java.util.function.Predicate<T> predicate)
      • condition

        public static spock.util.concurrent.PollingConditions condition()
      • getClassificationAttributeValue

        public static java.lang.Object getClassificationAttributeValue​(java.lang.String productCode,
                                                                       java.lang.String attributeName)
      • getClassificationAttributeCollectionValue

        public static java.util.List<java.lang.Object> getClassificationAttributeCollectionValue​(java.lang.String productCode,
                                                                                                 java.lang.String attributeName)