public void testDeleteFileLockedNoLockToken() throws Exception { file.lock(0); ByteArrayContainerResponseWriter writer = new ByteArrayContainerResponseWriter(); String path = SERVICE_URI + "delete/" + fileId; ContainerResponse response = launcher.service(HttpMethod.POST, path, BASE_URI, null, null, writer, null); assertEquals(403, response.getStatus()); log.info(new String(writer.getBody())); try { mountPoint.getVirtualFileById(fileId); } catch (NotFoundException e) { fail("File must not be removed since it is locked. "); } }
public void testDeleteFileLocked() throws Exception { String lockToken = file.lock(0); String path = SERVICE_URI + "delete/" + fileId + '?' + "lockToken=" + lockToken; ContainerResponse response = launcher.service(HttpMethod.POST, path, BASE_URI, null, null, null); assertEquals(204, response.getStatus()); try { mountPoint.getVirtualFileById(fileId); fail("File must be removed. "); } catch (NotFoundException e) { } try { mountPoint.getVirtualFile(filePath); fail("File must be removed. "); } catch (NotFoundException e) { } }