Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

83541: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      82261: Merged DEV to V4.2-BUG-FIX (4.2.4)
         80345 : MNT-11990 : vti sharepoint server does not respect If: HTTP headers as defined in rfc2518
            - LockMethod was corrected to prevent lock refresh for non-locked files.
            - Unit test added.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@84561 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-09-18 17:08:49 +00:00
parent 5a0f3ef869
commit caf361cd61
2 changed files with 44 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.Serializable;
import java.util.Collections;
@@ -338,4 +339,38 @@ public class LockMethodTest
assertFalse("File should note exist in repo any more.", nodeService.exists(nodeRef));
assertFalse("File should note exist in trashcan.", nodeService.exists(new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, nodeRef.getId())));
}
@Test
public void testMNT_11990() throws Exception
{
MockHttpServletRequest lockRequest = new MockHttpServletRequest();
lockRequest.addHeader(WebDAV.HEADER_TIMEOUT, WebDAV.SECOND + 3600);
lockRequest.addHeader(WebDAV.HEADER_IF, "(<" + WebDAV.makeLockToken(fileNodeRef, userName) + ">)");
lockRequest.setRequestURI("/" + TEST_FILE_NAME);
lockMethod.setDetails(lockRequest, new MockHttpServletResponse(), davHelper, folderNodeRef);
lockMethod.parseRequestHeaders();
lockMethod.parseRequestBody();
RetryingTransactionCallback<Void> lockExecuteImplCallBack = new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
try
{
lockMethod.executeImpl();
fail("Lock should not be refreshed for non-locked file.");
}
catch (WebDAVServerException e)
{
assertEquals(e.getHttpStatusCode(), HttpServletResponse.SC_BAD_REQUEST);
}
return null;
}
};
// try to refresh lock for non-locked node
this.transactionService.getRetryingTransactionHelper().doInTransaction(lockExecuteImplCallBack);
}
}