From 2fc7b70449025d1b4faa9db94d047bf92cc2185f Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 11 Mar 2016 21:39:56 +0000 Subject: [PATCH] Merged 5.1.N (5.1.1) to HEAD (5.1) 120777 aleahu: MNT-15480 : Intermittent failure WebDAVMethodTest.expiryLockTest() - Increased timeout git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123629 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/webdav/WebDAVMethodTest.java | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/source/test-java/org/alfresco/repo/webdav/WebDAVMethodTest.java b/source/test-java/org/alfresco/repo/webdav/WebDAVMethodTest.java index 52f497adf0..dcb0f96183 100644 --- a/source/test-java/org/alfresco/repo/webdav/WebDAVMethodTest.java +++ b/source/test-java/org/alfresco/repo/webdav/WebDAVMethodTest.java @@ -43,6 +43,8 @@ import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.GUID; import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -79,6 +81,8 @@ public class WebDAVMethodTest private @Mock DeleteMethod deleteMethod; private @Mock UnlockMethod unlockMethod; + private static Log logger = LogFactory.getLog(WebDAVMethodTest.class); + public static final String TEST_RUN = System.currentTimeMillis()+""; public static final String TEST_TENANT_DOMAIN = TEST_RUN+".my.test"; public static final String DEFAULT_ADMIN_PW = "admin"; @@ -435,19 +439,27 @@ public class WebDAVMethodTest public Object execute() throws Throwable { try + { + // LOCK document. + lockMethod.executeImpl(); + + //wait for the lock to expire up to 5 seconds + int timeout = 5; + while( timeout > 0 && !lockMethod.lockInfo.isExpired()) { - // LOCK document. - lockMethod.executeImpl(); - Thread.sleep(2000); - - // LOCK against an expired lock. - lockMethod.executeImpl(); + Thread.sleep(1000); + timeout--; } - catch (WebDAVServerException e) - { - Assert.fail("Document was not locked again, when lock has expired."); - } - return null; + + // LOCK against an expired lock. + lockMethod.executeImpl(); + } + catch (WebDAVServerException e) + { + logger.debug(e); + Assert.fail("Document was not locked again, when lock has expired."); + } + return null; } });