mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
10953: Merged V2.1 to V2.2 10904: AVM - add test suite wrapper, update existing tests to purge test stores (rather than all stores) 10909: AVM - unit test updates only (exposed further tests via test suite) 10947: AVM - unit test update only (extra checks) 10969: Merged V2.1 to V2.2 (cont) 10904: AVM - add test suite wrapper, update existing tests to purge test stores (rather than all stores) 11054: Fixed blind failures in AVM unit tests 11064: AVM - unit test error handling 11068: Temporarily remove AvmTestSuite from the build 11074: AVM - unit tests - added error stack on concurrency tests (to show failure in build output), removed 1 hour freeze, put back AVM test suite 11218: Merged V2.1 to V2.2 11217: AVM - unit test fix ("n must be positive") git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11224 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,23 +36,60 @@ import org.alfresco.repo.avm.util.BulkLoader;
|
||||
*/
|
||||
public class AVMCrawlTestP extends AVMServiceTestBase
|
||||
{
|
||||
/**
|
||||
* Do the crawl test.
|
||||
*/
|
||||
public void testCrawl()
|
||||
public void testCrawlA()
|
||||
{
|
||||
testCrawl(1,
|
||||
"source/java/org/alfresco/repo/avm/actions", // relative from .../repository
|
||||
1,
|
||||
30000); // 30 secs
|
||||
}
|
||||
|
||||
public void testCrawlB()
|
||||
{
|
||||
testCrawl(2,
|
||||
"source/java/org/alfresco/repo/avm", // relative from .../repository
|
||||
2,
|
||||
30000); // 30 secs
|
||||
}
|
||||
|
||||
/*
|
||||
public void xtestCrawlZ()
|
||||
{
|
||||
testCrawl(8,
|
||||
"source", // relative from .../repository
|
||||
2,
|
||||
28800000); // 8 hours
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Do the crawl test
|
||||
*
|
||||
* @param n Number of threads
|
||||
* @param fsPath The path in the filesystem to load (tree of stuff) from
|
||||
* @param m How many multiples of content to start with
|
||||
* @param runTime Min run time (in msecs)
|
||||
*/
|
||||
private void testCrawl(int n, String fsPath, int m, long runTime)
|
||||
{
|
||||
int n = 8; // Number of Threads.
|
||||
int m = 2; // How many multiples of content to start with.
|
||||
try
|
||||
{
|
||||
long runTime = 28800000; // 8 Hours. .
|
||||
fService.purgeStore("main");
|
||||
if (m < 1)
|
||||
{
|
||||
fail("Must have at least one 1 copy of content");
|
||||
}
|
||||
|
||||
if (fService.getStore("main") != null)
|
||||
{
|
||||
fService.purgeStore("main");
|
||||
}
|
||||
|
||||
BulkLoader loader = new BulkLoader();
|
||||
loader.setAvmService(fService);
|
||||
for (int i = 0; i < m; i++)
|
||||
{
|
||||
fService.createStore("d" + i);
|
||||
loader.recursiveLoad("source", "d" + i + ":/");
|
||||
loader.recursiveLoad(fsPath, "d" + i + ":/");
|
||||
fService.createSnapshot("d" + i, null, null);
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
@@ -89,7 +126,8 @@ public class AVMCrawlTestP extends AVMServiceTestBase
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
fail();
|
||||
//fail();
|
||||
System.err.println("Crawler error");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,18 +157,40 @@ public class AVMCrawlTestP extends AVMServiceTestBase
|
||||
}
|
||||
}
|
||||
long ops = 0L;
|
||||
int errorCnt = 0;
|
||||
for (AVMCrawler crawler : crawlers)
|
||||
{
|
||||
ops += crawler.getOpCount();
|
||||
errorCnt += (crawler.getError() ? 1 : 0);
|
||||
}
|
||||
|
||||
long time = System.currentTimeMillis() - startTime;
|
||||
System.out.println("Ops/Sec: " + (ops * 1000L / time));
|
||||
|
||||
if (errorCnt > 0)
|
||||
{
|
||||
StringBuffer errorStack = new StringBuffer();
|
||||
errorStack.append("Crawler errors: ").append(errorCnt).append(" out of ").append(crawlers.size()).append(" are in error state");
|
||||
|
||||
for (AVMCrawler crawler : crawlers)
|
||||
{
|
||||
if (crawler.getError())
|
||||
{
|
||||
errorStack.append("\n\n").append(crawler.getErrorStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
fail(errorStack.toString());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
for (int i = 0; i < m; i++)
|
||||
{
|
||||
if (fService.getStore("d" + i) != null) { fService.purgeStore("d" + i); }
|
||||
if (fService.getStore("d" + i) != null)
|
||||
{
|
||||
fService.purgeStore("d" + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user