Class ProductCharacteristicTestUtils


  • public class ProductCharacteristicTestUtils
    extends Object
    Test utilities to deal with relevant characteristics
    • Method Detail

      • addRelevantCharacteristic

        public static void addRelevantCharacteristic​(String searchKey,
                                                     String name,
                                                     String moduleId)
        Adds a new relevant characteristic into the "Relevant Characteristics" list reference. Note that this method invokes OBDal.flush() to ensure that the changes are visible into the current transaction.
        Parameters:
        searchKey - The search key of the new relevant characteristic
        name - The name of the new relevant characteristic
        moduleId - The ID of the module that the new relevant characteristic belongs to
      • createCharacteristicLinkedToRelevant

        public static Characteristic createCharacteristicLinkedToRelevant​(String name,
                                                                          String relevantCharacteristic)
        Creates a new Characteristic linked to the provided relevant characteristic
        Parameters:
        name - The name of the new characteristic
        relevantCharacteristic - The search key of the relevant characteristic
        Returns:
        the new characteristic
      • createCharacteristicValue

        public static CharacteristicValue createCharacteristicValue​(String name,
                                                                    String code,
                                                                    String characteristicId)
        Creates a new CharacteristicValue for the given Characteristic
        Parameters:
        name - The name of the new characteristic value
        code - The code of the new characteristic value
        characteristicId - The ID of the characteristic that the new value belongs to
        Returns:
        the new characteristic value
      • assignCharacteristicValueToProduct

        public static void assignCharacteristicValueToProduct​(String productId,
                                                              String characteristicValueId)
        Parameters:
        productId - The ID of the product
        characteristicValueId - The ID of the characteristic value
      • unlinkRelevantCharacteristic

        public static void unlinkRelevantCharacteristic​(String characteristicId)
        Unlinks the relevant characteristic assigned to the Characteristic whose ID is passed as parameter
        Parameters:
        characteristicId - The ID of the characteristic
      • reloadRelevantCharacteristicsCache

        public static void reloadRelevantCharacteristicsCache()
        Reloads the cache of relevant characteristic properties
      • createPropertyField

        public static Field createPropertyField​(String tabId,
                                                String propertyPath,
                                                String moduleId)
        Creates a Field on a Tab with the given property path
        Parameters:
        tabId - The ID of the tab where the field is going to be placed
        propertyPath - The path of the property