[java-identity-provider] 02/02: Add a kludge against Windows Defender getting in the way of the Module test

Rod Widdowson rdw at steadingsoftware.com
Mon May 30 15:01:47 UTC 2022


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

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=1c01c09fe1f7e9bfe585ef1d62a57b4c76ff12b8

commit 1c01c09fe1f7e9bfe585ef1d62a57b4c76ff12b8
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun May 29 11:44:56 2022 +0100

    Add a kludge against Windows Defender getting in the way of the Module test
---
 .../net/shibboleth/idp/module/IdPModuleTest.java    | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java b/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
index a368859b9..027ec24aa 100644
--- a/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
+++ b/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
@@ -16,15 +16,19 @@ package net.shibboleth.idp.module;
  * limitations under the License.
  */
 
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URISyntaxException;
+import java.nio.file.AccessDeniedException;
+import java.nio.file.DirectoryNotEmptyException;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.SimpleFileVisitor;
-import java.nio.file.DirectoryNotEmptyException;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
@@ -223,7 +227,7 @@ public class IdPModuleTest {
     }
 
     @Test
-    public void testEnableExistingSame() throws IOException, ModuleException {
+    public void testEnableExistingSame() throws IOException, ModuleException, InterruptedException {
         Files.createDirectory(testHome.resolve("conf"));
         Files.createDirectory(testHome.resolve("views"));
         
@@ -237,7 +241,18 @@ public class IdPModuleTest {
             os.write(VEL_DATA.getBytes());
         }
 
-        testModule.enable(context);
+        try {
+            testModule.enable(context);
+        } catch (final ModuleException moduleException) {
+            if (moduleException.getCause() instanceof AccessDeniedException) {
+                assertEquals(File.pathSeparatorChar == ';', null);
+                // Our old friend Windows Defender still has its claws in the file.  Sleep then try again
+                Thread.sleep(100);
+                testModule.enable(context);                
+            } else {
+                throw moduleException;
+            }
+        }
 
         String xml = Files.readString(testHome.resolve("conf/test.xml"));
         Assert.assertEquals(xml, XML_DATA);

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


More information about the commits mailing list