Class ItStateManager

java.lang.Object
com.atlassian.integrationtest.utils.ItStateManager

public class ItStateManager extends Object
Updates the IT server state with Spaces, Pages, etc for use with tests. Most are created inside this class, but some can be tracked and created outside this class see RestoreIntegrationTestDataBuilder for example.
  • Field Details

  • Constructor Details

    • ItStateManager

      public ItStateManager()
  • Method Details

    • removeAllTrackedObjects

      public void removeAllTrackedObjects()
    • getSpacePermissionManager

      public SpacePermissionManagerInternal getSpacePermissionManager()
    • getSpaceManager

      public SpaceManagerInternal getSpaceManager()
    • getTrashManager

      public TrashManager getTrashManager()
    • getCommentManager

      public CommentManagerInternal getCommentManager()
    • getPageManager

      public PageManagerInternal getPageManager()
    • getContentService

      public ContentService getContentService()
    • getAsymmetricKeyFactory

      public AsymmetricKeyFactory getAsymmetricKeyFactory()
    • getTrustedApplicationsManager

      public TrustedApplicationsManager getTrustedApplicationsManager()
    • getAttachmentManager

      public AttachmentManagerInternal getAttachmentManager()
    • getLabelManager

      public LabelManager getLabelManager()
    • getFavouriteManager

      public FavouriteManager getFavouriteManager()
    • getFollowManager

      public FollowManagerInternal getFollowManager()
    • storeAndGetTestPage

      public Page storeAndGetTestPage()
    • addContentNotification

      public void addContentNotification(ConfluenceUser user, ContentEntityObject contentEntityObject)
    • storeAndGetTestPage

      public Page storeAndGetTestPage(Space pageSpace)
    • storeAndGetTestPage

      public Page storeAndGetTestPage(Space pageSpace, String title)
    • storeAndGetTestPage

      public Page storeAndGetTestPage(Space pageSpace, String title, String contentStatus, Page originalPage)
    • storeAndGetTestPage

      public Page storeAndGetTestPage(Space pageSpace, String title, String contentStatus, Page originalPage, ConfluenceUser author)
    • modifyPage

      public void modifyPage(Page originalPage)
    • deletePage

      public void deletePage(Page page, ConfluenceUser user)
    • storeAndGetTestChildPage

      public Page storeAndGetTestChildPage(Space pageSpace, Page parentPage, String title)
    • storeAndGetTestChildPage

      public Page storeAndGetTestChildPage(Space pageSpace, Page parentPage, String title, String contentStatus, Page originalPage)
    • storeAndGetTestBlogPost

      public BlogPost storeAndGetTestBlogPost(Space blogPostSpace, String title)
    • storeAndGetTestBlogPost

      public BlogPost storeAndGetTestBlogPost(Space space, String title, String status)
    • storeAndGetTestBlogPost

      public BlogPost storeAndGetTestBlogPost(Space space, String title, String status, ConfluenceUser author)
    • storeAndGetTestBlogPost

      public BlogPost storeAndGetTestBlogPost()
    • storeAndGetTestBlogPost

      public BlogPost storeAndGetTestBlogPost(Space blogPostSpace)
    • storeAndGetTestComment

      public Comment storeAndGetTestComment(ContentEntityObject content)
    • storeAndGetTestSpace

      public Space storeAndGetTestSpace(String spaceName)
    • storeAndGetTestSpace

      public Space storeAndGetTestSpace(String spaceName, SpaceType spaceType)
    • storeAndGetTestSpace

      public Space storeAndGetTestSpace()
    • storeAndGetTestContent

      public Content storeAndGetTestContent(ContentType type) throws ServiceException
      Throws:
      ServiceException
    • storeAndGetTestPagesTx

      public List<Page> storeAndGetTestPagesTx(Space testSpace, int count)
      Creates pages in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      testSpace - the space that will contain the pages
      count - the number of pages to create
      Returns:
      a list of pages
    • storeAndGetTestPagesWithBodyOfSizeInMBTx

      public List<Page> storeAndGetTestPagesWithBodyOfSizeInMBTx(Space testSpace, int count, int bodyStringSizeInMB)
      Creates pages with body size mentioned in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      testSpace - the space that will contain the pages
      count - the number of pages to create
      Returns:
      a list of pages
    • storeAndGetTestBlogsTx

      public List<BlogPost> storeAndGetTestBlogsTx(Space testSpace, int count)
      Creates blogs in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      testSpace - the space that will contain the blogs
      count - the number of blogs to create
      Returns:
      a list of blogs
    • storeAndGetTestChildPagesTx

      public List<Page> storeAndGetTestChildPagesTx(Page parent, int count)
      Creates child pages in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      parent - the parent of the pages to create
      count - the number of pages to create
      Returns:
      a list of child pages
    • storeAndGetTestChildCommentsTx

      public List<Comment> storeAndGetTestChildCommentsTx(ContentEntityObject container, Comment parent, int count)
      Creates unresolved child comments in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      container - the content that will contain the comments
      parent - the parent comment of comments to create. Can be null, meaning the comments should be top-level.
      count - the number of comments to create
      Returns:
      a list of child comments
    • storeAndGetTestInlineCommentsTx

      public List<Comment> storeAndGetTestInlineCommentsTx(ContentEntityObject container, int count)
      Creates unresolved inline comments in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      container - the content that will contain the comments
      count - the number of comments to create
      Returns:
      a list of inline comments
    • storeAndGetTestResolvedCommentListTx

      public List<Comment> storeAndGetTestResolvedCommentListTx(Page container, int count)
      Creates resolved (page-level or inline) comments in a new transaction.

      Uses a transaction boundary so that subsequent calls can ensure the content exists in the DB, not just in the cache. This allows us to use other nested transactions, read-only transactions and so on while working with the data created here.

      Parameters:
      container - the content that will contain the comments
      count - the number of comments to create
      Returns:
      a list of resolved comments
    • storeAndGetPageAttachment

      public Attachment storeAndGetPageAttachment(ContentEntityObject container)
    • storeAndGetPageAttachment

      public Attachment storeAndGetPageAttachment(ContentEntityObject container, String attachmentName)
    • storeAndGetPageAttachmentVersion

      public Attachment storeAndGetPageAttachmentVersion(ContentEntityObject container, String attachmentName, Attachment originalAttachment)
    • create

      public void create(Page page)
    • update

      public <T extends AbstractPage> void update(T page, T original)
      Updates a page to save a new version.
    • forceNewVersion

      public <T extends AbstractPage> T forceNewVersion(T page)
      Saves a new version of a page, with no change to the page content.
    • update

      public Attachment update(Attachment attachment) throws IOException
      Throws:
      IOException
    • removeAllUsersExcept

      public void removeAllUsersExcept(Set<ConfluenceUser> usersToKeep)
    • removeAllSpaces

      public void removeAllSpaces()
    • removeAllPropertySets

      public void removeAllPropertySets()
    • removeAllTrackedNotifications

      public void removeAllTrackedNotifications()
    • removeAllLabels

      public void removeAllLabels()
    • removeAllNotifications

      public void removeAllNotifications()
    • removeAllLikes

      public void removeAllLikes()
    • removeAllPersonalInformation

      public void removeAllPersonalInformation()
    • trackSpace

      public Space trackSpace(Space space)
    • trackUser

      public ConfluenceUser trackUser(ConfluenceUser user)
    • trackNotification

      public Notification trackNotification(Notification notification)
    • trackAliasedKey

      public ConfluenceTrustedApplication trackAliasedKey(ConfluenceTrustedApplication storedApp)
    • trackSecrets

      public String trackSecrets(String key)
    • makeAdminUser

      public ConfluenceUser makeAdminUser()
    • makeAdminUser

      public ConfluenceUser makeAdminUser(String username, String name)
      Creates a user and puts it in the confluence-administrators group, which results in superuser permissions.
    • makeUser

      public ConfluenceUser makeUser(String username, String name)
      Creates a user with no special permissions or group memberships.
    • getGroup

      public Optional<com.atlassian.crowd.embedded.api.Group> getGroup(String groupName)
      See Also:
    • createGroup

      public com.atlassian.crowd.embedded.api.Group createGroup(String groupName)
      See Also:
    • addUserToGroup

      public void addUserToGroup(ConfluenceUser user, com.atlassian.crowd.embedded.api.Group group)
      See Also:
    • addGroupToGroup

      public void addGroupToGroup(com.atlassian.crowd.embedded.api.Group childGroup, com.atlassian.crowd.embedded.api.Group parentGroup)
      See Also:
    • enableNestedGroups

      public void enableNestedGroups(boolean enable)
    • removeUserFromGroup

      public void removeUserFromGroup(ConfluenceUser user, com.atlassian.crowd.embedded.api.Group group)
      See Also:
    • addGlobalPermissionToGroup

      public void addGlobalPermissionToGroup(String permission, String groupname)
    • addGlobalPermissionToUser

      public void addGlobalPermissionToUser(String permission, ConfluenceUser user)
    • enableGlobalUnlicensedAuthenticatedAccess

      public void enableGlobalUnlicensedAuthenticatedAccess()
      Enables global unlicensed access to Confluence, see ConfluenceAccessManager
    • disableGlobalUnlicenedAuthenticatedAccess

      public void disableGlobalUnlicenedAuthenticatedAccess()
    • enableUnlicensedAuthenticatedAccessForSpace

      public void enableUnlicensedAuthenticatedAccessForSpace(String spaceKey)
    • enableGlobalAnonymousAccess

      public void enableGlobalAnonymousAccess()
      Enables global anonymous access to Confluence, see ConfluenceAccessManager
    • disableGlobalAnonymousAccess

      public void disableGlobalAnonymousAccess()
    • grantUseConfluencePermission

      public void grantUseConfluencePermission(ConfluenceUser user)
      Grants SpacePermission.USE_CONFLUENCE_PERMISSION to a specific user, granting them licensed access to Confluence.
    • doInTransaction

      public <T> T doInTransaction(org.springframework.transaction.support.TransactionCallback<T> callback)
    • storeAndGetAliasedKey

      public AliasedKey storeAndGetAliasedKey(String alias)
    • storeAndGetApplication

      public com.atlassian.crowd.model.application.Application storeAndGetApplication(String applicationName, com.atlassian.crowd.model.application.ApplicationType applicationType)
    • storeAndGetApplication

      public com.atlassian.crowd.model.application.Application storeAndGetApplication(String applicationName)
    • storeAndGetNotification

      public Notification storeAndGetNotification(Space space)
    • storeAndGetNotification

      public Notification storeAndGetNotification()
    • storeAndGetSecrets

      public Secrets storeAndGetSecrets(String key, String value)
    • removeAllTrackedSecrets

      public void removeAllTrackedSecrets()
    • storeCrowdSyncToken

      public void storeCrowdSyncToken(ConfluenceUser user, String token)
    • trash

      public boolean trash(String spaceKey, long contentId)