mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
ACS-4177 Improve rendition API tests retry logic (#1692)
This commit is contained in:
@@ -542,8 +542,8 @@ public class Node extends ModelRequest<Node>
|
||||
renditionId);
|
||||
RestResponse response = restWrapper.process(request);
|
||||
int retry = 0;
|
||||
//Multiplied by '4' because AI rendition test cases need more time (~30 seconds) - see ACS-2158
|
||||
while (Integer.valueOf(response.getStatusCode()).equals(HttpStatus.NOT_FOUND.value()) && retry < (4 * Utility.retryCountSeconds))
|
||||
//Multiplied by '8' because AI rendition test cases need more time (~30 seconds) - see ACS-2158
|
||||
while (!Integer.valueOf(response.getStatusCode()).equals(HttpStatus.OK.value()) && retry < (8 * Utility.retryCountSeconds))
|
||||
{
|
||||
Utility.waitToLoopTime(1);
|
||||
response = restWrapper.process(request);
|
||||
|
@@ -44,20 +44,20 @@ public abstract class RenditionIntegrationTests extends RestTest
|
||||
// 2. Create a rendition of the file using RESTAPI
|
||||
restClient.withCoreAPI().usingNode(file).createNodeRendition(renditionId);
|
||||
Assert.assertEquals(Integer.valueOf(restClient.getStatusCode()).intValue(), HttpStatus.ACCEPTED.value(),
|
||||
"Failed to submit a request for rendition. [" + fileName+ ", " + renditionId+"] [source file, rendition ID]. ");
|
||||
"Failed to submit a request for rendition. [" + fileName + ", " + nodeId + ", " + renditionId + "] [source file, node ID, rendition ID]");
|
||||
|
||||
// 3. Verify that a rendition of the file is created and has content using RESTAPI
|
||||
RestResponse restResponse = restClient.withCoreAPI().usingNode(file).getNodeRenditionContentUntilIsCreated(renditionId);
|
||||
Assert.assertEquals(Integer.valueOf(restClient.getStatusCode()).intValue(), HttpStatus.OK.value(),
|
||||
"Failed to produce rendition. [" + fileName+ ", " + renditionId+"] [source file, rendition ID] ");
|
||||
"Failed to produce rendition. [" + fileName + ", " + nodeId + ", " + renditionId + "] [source file, node ID, rendition ID]");
|
||||
|
||||
// 4. Check the returned content type
|
||||
Assert.assertEquals(restClient.getResponseHeaders().getValue("Content-Type"), expectedMimeType+";charset=UTF-8",
|
||||
"Rendition was created but it has the wrong Content-Type. [" + fileName+ ", " + renditionId + "] [source file, rendition ID]");
|
||||
"Rendition was created but it has the wrong Content-Type. [" + fileName+ ", " + nodeId + ", " + renditionId + "] [source file, node ID, rendition ID]");
|
||||
|
||||
|
||||
Assert.assertTrue((restResponse.getResponse().body().asInputStream().available() > 0),
|
||||
"Rendition was created but its content is empty. [" + fileName+ ", " + renditionId+"] [source file, rendition ID] ");
|
||||
"Rendition was created but its content is empty. [" + fileName + ", " + nodeId + ", " + renditionId + "] [source file, node ID, rendition ID]");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user