mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
Try to fix tests - race condition
This commit is contained in:
@@ -43,6 +43,7 @@ public class TransformRegistryRefreshTest
|
||||
@Test
|
||||
public void checkRegistryRefreshes() throws InterruptedException
|
||||
{
|
||||
waitForRegistryReady(1000);
|
||||
assertEquals(4, transformRegistry.getTransformConfig().getTransformers().size());
|
||||
verify(transformRegistry, atLeast(1)).retrieveConfig();
|
||||
|
||||
@@ -56,4 +57,18 @@ public class TransformRegistryRefreshTest
|
||||
verify(transformRegistry, atLeast(1+2)).retrieveConfig();
|
||||
assertEquals(6, transformRegistry.getTransformConfig().getTransformers().size());
|
||||
}
|
||||
|
||||
private void waitForRegistryReady(int timeout) throws InterruptedException
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
while (!transformRegistry.isReadyForTransformRequests())
|
||||
{
|
||||
if (System.currentTimeMillis()-start > timeout)
|
||||
{
|
||||
throw new IllegalStateException("Registry is still not ready after "+timeout+" ms");
|
||||
}
|
||||
Thread.sleep(100);
|
||||
}
|
||||
System.out.println("Registry ready after "+(System.currentTimeMillis()-start)+" ms");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user