Class CQAssert
- java.lang.Object
-
- com.adobe.cq.testing.junit.assertion.CQAssert
-
public class CQAssert extends Object
Contains CQ specific Asserts for testing.
-
-
Constructor Summary
Constructors Constructor Description CQAssert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertAssetExists(CQClient client, String path, InputStream fileData, String mimeType)Tests if a Asset exists at the location {code}path{code}.static voidassertCQPageExistsWithTimeout(CQClient client, String path, long timeout, long delay)Tests if the page at {code}path{code} exists on the server connected by {code}client{code} and is a valid CQ Page.static voidassertFileExists(CQClient client, String path, InputStream fileData, String mimeType)Tests if a File exists at the location {code}path{code}.static voidassertFolderExists(CQClient client, String path, String folderTitle)Tests if a folder exists at the location {code}path{code} with named {code}folderTitle{code}.static voidassertIsBluePrint(CQClient client, String path)static voidassertIsCQPage(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 existsstatic voidassertIsLiveSite(CQClient client, String newPath, String masterPath)static voidassertIsVersionList(CQClient client, String jsonString)static voidassertIsVersionTree(CQClient client, String jsonString)static voidassertPathDoesNotExistWithTimeout(CQClient client, String path, long timeout, long delay)
-
-
-
Method Detail
-
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 pagetimeout- 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
- Throws:
InterruptedException
-
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 pagepath- Location of the page
-
assertIsLiveSite
public static void assertIsLiveSite(CQClient client, String newPath, String masterPath)
-
-