Class CQAssert

java.lang.Object
com.adobe.cq.testing.junit.assertion.CQAssert

public class CQAssert extends Object
Contains CQ specific Asserts for testing.
  • Constructor Details

    • CQAssert

      public CQAssert()
  • Method Details

    • assertCQPageExistsWithTimeout

      public static void assertCQPageExistsWithTimeout(CQClient client, String path, long timeout, long delay) throws InterruptedException
      Tests if the page at {code}path{code} exists on the server connected by {code}client{code} and is a valid CQ Page. It does this by requesting the JSON tree of the page node, verifying if it has all needed properties and subnodes of CQ Page.

      To do this it tries to reach the page for {code}timeout{code} milliseconds with {code}waitInterval{code} milliseconds pause between each request.
      Parameters:
      client - The client used for requesting the page.
      path - The path to the page
      timeout - How long we should try to reach the page in milliseconds.
      delay - Time between request retries in milliseconds.
      Throws:
      InterruptedException - to mark this method as waiting
    • assertPathDoesNotExistWithTimeout

      public static void assertPathDoesNotExistWithTimeout(CQClient client, String path, long timeout, long delay) throws InterruptedException
      Tests if the {code}path{code} does not exist on the server connected by {code}client{code}.
      To do this it tries to reach the page for {code}timeout{code} milliseconds with {code}waitInterval{code} milliseconds pause between each request.
      Parameters:
      client - The client used for requesting the page.
      path - The path to the page
      timeout - How long we should try to reach the page in milliseconds.
      delay - Time between request retries in milliseconds.
      Throws:
      InterruptedException - to mark this method as waiting
    • assertPathExistWithTimeout

      public static void assertPathExistWithTimeout(CQClient client, String path, long timeout, long delay) throws InterruptedException
      Tests if the {code}path{code} exists on the server connected by {code}client{code}.
      To do this it tries to reach the page for {code}timeout{code} milliseconds with {code}waitInterval{code} milliseconds pause between each request.
      Parameters:
      client - The client used for requesting the page.
      path - The path to the page
      timeout - How long we should try to reach the page in milliseconds.
      delay - Time between request retries in milliseconds.
      Throws:
      InterruptedException - to mark this method as waiting
    • assertFolderExists

      public static void assertFolderExists(CQClient client, String path, String folderTitle)
      Tests if a folder exists at the location {code}path{code} with named {code}folderTitle{code}. It verifies by requesting the json output of the node and verifying that all nodes and properties are properly created.
      Parameters:
      client - The client used to request the json for the folder node.
      path - Path to the folder in question.
      folderTitle - Title of the folder to verify.
    • assertFileExists

      public static void assertFileExists(CQClient client, String path, InputStream fileData, String mimeType)
      Tests if a File exists at the location {code}path{code}. It verifies by requesting the json output of the node and verifying that all nodes and properties are properly created.

      It also makes a binary compare between the original file data and the requested file.
      Parameters:
      client - The client used to request the json for the folder node.
      path - Path to the file in question.
      fileData - The file's contents that were uploaded.
      mimeType - file mime type
    • assertAssetExists

      public static void assertAssetExists(CQClient client, String path, InputStream fileData, String mimeType)
      Tests if a Asset exists at the location {code}path{code}. It verifies by requesting the json output of the node and verifying that all nodes and properties are properly created.

      It also makes a binary compare between the original file data and the requested rendition named {code}original{code}.

      NOTE: This assert makes no assumptions about the type of the uploaded file (image, pdf, etc) so it only verifies if the {code}Metadata{code} node and {code}renditions{code} folder was created. It does not verify extracted Metadata or check what renditions have been created. The only rendition verified is the one named {code}original{code} through binary compare with the original file.
      Parameters:
      client - The client used to request the json for the folder node.
      path - Path to the asset in question.
      fileData - The file's contents that were uploaded.
      mimeType - file mime type
    • assertIsCQPage

      public static void assertIsCQPage(CQClient client, String path)
      Verifies if a page is really a CQ page by checking for specific nodes and properties:
      • {code}jcr:primaryType{code} is set to {code}cq:Page{code}
      • {code}jcr:content{code} node exists
      Parameters:
      client - The client used to doGet the JSON of the page
      path - Location of the page
    • assertIsLiveSite

      public static void assertIsLiveSite(CQClient client, String newPath, String masterPath)
    • assertIsBluePrint

      public static void assertIsBluePrint(CQClient client, String path)
    • assertIsVersionList

      public static void assertIsVersionList(CQClient client, String jsonString)
    • assertIsVersionTree

      public static void assertIsVersionTree(CQClient client, String jsonString)