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:
Jamal Kaabi-Mofrad
2016-05-10 11:28:14 +00:00
parent d310207b05
commit c1d3421cc8
5 changed files with 244 additions and 29 deletions

View File

@@ -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)