Class Importer


  • public final class Importer
    extends Object
    Contains methods for testing XML backup imports via Confluence admin panel.
    • Field Detail

      • DEFAULT_TIMEOUT

        public static final TimePeriod DEFAULT_TIMEOUT
      • LONG_TIMEOUT

        public static final TimePeriod LONG_TIMEOUT
      • RIDICULOUSLY_LONG_TIMEOUT

        public static final TimePeriod RIDICULOUSLY_LONG_TIMEOUT
    • Constructor Detail

      • Importer

        public Importer​(@NonNull ConfluenceRpc rpc,
                        BaseUrlSelector baseUrlSelector)
        Assumes that the webTester is already on the edit screen.
        Parameters:
        rpc - must be logged in as a user with administrative privileges.
        baseUrlSelector - BaseUrlSelector
      • Importer

        public Importer​(@NonNull ConfluenceRpc rpc,
                        com.atlassian.confluence.test.BaseUrlSelector baseUrlSelector)
      • Importer

        public Importer​(@NonNull ConfluenceRpc rpc,
                        BaseUrlSelector baseUrlSelector,
                        net.sourceforge.jwebunit.junit.WebTester webTester)
        Parameters:
        rpc - must be logged in as a user with administrative privileges.
        baseUrlSelector - BaseUrlSelector
        webTester - WebTester
      • Importer

        public Importer​(@NonNull ConfluenceRpc rpc,
                        com.atlassian.confluence.test.BaseUrlSelector baseUrlSelector,
                        net.sourceforge.jwebunit.junit.WebTester webTester)
    • Method Detail

      • importSpaceBackup

        public void importSpaceBackup​(File backupFile,
                                      TimePeriod importTimeout)

        Import an xml exported space from the classpath into Confluence via the web ui. It sets the TextField containing location of the backup file, which must be set in setBackupFile method.

        Does Not Rebuild Index.

        This method relies on being the only import process running at the time, since it waits for an ImportFinishedEvent - up to the given timeout amount

        Parameters:
        backupFile - to be imported
        importTimeout - maximum amount of time to wait for the import before failing with a RuntimeException.
      • importSpaceBackup

        public void importSpaceBackup​(File backupFile,
                                      TimePeriod importTimeout,
                                      boolean buildIndex)
        Same as importSpaceBackup(File, TimePeriod) but lets you select whether "build index" checkbox should be set
        Parameters:
        backupFile -
        importTimeout -
        buildIndex -
      • attemptInvalidSpaceImport

        public void attemptInvalidSpaceImport​(File backupFile)
        Attempt to import a space backup that is expected to fail. This import makes no assertions about success and does not wait for completion.
      • importGlobalBackup

        public void importGlobalBackup​(File backupFile,
                                       TimePeriod importTimeout,
                                       DirectoryConfiguration directoryConfig,
                                       AdminConsole adminConsole)

        Perform a site import via the web ui. It sets the TextField containing location of the backup file, which must be set in setBackupFile method. After the import is performed, the base url setting is restored.

        Does Not Rebuild Index.

        This method relies on being the only import process running at the time, since it waits for an ImportFinishedEvent - up to the given timeout amount

        Parameters:
        backupFile - to be imported
        importTimeout - maximum amount of time to wait for the import before failing with a RuntimeException.
        directoryConfig - the expected user directory configuration, which must be restored following a global
        adminConsole - required to disable websudo and enable the remote api
      • getImportBackupValidationError

        public String getImportBackupValidationError​(File backupFile)
      • importSynchronously

        public void importSynchronously​(File exportZip,
                                        DirectoryConfiguration directoryConfig,
                                        AdminConsole adminConsole)
        This method tests the synchronous import mode in Confluence. This mode was originally introduced to assist with testing but runs into difficulties for slower imports. However, since the plugin func-test library uses the synchronous import mode we have to maintain it here too.
      • getExportBuildNumber

        public String getExportBuildNumber()
      • getOldestSpaceImportAllowed

        public String getOldestSpaceImportAllowed()
      • getPluginExportCompatibility

        public String getPluginExportCompatibility​(String pluginKey)