AVMLockingAwareService does not take out locks for operations on staging.

AVMLockingAwareService does not take out locks on Directories.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6072 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park 2007-06-22 17:35:37 +00:00
parent 3f107708f8
commit 838e14cc85
3 changed files with 17 additions and 12 deletions

View File

@ -821,8 +821,18 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
private void grabLock(String path)
{
AVMNodeDescriptor desc = fService.lookup(-1, path, false);
if (desc != null && desc.isDirectory())
{
return;
}
String[] storePath = splitPath(path);
String webProject = getWebProject(storePath[0]);
if (webProject != null && webProject.equals(storePath[0]))
{
// Don't do locking in staging.
return;
}
if (webProject != null)
{
String userName = fAuthenticationService.getCurrentUserName();

View File

@ -108,7 +108,6 @@ public class AVMServiceTest extends AVMServiceTestBase
{
AVMService oldService = fService;
fService = (AVMService)fContext.getBean("AVMLockingAwareService");
AVMLockingService lockingService = (AVMLockingService)fContext.getBean("AVMLockingService");
AuthenticationService authService = (AuthenticationService)fContext.getBean("AuthenticationService");
try
{
@ -119,18 +118,9 @@ public class AVMServiceTest extends AVMServiceTestBase
new PropertyValue(QName.createQName(null, "silly"), "Nothing."));
setupBasicTree0();
authService.authenticateAsGuest();
assertEquals(2, lockingService.getUsersLocks("admin").size());
assertEquals(0, fLockingService.getUsersLocks("admin").size());
List<AVMDifference> diffs = fSyncService.compare(-1, "main:/", -1, "test:/", null);
fSyncService.update(diffs, null, false, false, false, false, null, null);
try
{
fService.getFileOutputStream("test:/a/b/c/foo").close();
fail("Shouldn't be able to lock.");
}
catch (AVMLockingException ale)
{
// Do nothing. Success.
}
}
catch (Exception e)
{
@ -140,7 +130,7 @@ public class AVMServiceTest extends AVMServiceTestBase
finally
{
fService = oldService;
lockingService.removeWebProject("main");
fLockingService.removeWebProject("main");
authService.authenticate("admin", "admin".toCharArray());
}
}

View File

@ -36,6 +36,7 @@ import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentWriter;
@ -84,6 +85,8 @@ public class AVMServiceTestBase extends TestCase
protected static IndexerAndSearcher fIndexerAndSearcher;
protected static AVMLockingService fLockingService;
/**
* Setup for AVM tests. Note that we set the polling
* interval for the reaper to 4 seconds so that tests will
@ -100,6 +103,7 @@ public class AVMServiceTestBase extends TestCase
fSyncService = (AVMSyncService)fContext.getBean("AVMSyncService");
fIndexerAndSearcher = (IndexerAndSearcher)fContext.getBean("indexerAndSearcherFactory");
fTransactionService = (TransactionService)fContext.getBean("transactionComponent");
fLockingService = (AVMLockingService)fContext.getBean("AVMLockingService");
AuthenticationService authService = (AuthenticationService)fContext.getBean("AuthenticationService");
authService.authenticate("admin", "admin".toCharArray());
CreateStoreTxnListener cstl = (CreateStoreTxnListener)fContext.getBean("createStoreTxnListener");
@ -144,6 +148,7 @@ public class AVMServiceTestBase extends TestCase
);
}
fService.createStore("main");
fLockingService.addWebProject("main");
fStartTime = System.currentTimeMillis();
}