garydgregory commented on code in PR #425: URL: https://github.com/apache/commons-vfs/pull/425#discussion_r1333275195
########## commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameTest.java: ########## @@ -0,0 +1,219 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.vfs2.provider.webdav4; + +import org.apache.commons.vfs2.FileSystemException; +import org.apache.commons.vfs2.FileSystemManager; +import org.apache.commons.vfs2.FileSystemOptions; +import org.apache.commons.vfs2.VFS; +import org.apache.commons.vfs2.impl.DefaultFileSystemManager; +import org.apache.commons.vfs2.provider.GenericURLFileName; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests {@link Webdav4FileName}. + * + */ +public class Webdav4FileNameTest { + /** + * If the resolved path ends with a '/' + * + */ + @Test + public void testWebdavUrlWithTrailingSlash() throws FileSystemException { + @SuppressWarnings("resource") + FileSystemOptions fsoptsWithTrailingSlash = new FileSystemOptions(); + Webdav4FileSystemConfigBuilder.getInstance().setAppendTrailingSlash(fsoptsWithTrailingSlash, true); + + final FileSystemManager fileSystemManager = VFS.getManager(); + + final String urlBase = "webdav4://localhost:80"; + final String urlWithFile1 = "webdav4://localhost:80/File.txt"; + final String urlWithFile2 = "webdav4://localhost:80/Path/File.txt"; + final String urlWithFileWithoutExtension1 = "webdav4://localhost:80/File"; + final String urlWithFileWithoutExtension2 = "webdav4://localhost:80/Path/File"; + final String urlWithSubpath = "webdav4://localhost:80/Path/Sub Path/"; + final String urlWithRelativePart1 = "webdav4://localhost:80/Path/."; + final String urlWithRelativePart2 = "webdav4://localhost:80/Path/./"; + final String urlWithRelativePart3 = "webdav4://localhost:80/Path/../Decendant Path/"; + final String urlWithRelativePart4 = "webdav4://localhost:80/Path/Sub Path/.."; + final String urlWithRelativePart5 = "webdav4://localhost:80/Path/Sub Path/../"; Review Comment: > There's a thing with your Examples: Every URL who not ends with a '/' or '.' or '..' are recognized as FileType.File Whatever issue we maybe have here, I think we should cover all forms of queries and define what is to be expected. > If the queryString is empty, should we remove the question mark at the end of the url? You tell me ;-) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
