1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider.http;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20
21 import org.apache.commons.vfs2.FileObject;
22 import org.apache.commons.vfs2.FileSystemException;
23 import org.apache.commons.vfs2.FileSystemManager;
24 import org.apache.commons.vfs2.VFS;
25 import org.junit.jupiter.api.Test;
26
27
28
29
30 public class HttpFilesCacheTest {
31
32
33
34
35 @Test
36 public void testQueryStringUrls() throws FileSystemException {
37 final String noQueryStringUrl = "http://commons.apache.org/vfs";
38 final String queryStringUrl = "http://commons.apache.org/vfs?query=string";
39 final String queryStringUrl2 = "http://commons.apache.org/vfs?query=string&more=stuff";
40
41 final FileSystemManager fileSystemManager = VFS.getManager();
42
43 try (FileObject noQueryFile = fileSystemManager.resolveFile(noQueryStringUrl)) {
44 assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
45 }
46
47 try (FileObject queryFile = fileSystemManager.resolveFile(queryStringUrl)) {
48 assertEquals(queryStringUrl, queryFile.getURL().toExternalForm());
49 }
50
51 try (FileObject queryFile2 = fileSystemManager.resolveFile(queryStringUrl2)) {
52 assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm());
53 }
54 }
55
56 }