Class MockEntityUtils


  • public class MockEntityUtils
    extends CayenneService
    This is an internal utility class providing common methods for unit tests. This class is not a part of the public TM API and is not guaranteed to remain compatible across releases.
    Since:
    18.11.0
    • Constructor Detail

      • MockEntityUtils

        public MockEntityUtils()
    • Method Detail

      • addSubmissionToGroup

        public SubmissionGroup addSubmissionToGroup​(Submission submission,
                                                    Group group)
        Create a submission group association. This method performs a DB commit and clears the cache.
        Parameters:
        submission - the submission (required)
        group - the group (required)
        Returns:
        the submission group
        Since:
        18.11.0
      • addSearchableSubmissionProperty

        public SubmissionProperty addSearchableSubmissionProperty​(Submission submission,
                                                                  String name,
                                                                  String value)
        Stores a submission property (encrypted) and adds a submission property search entry.
      • storeSubmissionDataExtracts

        public void storeSubmissionDataExtracts​(Submission submission,
                                                Map<String,​String> dataExtractMap)
        Stores a submission property (encrypted) and adds a submission property search entry.
      • createDeliveryDetails

        public DeliveryDetails createDeliveryDetails​(Client client,
                                                     String name,
                                                     String method)
        Create a basic delivery channel for the given client. The caller needs to fill in additional fields based on delivery method (e.g. delivery process name)
        Parameters:
        client - the client (required)
        name - the name (required, must be unique for the client)
        method - (required)
        Returns:
        the committed DeliveryDetails object
        Since:
        20.05.0
      • createElectronicAttachment

        public Attachment createElectronicAttachment​(Submission submission,
                                                     String fileName,
                                                     byte[] fileData,
                                                     String fileUploadType)
        Create a basic delivery channel for the given client. The caller needs to fill in additional fields based on delivery method (e.g. delivery process name)
        Parameters:
        submission - the submission (required)
        fileName - the attachment file name (required)
        fileData - (required) the attachment file data (required)
        fileUploadType - (required) one of FileUpload.TYPES
        Returns:
        the committed Attachment object with associated FileUpload
        Since:
        20.05.0
      • createDeploymentProperty

        public DeploymentProperty createDeploymentProperty​(String propertyName,
                                                           String type,
                                                           String value)
        Create a deployment property with the given name, type and value. This method does not check if such a deployment property already exists.
        Parameters:
        propertyName - the deployment property name (required)
        type - the type (required; one of the types defined in DeploymentProperty)
        value - the value (optional)
        Returns:
        the deployment property
        Since:
        19.11.3
      • setupRemoteUserProvider

        public void setupRemoteUserProvider​(HttpServletRequest request)
        This is taken from the RemoteUserFilter, it sets up the remoteUserProvider correctly for a give request.getRemoteUser()
        Parameters:
        request - the mock HttpServletRequest containing the remote user attribute
        Since:
        20.5.0
      • createMockRequest

        public org.apache.click.servlet.MockRequest createMockRequest​(String loginName,
                                                                      Portal portal)
        Creates a MockRequest for the given loginname and portal.
        Parameters:
        loginName - the user login name String to be used buy request.getRemoteUser()
        portal - the Portal to associate the request to.
        Returns:
        a MockRequest for the given login name and portal.