mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
124269 jvonka: RA-834: Optionally request generation of a rendition on content creation (eg. file upload) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126556 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -421,6 +421,31 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
protected static final long PAUSE_TIME = 5000; //millisecond
|
||||
protected static final int MAX_RETRY = 10;
|
||||
|
||||
protected Rendition waitAndGetRendition(String userId, String sourceNodeId, String renditionId) throws Exception
|
||||
{
|
||||
int retryCount = 0;
|
||||
while (retryCount < MAX_RETRY)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpResponse response = getSingle(getNodeRenditionsUrl(sourceNodeId), userId, renditionId, 200);
|
||||
Rendition rendition = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Rendition.class);
|
||||
assertNotNull(rendition);
|
||||
assertEquals(Rendition.RenditionStatus.CREATED, rendition.getStatus());
|
||||
return rendition;
|
||||
}
|
||||
catch (AssertionError ex)
|
||||
{
|
||||
// If the asynchronous create rendition action is not finished yet,
|
||||
// wait for 'PAUSE_TIME' and try again.
|
||||
retryCount++;
|
||||
Thread.sleep(PAUSE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Rendition createAndGetRendition(String userId, String sourceNodeId, String renditionId) throws Exception
|
||||
{
|
||||
Rendition renditionRequest = new Rendition();
|
||||
@@ -444,27 +469,7 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
}
|
||||
}
|
||||
|
||||
retryCount = 0;
|
||||
while (retryCount < MAX_RETRY)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpResponse response = getSingle(getNodeRenditionsUrl(sourceNodeId), userId, renditionId, 200);
|
||||
Rendition rendition = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Rendition.class);
|
||||
assertNotNull(rendition);
|
||||
assertEquals(Rendition.RenditionStatus.CREATED, rendition.getStatus());
|
||||
return rendition;
|
||||
}
|
||||
catch (AssertionError ex)
|
||||
{
|
||||
// If the asynchronous create rendition action is not finished yet,
|
||||
// wait for 'PAUSE_TIME' and try again.
|
||||
retryCount++;
|
||||
Thread.sleep(PAUSE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return waitAndGetRendition(userId, sourceNodeId, renditionId);
|
||||
}
|
||||
|
||||
protected String getNodeRenditionsUrl(String nodeId)
|
||||
|
Reference in New Issue
Block a user