mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
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:
parent
3f107708f8
commit
838e14cc85
@ -821,8 +821,18 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
|
|||||||
|
|
||||||
private void grabLock(String path)
|
private void grabLock(String path)
|
||||||
{
|
{
|
||||||
|
AVMNodeDescriptor desc = fService.lookup(-1, path, false);
|
||||||
|
if (desc != null && desc.isDirectory())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
String[] storePath = splitPath(path);
|
String[] storePath = splitPath(path);
|
||||||
String webProject = getWebProject(storePath[0]);
|
String webProject = getWebProject(storePath[0]);
|
||||||
|
if (webProject != null && webProject.equals(storePath[0]))
|
||||||
|
{
|
||||||
|
// Don't do locking in staging.
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (webProject != null)
|
if (webProject != null)
|
||||||
{
|
{
|
||||||
String userName = fAuthenticationService.getCurrentUserName();
|
String userName = fAuthenticationService.getCurrentUserName();
|
||||||
|
@ -108,7 +108,6 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
{
|
{
|
||||||
AVMService oldService = fService;
|
AVMService oldService = fService;
|
||||||
fService = (AVMService)fContext.getBean("AVMLockingAwareService");
|
fService = (AVMService)fContext.getBean("AVMLockingAwareService");
|
||||||
AVMLockingService lockingService = (AVMLockingService)fContext.getBean("AVMLockingService");
|
|
||||||
AuthenticationService authService = (AuthenticationService)fContext.getBean("AuthenticationService");
|
AuthenticationService authService = (AuthenticationService)fContext.getBean("AuthenticationService");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -119,18 +118,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
new PropertyValue(QName.createQName(null, "silly"), "Nothing."));
|
new PropertyValue(QName.createQName(null, "silly"), "Nothing."));
|
||||||
setupBasicTree0();
|
setupBasicTree0();
|
||||||
authService.authenticateAsGuest();
|
authService.authenticateAsGuest();
|
||||||
assertEquals(2, lockingService.getUsersLocks("admin").size());
|
assertEquals(0, fLockingService.getUsersLocks("admin").size());
|
||||||
List<AVMDifference> diffs = fSyncService.compare(-1, "main:/", -1, "test:/", null);
|
List<AVMDifference> diffs = fSyncService.compare(-1, "main:/", -1, "test:/", null);
|
||||||
fSyncService.update(diffs, null, false, false, false, false, null, 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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -140,7 +130,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
fService = oldService;
|
fService = oldService;
|
||||||
lockingService.removeWebProject("main");
|
fLockingService.removeWebProject("main");
|
||||||
authService.authenticate("admin", "admin".toCharArray());
|
authService.authenticate("admin", "admin".toCharArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
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.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
@ -84,6 +85,8 @@ public class AVMServiceTestBase extends TestCase
|
|||||||
|
|
||||||
protected static IndexerAndSearcher fIndexerAndSearcher;
|
protected static IndexerAndSearcher fIndexerAndSearcher;
|
||||||
|
|
||||||
|
protected static AVMLockingService fLockingService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup for AVM tests. Note that we set the polling
|
* Setup for AVM tests. Note that we set the polling
|
||||||
* interval for the reaper to 4 seconds so that tests will
|
* 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");
|
fSyncService = (AVMSyncService)fContext.getBean("AVMSyncService");
|
||||||
fIndexerAndSearcher = (IndexerAndSearcher)fContext.getBean("indexerAndSearcherFactory");
|
fIndexerAndSearcher = (IndexerAndSearcher)fContext.getBean("indexerAndSearcherFactory");
|
||||||
fTransactionService = (TransactionService)fContext.getBean("transactionComponent");
|
fTransactionService = (TransactionService)fContext.getBean("transactionComponent");
|
||||||
|
fLockingService = (AVMLockingService)fContext.getBean("AVMLockingService");
|
||||||
AuthenticationService authService = (AuthenticationService)fContext.getBean("AuthenticationService");
|
AuthenticationService authService = (AuthenticationService)fContext.getBean("AuthenticationService");
|
||||||
authService.authenticate("admin", "admin".toCharArray());
|
authService.authenticate("admin", "admin".toCharArray());
|
||||||
CreateStoreTxnListener cstl = (CreateStoreTxnListener)fContext.getBean("createStoreTxnListener");
|
CreateStoreTxnListener cstl = (CreateStoreTxnListener)fContext.getBean("createStoreTxnListener");
|
||||||
@ -144,6 +148,7 @@ public class AVMServiceTestBase extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
fService.createStore("main");
|
fService.createStore("main");
|
||||||
|
fLockingService.addWebProject("main");
|
||||||
fStartTime = System.currentTimeMillis();
|
fStartTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user