import java.time.Duration;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Locale;
import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.errors.CommandFailedException;
SystemReader.getInstance().getDefaultCharset().name());
}
+ @Test
+ @SuppressWarnings("boxing")
+ public void testConcurrentSymlinkSupport()
+ throws ExecutionException, InterruptedException {
+ Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
+ int n = 3;
+ List<CompletableFuture<Boolean>> futures = new ArrayList<>();
+ for (int i = 0; i < n; i++) {
+ futures.add(CompletableFuture.supplyAsync(
+ () -> FS.DETECTED.newInstance().supportsSymlinks()));
+ }
+
+ for (int i = 0; i < n; i++) {
+ assertTrue(futures.get(i).get());
+ }
+ }
+
@Test
public void testFsTimestampResolution() throws Exception {
DateTimeFormatter formatter = DateTimeFormatter
File tempFile = null;
try {
tempFile = File.createTempFile("tempsymlinktarget", ""); //$NON-NLS-1$ //$NON-NLS-2$
- File linkName = new File(tempFile.getParentFile(), "tempsymlink"); //$NON-NLS-1$
+ File linkName = new File(tempFile.getPath() + "-tempsymlink"); //$NON-NLS-1$
createSymLink(linkName, tempFile.getPath());
supportSymlinks = Boolean.TRUE;
linkName.delete();