Add faster running test we dont have to ignore.
Avoid Files max size validation to ensure buffering is working. Same
test fails with same messageless error reported by user against master.
package com.quorum.tessera.data.migration;
-import java.io.IOException;
import java.io.InputStream;
-import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Base64;
import java.util.Map;
+import java.util.Random;
import java.util.UUID;
-import java.util.stream.IntStream;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
-import org.junit.Ignore;
public class DirectoryStoreFileTest {
@@ -31,7 +27,6 @@ public class DirectoryStoreFileTest {
}
- @Ignore
@Test
public void loadLarge() throws Exception {
@@ -43,20 +38,10 @@ public class DirectoryStoreFileTest {
Path largeFile = Paths.get(directory.toAbsolutePath().toString(), "loadLarge");
- try (java.io.BufferedWriter writer = Files.newBufferedWriter(largeFile)) {
- IntStream.range(1, 50000000)
- .mapToObj(i -> UUID.randomUUID())
- .map(UUID::toString)
- .map(String::getBytes)
- .map(Base64.getEncoder()::encodeToString)
- .forEach(s -> {
- try {
- writer.write(s);
- } catch (IOException ex) {
- throw new UncheckedIOException(ex);
- }
- });
- }
+ Random random = new Random();
+ byte[] data = new byte[Integer.MAX_VALUE - 8];
+ random.nextBytes(data);
+ Files.write(largeFile, data);
DirectoryStoreFile directoryStoreFile = new DirectoryStoreFile();
