X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.enterprise%2Fext%2Ftest%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FLdifUserAdminTest.java;h=4cfb58b77af0e52e811ce7f98d67735e7a5b1765;hb=e08088f2e11563c39ad78b4430d87bea577b669c;hp=a8a7d226a1aa124c135d038882782af8e93bf291;hpb=e66b9893b0e511f8ab295e3cee42b7dc966f1597;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java index a8a7d226a..4cfb58b77 100644 --- a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java +++ b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java @@ -3,10 +3,14 @@ package org.argeo.osgi.useradmin; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; import java.util.Arrays; import java.util.Base64; import java.util.Dictionary; @@ -30,9 +34,10 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants { private BitronixTransactionManager tm; private URI uri; private AbstractUserDirectory userAdmin; + private Path tempDir; - public void testConcurrent() throws Exception { - } + // public void testConcurrent() throws Exception { + // } @SuppressWarnings("unchecked") public void testEdition() throws Exception { @@ -132,7 +137,8 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants { @Override protected void setUp() throws Exception { - Path tempDir = Files.createTempDirectory(getClass().getName()); + tempDir = Files.createTempDirectory(getClass().getName()); + tempDir.toFile().deleteOnExit(); String uriProp = System.getProperty("argeo.userdirectory.uri"); if (uriProp != null) uri = new URI(uriProp); @@ -186,6 +192,21 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants { tm.shutdown(); if (userAdmin != null) userAdmin.destroy(); + if (tempDir != null) + Files.walkFileTree(tempDir, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + + }); } }