Class Exporter
- java.lang.Object
-
- com.atlassian.confluence.it.export.Exporter
-
public class Exporter extends Object
Contains methods for testing export. There are no good reasons why the only export space method is by webTester and the only site export is by RPC. It's just what is currently used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExporter.AttachmentOptionstatic classExporter.CommentOptionstatic classExporter.ContentOptionstatic interfaceExporter.ExporterFormOption
-
Constructor Summary
Constructors Constructor Description Exporter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SimpleSiteStructuredownloadAndParseExport(URL url, User user)Download and parse xml backup into SimpleSiteStructure, useful to validate site exports in acceptance tests.static org.dom4j.DocumentdownloadAndReadExport(URL url, User user)static FiledownloadExportToTemp(URL url, User user)static URLexportSite(ConfluenceRpc rpc, Exporter.AttachmentOption attachmentOption)Export a site via RPC.static URLexportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Exporter.ContentOption contentOption)Export a space through the web interface.static URLexportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Exporter.ContentOption contentOption, Collection<Long> excludedPageIds)Export a space through the web interface.static URLexportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Collection<Long> excludedPageIds, Exporter.ExporterFormOption... options)Export a space through the web interface.static SimpleHtmlSpaceExportStructuregetSimpleHtmlSpaceExportStructure(Space space, ZipFile siteZip)Given an export html zip, returns a structure that represents the export.static SimpleSiteStructuregetSimpleSiteStructure(File file)Return SimpleSiteStructure object useful to validate site exports in acceptance tests.
-
-
-
Method Detail
-
exportSpace
public static URL exportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Collection<Long> excludedPageIds, Exporter.ExporterFormOption... options)
Export a space through the web interface.- Parameters:
space- the target spacewebTester- should have the appropriate user logged in alreadyoptions- any of the variousExporter.ExporterFormOptionsexcludedPageIds- a collection of page IDs that should not be selected for export, others are selected by default- Returns:
- a URL from which the space can be downloaded by whatever user was logged in to the WebTester.
-
exportSpace
public static URL exportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Exporter.ContentOption contentOption, Collection<Long> excludedPageIds)
Export a space through the web interface.- Parameters:
space- the target spacewebTester- should have the appropriate user logged in alreadycontentOption- can be ALL, VISIBLE, or DEFAULTexcludedPageIds- a collection of page IDs that should not be selected for export, others are selected by default- Returns:
- a URL from which the space can be downloaded by whatever user was logged in to the WebTester.
-
exportSpace
public static URL exportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Exporter.ContentOption contentOption)
Export a space through the web interface.- Parameters:
space- the target spacewebTester- should have the appropriate user logged in alreadycontentOption- can be ALL, VISIBLE, or DEFAULT- Returns:
- a URL from which the space can be downloaded by whatever user was logged in to the WebTester.
-
exportSite
public static URL exportSite(ConfluenceRpc rpc, Exporter.AttachmentOption attachmentOption) throws MalformedURLException
Export a site via RPC.- Parameters:
rpc- the rpc objectattachmentOption- true for exporting attachments, false otherwise- Returns:
- a URL from which the site can be downloaded
- Throws:
MalformedURLException- if the URL is malformed
-
downloadAndParseExport
public static SimpleSiteStructure downloadAndParseExport(URL url, User user) throws Exception
Download and parse xml backup into SimpleSiteStructure, useful to validate site exports in acceptance tests.- Parameters:
url- where export can be downloadeduser- with sufficient permission to download export- Returns:
- SimpleSiteStructure a simple representation of an exported Confluence backup to easily validate site exports in acceptance tests
- Throws:
IOException- if file does not exist in the given url.Exception- if it failed to create InputStream for entities.xml entry.
-
downloadAndReadExport
public static org.dom4j.Document downloadAndReadExport(URL url, User user) throws Exception
- Throws:
Exception
-
downloadExportToTemp
public static File downloadExportToTemp(URL url, User user) throws IOException
- Throws:
IOException
-
getSimpleSiteStructure
public static SimpleSiteStructure getSimpleSiteStructure(File file) throws Exception
Return SimpleSiteStructure object useful to validate site exports in acceptance tests.- Parameters:
file- XML backup- Returns:
- SimpleSiteStructure
- Throws:
IOException- if file does not exist.Exception- if it failed to create InputStream for entities.xml entry.
-
getSimpleHtmlSpaceExportStructure
public static SimpleHtmlSpaceExportStructure getSimpleHtmlSpaceExportStructure(Space space, ZipFile siteZip)
Given an export html zip, returns a structure that represents the export.
-
-