Merged V2.1 to HEAD

6486: Fix for AWC-1134 (Made minimum length for username and password configurable)
   6487: Added "copy.verbose" property to build script to list all files being copied in the 'deploy-tomcat-exploded' and 'deploy-webclient-changes' targets
   6488: Changed default CIFS server to remove underscore as it can cause problems with OpenOffice.
   6489: Fix for WCM-498 (Expired items that are deleted are not represented as such in the change request dialog or submit dialog)
   6490: Fix for WCM-446 and WCM-624. Multi-select and All operations in Modified Files list respect items in workflow and ignore them.
   6491: Fixes profoundly brain dead behavior in AVMLockingService.init().
   6492: Refactoring of LookupCache to be clustering compatible
   6493: Staging and locking changes
   6494: WCM Revert action moved to end of all action lists to avoid accidently clicking it (as it has no confirmation screen!)
   6496: Fixes for WCM-746 and WCM-747 - Edit File Properties and Edit Folder Properties working correctly again for AVM objects.
   6497: Enable virtualization server to be (re)started at any point prior or during the startup of the alfresco webapp (fixes WCM-750).
   6498: WCM-742 - moving locks from the preview sandbox to the main user sandbox.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6739 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 23:15:37 +00:00
parent 7a522e4b88
commit 1b272d6766
17 changed files with 1011 additions and 1224 deletions

View File

@@ -347,136 +347,6 @@ public class AVMServiceTest extends AVMServiceTestBase
}
/**
* Test async indexing.
* @throws Exception
*/
public void testAsyncIndex() throws Exception
{
// Make sure the slate is clean ...
UserTransaction tx = fTransactionService.getUserTransaction();
tx.begin();
if(fService.getStore("avmAsynchronousTest") != null)
{
assertTrue(fIndexingInterceptor.hasIndexBeenCreated("avmAsynchronousTest"));
fService.purgeStore("avmAsynchronousTest");
assertTrue(fIndexingInterceptor.hasIndexBeenCreated("avmAsynchronousTest"));
assertFalse(fIndexingInterceptor.hasIndexBeenCreated("bananaStoreWoof"));
}
else
{
assertFalse(fIndexingInterceptor.hasIndexBeenCreated("avmAsynchronousTest"));
}
StoreRef storeRef = AVMNodeConverter.ToStoreRef("avmAsynchronousTest");
Indexer indexer = fIndexerAndSearcher.getIndexer(storeRef);
if(indexer instanceof AVMLuceneIndexer)
{
AVMLuceneIndexer avmIndexer = (AVMLuceneIndexer)indexer;
avmIndexer.deleteIndex("avmAsynchronousTest", IndexMode.SYNCHRONOUS);
}
tx.commit();
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(-1, fIndexingInterceptor.getLastIndexedSnapshot("bananaStoreWoof"));
assertEquals(-1, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
tx.commit();
// TODO: Suspend and resume indexing in case we are really unlucky and hit an index before we expect it.
SearchService searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
ResultSet results;
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(0, results.length());
results.close();
fService.createStore("avmAsynchronousTest");
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(0, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
tx.commit();
fService.createSnapshot("avmAsynchronousTest", null, null);
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(0, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
tx.commit();
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(1, results.length());
results.close();
fService.createDirectory("avmAsynchronousTest:/", "a");
fService.createDirectory("avmAsynchronousTest:/a", "b");
fService.createDirectory("avmAsynchronousTest:/a/b", "c");
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(0, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDate("avmAsynchronousTest"));
tx.commit();
fService.createSnapshot("avmAsynchronousTest", null, null);
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(1, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDate("avmAsynchronousTest"));
assertFalse(fIndexingInterceptor.isIndexUpToDateAndSearchable("avmAsynchronousTest"));
assertEquals(IndexMode.ASYNCHRONOUS, fIndexingInterceptor.getIndexMode("avmAsynchronousTest"));
assertEquals(IndexMode.SYNCHRONOUS, fIndexingInterceptor.getIndexMode("main"));
assertTrue(fIndexingInterceptor.isSnapshotIndexed("avmAsynchronousTest", 0));
assertTrue(fIndexingInterceptor.isSnapshotIndexed("avmAsynchronousTest", 1));
assertFalse(fIndexingInterceptor.isSnapshotIndexed("avmAsynchronousTest", 2));
tx.commit();
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(1, results.length());
results.close();
Thread.sleep(180000);
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(4, results.length());
results.close();
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(1, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDate("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDateAndSearchable("avmAsynchronousTest"));
tx.commit();
fService.purgeStore("avmAsynchronousTest");
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(0, results.length());
results.close();
fService.createStore("avmAsynchronousTest");
fService.createSnapshot("avmAsynchronousTest", null, null);
fService.createDirectory("avmAsynchronousTest:/", "a");
fService.createDirectory("avmAsynchronousTest:/a", "b");
fService.createDirectory("avmAsynchronousTest:/a/b", "c");
fService.createSnapshot("avmAsynchronousTest", null, null);
fService.purgeStore("avmAsynchronousTest");
fService.createStore("avmAsynchronousTest");
fService.createSnapshot("avmAsynchronousTest", null, null);
fService.createDirectory("avmAsynchronousTest:/", "a");
fService.createDirectory("avmAsynchronousTest:/a", "b");
fService.createDirectory("avmAsynchronousTest:/a/b", "c");
fService.createSnapshot("avmAsynchronousTest", null, null);
Thread.sleep(180000);
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(4, results.length());
results.close();
}
public void testForceCopyDeleted()
{
@@ -537,8 +407,16 @@ public class AVMServiceTest extends AVMServiceTestBase
fService.createBranch(1, "layer:/root", "branch:/", "branch");
fService.createSnapshot("branch", null, null);
fService.getFileOutputStream("main:/a/b/c/foo").close();
System.out.println("main 1");
System.out.println(recursiveList("main", 1, true));
System.out.println("branch 1");
System.out.println(recursiveList("branch", 1, true));
assertEquals(fService.lookup(1, "main:/a/b/c/foo").getId(), fService.lookup(1,
"branch:/branch/layer/b/c/foo").getId());
System.out.println("main -1");
System.out.println(recursiveList("main", -1, true));
System.out.println("branch -1");
System.out.println(recursiveList("branch", -1, true));
assertEquals(fService.lookup(-1, "main:/a/b/c/foo").getId(), fService.lookup(-1,
"branch:/branch/layer/b/c/foo").getId());
}
@@ -5641,4 +5519,135 @@ public class AVMServiceTest extends AVMServiceTestBase
fail();
}
}
/**
* Test async indexing.
* @throws Exception
*/
public void testAsyncIndex() throws Exception
{
// Make sure the slate is clean ...
UserTransaction tx = fTransactionService.getUserTransaction();
tx.begin();
if(fService.getStore("avmAsynchronousTest") != null)
{
assertTrue(fIndexingInterceptor.hasIndexBeenCreated("avmAsynchronousTest"));
fService.purgeStore("avmAsynchronousTest");
assertTrue(fIndexingInterceptor.hasIndexBeenCreated("avmAsynchronousTest"));
assertFalse(fIndexingInterceptor.hasIndexBeenCreated("bananaStoreWoof"));
}
else
{
assertFalse(fIndexingInterceptor.hasIndexBeenCreated("avmAsynchronousTest"));
}
StoreRef storeRef = AVMNodeConverter.ToStoreRef("avmAsynchronousTest");
Indexer indexer = fIndexerAndSearcher.getIndexer(storeRef);
if(indexer instanceof AVMLuceneIndexer)
{
AVMLuceneIndexer avmIndexer = (AVMLuceneIndexer)indexer;
avmIndexer.deleteIndex("avmAsynchronousTest", IndexMode.SYNCHRONOUS);
}
tx.commit();
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(-1, fIndexingInterceptor.getLastIndexedSnapshot("bananaStoreWoof"));
assertEquals(-1, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
tx.commit();
// TODO: Suspend and resume indexing in case we are really unlucky and hit an index before we expect it.
SearchService searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
ResultSet results;
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(0, results.length());
results.close();
fService.createStore("avmAsynchronousTest");
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(0, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
tx.commit();
fService.createSnapshot("avmAsynchronousTest", null, null);
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(0, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
tx.commit();
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(1, results.length());
results.close();
fService.createDirectory("avmAsynchronousTest:/", "a");
fService.createDirectory("avmAsynchronousTest:/a", "b");
fService.createDirectory("avmAsynchronousTest:/a/b", "c");
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(0, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDate("avmAsynchronousTest"));
tx.commit();
fService.createSnapshot("avmAsynchronousTest", null, null);
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(1, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDate("avmAsynchronousTest"));
assertFalse(fIndexingInterceptor.isIndexUpToDateAndSearchable("avmAsynchronousTest"));
assertEquals(IndexMode.ASYNCHRONOUS, fIndexingInterceptor.getIndexMode("avmAsynchronousTest"));
assertEquals(IndexMode.SYNCHRONOUS, fIndexingInterceptor.getIndexMode("main"));
assertTrue(fIndexingInterceptor.isSnapshotIndexed("avmAsynchronousTest", 0));
assertTrue(fIndexingInterceptor.isSnapshotIndexed("avmAsynchronousTest", 1));
assertFalse(fIndexingInterceptor.isSnapshotIndexed("avmAsynchronousTest", 2));
tx.commit();
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(1, results.length());
results.close();
Thread.sleep(180000);
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(4, results.length());
results.close();
tx = fTransactionService.getUserTransaction();
tx.begin();
assertEquals(1, fIndexingInterceptor.getLastIndexedSnapshot("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDate("avmAsynchronousTest"));
assertTrue(fIndexingInterceptor.isIndexUpToDateAndSearchable("avmAsynchronousTest"));
tx.commit();
fService.purgeStore("avmAsynchronousTest");
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(0, results.length());
results.close();
fService.createStore("avmAsynchronousTest");
fService.createSnapshot("avmAsynchronousTest", null, null);
fService.createDirectory("avmAsynchronousTest:/", "a");
fService.createDirectory("avmAsynchronousTest:/a", "b");
fService.createDirectory("avmAsynchronousTest:/a/b", "c");
fService.createSnapshot("avmAsynchronousTest", null, null);
fService.purgeStore("avmAsynchronousTest");
fService.createStore("avmAsynchronousTest");
fService.createSnapshot("avmAsynchronousTest", null, null);
fService.createDirectory("avmAsynchronousTest:/", "a");
fService.createDirectory("avmAsynchronousTest:/a", "b");
fService.createDirectory("avmAsynchronousTest:/a/b", "c");
fService.createSnapshot("avmAsynchronousTest", null, null);
Thread.sleep(180000);
results = searchService.query(storeRef, "lucene", "PATH:\"//.\"");
assertEquals(4, results.length());
results.close();
}
}