com.atlassian.confluence.it.export
Class Exporter

java.lang.Object
  extended by com.atlassian.confluence.it.export.Exporter

public class Exporter
extends java.lang.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
static class Exporter.AttachmentOption
           
static class Exporter.CommentOption
           
static class Exporter.ContentOption
           
static interface Exporter.ExporterFormOption
           
 
Constructor Summary
Exporter()
           
 
Method Summary
static SimpleSiteStructure downloadAndParseExport(java.net.URL url, User user)
          Download and parse xml backup into SimpleSiteStructure, useful to validate site exports in acceptance tests.
static org.dom4j.Document downloadAndReadExport(java.net.URL url, User user)
           
static java.io.File downloadExportToTemp(java.net.URL url, User user)
           
static java.net.URL exportSite(ConfluenceRpc rpc, Exporter.AttachmentOption attachmentOption)
          Export a site via RPC.
static java.net.URL exportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, java.util.Collection<java.lang.Long> excludedPageIds, Exporter.ExporterFormOption... options)
          Export a space through the web interface.
static java.net.URL exportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Exporter.ContentOption contentOption)
          Export a space through the web interface.
static java.net.URL exportSpace(Space space, net.sourceforge.jwebunit.junit.WebTester webTester, Exporter.ContentOption contentOption, java.util.Collection<java.lang.Long> excludedPageIds)
          Export a space through the web interface.
static SimpleHtmlSpaceExportStructure getSimpleHtmlExportStructure(Space space, java.io.File htmlExportZip)
          Given an export html zip, returns a structure that represents the export.
static SimpleSiteStructure getSimpleSiteStructure(java.io.File file)
          Return SimpleSiteStructure object useful to validate site exports in acceptance tests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exporter

public Exporter()
Method Detail

exportSpace

public static java.net.URL exportSpace(Space space,
                                       net.sourceforge.jwebunit.junit.WebTester webTester,
                                       java.util.Collection<java.lang.Long> excludedPageIds,
                                       Exporter.ExporterFormOption... options)
Export a space through the web interface.

Parameters:
space - the target space
webTester - should have the appropriate user logged in already
options - any of the various Exporter.ExporterFormOptions
excludedPageIds - 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 java.net.URL exportSpace(Space space,
                                       net.sourceforge.jwebunit.junit.WebTester webTester,
                                       Exporter.ContentOption contentOption,
                                       java.util.Collection<java.lang.Long> excludedPageIds)
Export a space through the web interface.

Parameters:
space - the target space
webTester - should have the appropriate user logged in already
contentOption - can be ALL, VISIBLE, or DEFAULT
excludedPageIds - 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 java.net.URL exportSpace(Space space,
                                       net.sourceforge.jwebunit.junit.WebTester webTester,
                                       Exporter.ContentOption contentOption)
Export a space through the web interface.

Parameters:
space - the target space
webTester - should have the appropriate user logged in already
contentOption - 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 java.net.URL exportSite(ConfluenceRpc rpc,
                                      Exporter.AttachmentOption attachmentOption)
                               throws java.net.MalformedURLException
Export a site via RPC.

Parameters:
rpc - the rpc object
attachmentOption - true for exporting attachments, false otherwise
Returns:
a URL from which the site can be downloaded
Throws:
java.net.MalformedURLException - if the URL is malformed

downloadAndParseExport

public static SimpleSiteStructure downloadAndParseExport(java.net.URL url,
                                                         User user)
                                                  throws java.lang.Exception
Download and parse xml backup into SimpleSiteStructure, useful to validate site exports in acceptance tests.

Parameters:
url - where export can be downloaded
user - 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:
java.io.IOException - if file does not exist in the given url.
java.lang.Exception - if it failed to create InputStream for entities.xml entry.

downloadAndReadExport

public static org.dom4j.Document downloadAndReadExport(java.net.URL url,
                                                       User user)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

downloadExportToTemp

public static java.io.File downloadExportToTemp(java.net.URL url,
                                                User user)
                                         throws java.io.IOException
Throws:
java.io.IOException

getSimpleSiteStructure

public static SimpleSiteStructure getSimpleSiteStructure(java.io.File file)
                                                  throws java.lang.Exception
Return SimpleSiteStructure object useful to validate site exports in acceptance tests.

Parameters:
file - XML backup
Returns:
SimpleSiteStructure
Throws:
java.io.IOException - if file does not exist.
java.lang.Exception - if it failed to create InputStream for entities.xml entry.

getSimpleHtmlExportStructure

public static SimpleHtmlSpaceExportStructure getSimpleHtmlExportStructure(Space space,
                                                                          java.io.File htmlExportZip)
                                                                   throws java.io.IOException
Given an export html zip, returns a structure that represents the export.

Parameters:
space -
htmlExportZip - a space export zip file
Returns:
Throws:
java.io.IOException


Copyright © 2003-2014 Atlassian. All Rights Reserved.