garydgregory commented on code in PR #300:
URL: https://github.com/apache/commons-vfs/pull/300#discussion_r976575971


##########
commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java:
##########
@@ -210,4 +213,36 @@ public void testResolveFolderSlashYesRedirectOn() throws 
FileSystemException {
         testResolveFolderSlash(ConnectionUri + "/read-tests/", true);
     }
 
+    @Test
+    public void testHttp5FileSystemFreeUnusedResources() throws Exception {
+        try (StandardFileSystemManager fileSystemManager = new 
StandardFileSystemManager()) {
+            
fileSystemManager.setConfiguration(StandardFileSystemManager.class.getResource("providers.xml"));
+            // use WeakRef
+            fileSystemManager.setFilesCache(new WeakRefFilesCache());
+            fileSystemManager.init();
+
+            String path = 
"http5://www.w3schools.com/webservices/tempconvert.asmx?action=WSDL";
+            AbstractFileSystem http4FileSystem = getFile(fileSystemManager, 
path);
+            http4FileSystem.isReleaseable();
+
+            while (!http4FileSystem.isReleaseable()) {

Review Comment:
   I would fail the test if a timeout is exceeded, probably with the Timeout 
annotation. We do not want an infinite loop.



##########
commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java:
##########
@@ -216,4 +219,35 @@ public void testResolveFolderSlashYesRedirectOn() throws 
FileSystemException {
         testResolveFolderSlash(ConnectionUri + "/read-tests/", true);
     }
 
+    @Test
+    public void testHttp4FileSystemFreeUnusedResources() throws Exception {
+        try (StandardFileSystemManager fileSystemManager = new 
StandardFileSystemManager()) {
+            
fileSystemManager.setConfiguration(StandardFileSystemManager.class.getResource("providers.xml"));
+            // use WeakRef
+            fileSystemManager.setFilesCache(new WeakRefFilesCache());
+            fileSystemManager.init();
+
+            String path = 
"http4://www.w3schools.com/webservices/tempconvert.asmx?action=WSDL";
+            AbstractFileSystem http4FileSystem = getFile(fileSystemManager, 
path);
+            http4FileSystem.isReleaseable();
+
+            while (!http4FileSystem.isReleaseable()) {

Review Comment:
   I would fail the test if a timeout is exceeded, probably with the Timeout 
annotation. We do not want an infinite loop.



-- 
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]

Reply via email to