Merged HEAD (5.2) to 5.2.N (5.2.1)

126556 jkaabimofrad: 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/BRANCHES/DEV/5.2.N/root@126902 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 12:08:24 +00:00
parent 061e6a1662
commit e212513df3
5 changed files with 244 additions and 29 deletions

View File

@@ -428,6 +428,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();
@@ -451,27 +476,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)