[spring-extensions] branch master updated: JSE-30 Try to let HTTPResourceTest cleanup after itself

Rod Widdowson rdw at steadingsoftware.com
Thu Dec 20 05:57:10 EST 2018


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=001afc142f902006a377bba85adc10195142388a

The following commit(s) were added to refs/heads/master by this push:
       new  001afc1   JSE-30 Try to let HTTPResourceTest cleanup after itself
001afc1 is described below

commit 001afc142f902006a377bba85adc10195142388a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Dec 20 10:55:06 2018 +0000

    JSE-30 Try to let HTTPResourceTest cleanup after itself
    
    https://issues.shibboleth.net/jira/browse/JSE-30
    
    Also whine if it fails.
---
 .../shibboleth/ext/spring/resource/HTTPResourceTest.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java b/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java
index fb561c0..a7b596c 100644
--- a/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java
@@ -21,7 +21,13 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.PosixFileAttributes;
+import java.nio.file.attribute.PosixFilePermission;
+import java.nio.file.attribute.PosixFilePermissions;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Set;
 
 import net.shibboleth.ext.spring.util.SchemaTypeAwareXMLBeanDefinitionReader;
 import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
@@ -41,6 +47,8 @@ import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.Sets;
+
 /**
  * Test for HTTPResource.
  */
@@ -190,16 +198,17 @@ public class HTTPResourceTest {
             if (f.isDirectory()) {
                 emptyDir(f);
             }
-            f.delete();
+            Assert.assertTrue(f.delete());
         }
-        dir.delete();
+        Assert.assertTrue(dir.delete());
     }
 
     @Test public void springLoadFileCache() throws IOException {
         File theDir = null;
-        final Path p = Files.createTempDirectory("HTTPResourceTest");
         GenericApplicationContext context = null;
         try {
+            final Set<PosixFilePermission> prot = Sets.newHashSet(PosixFilePermission.values());
+            final Path p = Files.createTempDirectory("HTTPResourceTest", PosixFilePermissions.asFileAttribute(prot));
             theDir = p.toFile();
             context = getContext("classpath:net/shibboleth/ext/spring/resource/MemBackedHTTPBean.xml", null);
             final Collection<TestHTTPResource> beans = context.getBeansOfType(TestHTTPResource.class).values();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list