mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
AVM unit test improvements
- ensure AVMServiceTest.testSetup can run after AVMServicePermissionsTest.* - include avm/**/*TestP.java (as per AVMTestSuite, until re-introduced) - allow PurgeTestP to fail (if orphanReaper does not finish in max cycles) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19056 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.avm.util.BulkLoader;
|
||||
|
||||
/**
|
||||
@@ -47,20 +48,8 @@ public class PurgeTestP extends AVMServiceTestBase
|
||||
fService.createSnapshot("main", null, null);
|
||||
System.err.println("Load time + snapshot: " + (System.currentTimeMillis() - start) + "ms");
|
||||
fService.purgeVersion(2, "main");
|
||||
fReaper.activate();
|
||||
while (fReaper.isActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.print(".");
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
System.out.println("\nReaper finished");
|
||||
|
||||
runOrphanReaper();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -97,20 +86,8 @@ public class PurgeTestP extends AVMServiceTestBase
|
||||
|
||||
fService.createSnapshot("main", null, null);
|
||||
fService.purgeVersion(2, "main");
|
||||
fReaper.activate();
|
||||
while (fReaper.isActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.print(".");
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
System.out.println("\nReaper finished");
|
||||
|
||||
runOrphanReaper();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -151,20 +128,8 @@ public class PurgeTestP extends AVMServiceTestBase
|
||||
|
||||
fService.createSnapshot("main", null, null);
|
||||
fService.purgeStore("main");
|
||||
fReaper.activate();
|
||||
while (fReaper.isActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.print(".");
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
System.out.println("\nReaper finished");
|
||||
|
||||
runOrphanReaper();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -172,4 +137,34 @@ public class PurgeTestP extends AVMServiceTestBase
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void runOrphanReaper()
|
||||
{
|
||||
fReaper.activate();
|
||||
|
||||
final int maxCycles = 50;
|
||||
|
||||
int cycles = 0;
|
||||
while (fReaper.isActive() && (cycles <= maxCycles))
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.print(".");
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
cycles++;
|
||||
}
|
||||
|
||||
if (cycles > maxCycles)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Orphan reaper still active - failed to clean orphans in "+cycles+" cycles (max "+maxCycles+")");
|
||||
}
|
||||
|
||||
System.out.println("\nReaper finished (in "+cycles+" cycles)");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user