From 96f3712ef0df7813b3ef628b3ef2d7145406ebef Mon Sep 17 00:00:00 2001 From: James William Dumay Date: Wed, 4 Jun 2008 05:52:40 +0000 Subject: [PATCH] MRM-781 - Removal of Archiva-Webdav implementation in favor of Jackrabbit-webdav * DELETE should 404 if resource does not exist * 93% litmus coverage git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@662989 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/archiva/webdav/ArchivaDavResource.java | 4 ++++ .../maven/archiva/webdav/DavResourceTest.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java index 78c1b0c8f..ee4602f92 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java @@ -329,6 +329,10 @@ public class ArchivaDavResource throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR ); } } + else + { + throw new DavException( HttpServletResponse.SC_NOT_FOUND ); + } } public void move( DavResource destination ) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java index 46cd3af72..e091461a9 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java @@ -90,6 +90,22 @@ public class DavResourceTest extends PlexusInSpringTestCase return new ArchivaDavResource(file.getAbsolutePath(), logicalPath, mimeTypes, session, resourceLocator, resourceFactory); } + public void testDeleteNonExistantResourceShould404() + throws Exception + { + File dir = new File(baseDir, "testdir"); + try + { + DavResource directoryResource = getDavResource("/testdir", dir); + directoryResource.getCollection().removeMember(directoryResource); + fail("Did not throw DavException"); + } + catch (DavException e) + { + assertEquals(DavServletResponse.SC_NOT_FOUND, e.getErrorCode()); + } + } + public void testDeleteCollection() throws Exception { -- 2.39.5