ALF-13028: Sharepoint broken by changes to WebDAV

Integrated fix for ALF-11777 so that locks are not kept for more than 24 hours and 24 hour or infinite locks are dropped on user's session destruction.

Extracted interface from WebDAVLockService and moved the implementation to WebDAVLockServiceImpl. Modified WebDAVLockServiceImpl to use the LockStore in-memory locking. WebDAV and SPP use WebDAVLockService instead of directly using LockStore.

 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@35486 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-04-20 14:33:19 +00:00
parent 617e6486cc
commit 004b2c5e60
12 changed files with 854 additions and 358 deletions

View File

@@ -0,0 +1,98 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.webdav;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.Date;
import org.junit.Test;
public class LockInfoImplTest
{
@Test
public void canSetTimeoutSeconds()
{
LockInfoImplEx lockInfo = new LockInfoImplEx();
// This should add 7 seconds (7000 millis) to the expiry date.
lockInfo.setTimeoutSeconds(7);
// Check the new date.
assertEquals(86407000, lockInfo.getExpires().getTime());
}
@Test
public void canSetTimeoutSecondsToInfinity()
{
LockInfoImplEx lockInfo = new LockInfoImplEx();
lockInfo.setTimeoutSeconds(WebDAV.TIMEOUT_INFINITY);
// Check the new date.
assertNull(lockInfo.getExpires());
}
@Test
public void canSetTimeoutMinutes()
{
LockInfoImplEx lockInfo = new LockInfoImplEx();
// This should add 5 minutes to the expiry date.
lockInfo.setTimeoutMinutes(5);
// Check the new date.
assertEquals(86700000, lockInfo.getExpires().getTime());
}
@Test
public void canSetTimeoutMinutesToInfinity()
{
LockInfoImplEx lockInfo = new LockInfoImplEx();
lockInfo.setTimeoutMinutes(WebDAV.TIMEOUT_INFINITY);
// Check the new date.
assertNull(lockInfo.getExpires());
}
@Test
public void canGetRemainingTimeoutSeconds()
{
LockInfoImplEx lockInfo = new LockInfoImplEx();
lockInfo.setTimeoutSeconds(7);
assertEquals(7, lockInfo.getRemainingTimeoutSeconds());
}
public static class LockInfoImplEx extends LockInfoImpl
{
public static final Date DATE_NOW = new Date(86400000);
private static final long serialVersionUID = 1669378516554195322L;
@Override
protected Date dateNow()
{
return DATE_NOW;
}
}
}