Class FTPWrapper

  • All Implemented Interfaces:
    org.alfresco.utility.dsl.DSL<FTPWrapper>, org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>, org.alfresco.utility.dsl.DSLFile<FTPWrapper>, org.alfresco.utility.dsl.DSLFolder<FTPWrapper>

    @Service
    @Scope("prototype")
    public class FTPWrapper
    extends org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
    implements org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>, org.alfresco.utility.dsl.DSLFolder<FTPWrapper>, org.alfresco.utility.dsl.DSLFile<FTPWrapper>
    • Field Detail

      • fTPProperties

        @Autowired
        protected FTPProperties fTPProperties
      • tasProperties

        @Autowired
        protected org.alfresco.utility.TasProperties tasProperties
      • STEP_PREFIX

        public static java.lang.String STEP_PREFIX
      • replyCode

        public int replyCode
      • lastDownloadedFile

        public java.io.File lastDownloadedFile
    • Constructor Detail

      • FTPWrapper

        public FTPWrapper()
    • Method Detail

      • getClient

        public org.apache.commons.net.ftp.FTPClient getClient()
      • authenticateUser

        public FTPWrapper authenticateUser​(org.alfresco.utility.model.UserModel userModel)
                                    throws java.lang.Exception
        Specified by:
        authenticateUser in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • authenticateUser

        public FTPWrapper authenticateUser​(org.alfresco.utility.model.UserModel userModel,
                                           java.lang.String server,
                                           int port)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • authenticateUser

        public FTPWrapper authenticateUser​(org.alfresco.utility.model.UserModel userModel,
                                           int fileTransferMode)
                                    throws java.lang.Exception
        Authenticate user and set the file transfer mode (use FTP) codes: 10 - FTP.STREAM_TRANSFER_MODE, 11 - FTP.BLOCK_TRANSFER_MODE, 12 - FTP.COMPRESSED_TRANSFER_MODE)
        Parameters:
        userModel -
        fileTransferMode -
        Returns:
        Throws:
        java.lang.Exception
      • createFolder

        public FTPWrapper createFolder​(org.alfresco.utility.model.FolderModel folderModel)
                                throws java.lang.Exception
        Specified by:
        createFolder in interface org.alfresco.utility.dsl.DSLFolder<FTPWrapper>
        Throws:
        java.lang.Exception
      • getPrefixSpace

        public java.lang.String getPrefixSpace()
        Specified by:
        getPrefixSpace in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
      • getProtocolJMXConfigurationStatus

        protected java.lang.String getProtocolJMXConfigurationStatus()
                                                              throws java.lang.Exception
        Specified by:
        getProtocolJMXConfigurationStatus in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • disconnect

        public FTPWrapper disconnect()
                              throws java.lang.Exception
        Specified by:
        disconnect in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • changeWorkingDirectory

        public FTPWrapper changeWorkingDirectory​(java.lang.String newFolder)
                                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getCurrentDirectory

        public java.lang.String getCurrentDirectory()
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getRootPath

        public java.lang.String getRootPath()
                                     throws org.alfresco.utility.exception.TestConfigurationException
        Specified by:
        getRootPath in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        getRootPath in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
      • usingRoot

        public FTPWrapper usingRoot()
                             throws org.alfresco.utility.exception.TestConfigurationException,
                                    java.lang.Exception
        Specified by:
        usingRoot in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Overrides:
        usingRoot in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
        java.lang.Exception
      • usingUserHome

        public FTPWrapper usingUserHome()
                                 throws org.alfresco.utility.exception.TestConfigurationException,
                                        java.lang.Exception
        Specified by:
        usingUserHome in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        usingUserHome in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
        java.lang.Exception
      • getFiles

        public java.util.List<org.alfresco.utility.model.FileModel> getFiles()
                                                                      throws java.lang.Exception
        Specified by:
        getFiles in interface org.alfresco.utility.dsl.DSLFile<FTPWrapper>
        Throws:
        java.lang.Exception
      • getFolders

        public java.util.List<org.alfresco.utility.model.FolderModel> getFolders()
                                                                          throws java.lang.Exception
        Specified by:
        getFolders in interface org.alfresco.utility.dsl.DSLFolder<FTPWrapper>
        Throws:
        java.lang.Exception
      • getSitesPath

        public java.lang.String getSitesPath()
                                      throws org.alfresco.utility.exception.TestConfigurationException
        Specified by:
        getSitesPath in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        getSitesPath in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
      • getUserHomesPath

        public java.lang.String getUserHomesPath()
                                          throws org.alfresco.utility.exception.TestConfigurationException
        Specified by:
        getUserHomesPath in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        getUserHomesPath in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
      • getDataDictionaryPath

        public java.lang.String getDataDictionaryPath()
                                               throws org.alfresco.utility.exception.TestConfigurationException
        Specified by:
        getDataDictionaryPath in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        getDataDictionaryPath in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
      • usingSite

        public FTPWrapper usingSite​(java.lang.String siteId)
                             throws java.lang.Exception
        Specified by:
        usingSite in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        usingSite in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • usingSite

        public FTPWrapper usingSite​(org.alfresco.utility.model.SiteModel siteModel)
                             throws java.lang.Exception
        Specified by:
        usingSite in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        usingSite in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • usingUserHome

        public FTPWrapper usingUserHome​(java.lang.String username)
                                 throws java.lang.Exception
        Specified by:
        usingUserHome in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        usingUserHome in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • usingResource

        public FTPWrapper usingResource​(org.alfresco.utility.model.ContentModel model)
                                 throws java.lang.Exception
        Specified by:
        usingResource in interface org.alfresco.utility.dsl.DSL<FTPWrapper>
        Specified by:
        usingResource in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
        Throws:
        java.lang.Exception
      • rename

        public FTPWrapper rename​(java.lang.String newName)
                          throws java.lang.Exception
        Specified by:
        rename in interface org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>
        Throws:
        java.lang.Exception
      • update

        public FTPWrapper update​(java.lang.String newContent)
                          throws java.lang.Exception
        Specified by:
        update in interface org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>
        Throws:
        java.lang.Exception
      • appendContent

        public FTPWrapper appendContent​(java.lang.String content)
                                 throws java.lang.Exception
        Append content to file
        Parameters:
        content -
        Returns:
        Throws:
        java.lang.Exception
      • delete

        public FTPWrapper delete()
                          throws java.lang.Exception
        Specified by:
        delete in interface org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>
        Throws:
        java.lang.Exception
      • delete

        public FTPWrapper delete​(java.lang.String path)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • copyTo

        public FTPWrapper copyTo​(org.alfresco.utility.model.ContentModel destination)
                          throws java.lang.Exception
        Specified by:
        copyTo in interface org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>
        Throws:
        java.lang.Exception
      • moveTo

        public FTPWrapper moveTo​(org.alfresco.utility.model.ContentModel destination)
                          throws java.lang.Exception
        Specified by:
        moveTo in interface org.alfresco.utility.dsl.DSLContentModelAction<FTPWrapper>
        Throws:
        java.lang.Exception
      • createFile

        public FTPWrapper createFile​(org.alfresco.utility.model.FileModel fileModel)
                              throws java.lang.Exception
        Specified by:
        createFile in interface org.alfresco.utility.dsl.DSLFile<FTPWrapper>
        Throws:
        java.lang.Exception
      • createFile

        public FTPWrapper createFile​(org.alfresco.utility.model.FileModel fileModel,
                                     int fileSize)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createOfficeFile

        public FTPWrapper createOfficeFile​(org.alfresco.utility.model.FileModel fileModel)
                                    throws java.lang.Exception
        Create Office file which will be used in Integration tests by AOS
        Parameters:
        fileModel -
        Returns:
        Throws:
        java.lang.Exception
      • uploadFile

        public FTPWrapper uploadFile​(java.lang.String pathToFile)
                              throws java.lang.Exception
        Upload file from disk via FTP protocol
        Parameters:
        pathToFile -
        Returns:
        Throws:
        java.lang.Exception
      • uploadFile

        public FTPWrapper uploadFile​(java.io.File file)
                              throws java.lang.Exception
        Upload file from disk via FTP protocol
        Parameters:
        file - File
        Returns:
        Throws:
        java.lang.Exception
      • withJMX

        public JmxUtil withJMX()
        Returns:
        JMX DSL for this wrapper
      • withFtpUtil

        public FTPUtil withFtpUtil()
      • assertThat

        public FTPAssertion assertThat()
        Overrides:
        assertThat in class org.alfresco.utility.dsl.DSLProtocol<FTPWrapper>
      • getDocumentLibraryPath

        public java.lang.String getDocumentLibraryPath​(org.alfresco.utility.model.SiteModel siteModel)
                                                throws org.alfresco.utility.exception.TestConfigurationException,
                                                       java.lang.Exception
        Throws:
        org.alfresco.utility.exception.TestConfigurationException
        java.lang.Exception
      • downloadFileTo

        public FTPWrapper downloadFileTo​(org.alfresco.utility.model.FolderModel destination)
                                  throws java.lang.Exception
        Download file locally, returning the new location
        Parameters:
        destination -
        Returns:
        Throws:
        java.lang.Exception
      • getModificationTime

        public java.lang.String getModificationTime()
                                             throws java.lang.Exception
        Get modification time of last resource
        Returns:
        Throws:
        java.lang.Exception