public static void main(String[] args) throws FileNotFoundException { dump(args[0]); }
public static void dump(@NotNull File path, @NotNull PrintStream out, long upperLimit) { if (path.isDirectory()) { File[] files = path.listFiles((d, n) -> n.endsWith(SingleChronicleQueue.SUFFIX) || n.endsWith(SingleTableStore.SUFFIX)); if (files == null) { err.println("Directory not found " + path); System.exit(1); } Arrays.sort(files); for (File file : files) dumpFile(file, out, upperLimit); } else if (path.getName().endsWith(SingleChronicleQueue.SUFFIX) || path.getName().endsWith(SingleTableStore.SUFFIX)) { dumpFile(path, out, upperLimit); } }
int i = indexOfLastZero(sb); if (i < sb.length()) sb.setLength(i - 5);
int i = indexOfLastZero(sb); if (i < sb.length()) sb.setLength(i - 5);
public static void dump(@NotNull String path) throws FileNotFoundException { File path2 = new File(path); PrintStream out = FILE == null ? System.out : new PrintStream(new File(FILE)); long upperLimit = Long.MAX_VALUE; dump(path2, out, upperLimit); }
public static void dump(@NotNull File path, @NotNull PrintStream out, long upperLimit) { if (path.isDirectory()) { File[] files = path.listFiles((d, n) -> n.endsWith(SingleChronicleQueue.SUFFIX) || n.endsWith(SingleTableStore.SUFFIX)); if (files == null) { err.println("Directory not found " + path); System.exit(1); } Arrays.sort(files); for (File file : files) dumpFile(file, out, upperLimit); } else if (path.getName().endsWith(SingleChronicleQueue.SUFFIX) || path.getName().endsWith(SingleTableStore.SUFFIX)) { dumpFile(path, out, upperLimit); } }
@Test public void shouldBeAbleToDumpReadOnlyQueueFile() throws Exception { if (OS.isWindows()) return; final File dataDir = DirectoryUtils.tempDir(DumpQueueMainTest.class.getSimpleName()); try (final ChronicleQueue queue = SingleChronicleQueueBuilder. binary(dataDir). build()) { final ExcerptAppender excerptAppender = queue.acquireAppender(); excerptAppender.writeText("first"); excerptAppender.writeText("last"); final Path queueFile = Files.list(dataDir.toPath()). filter(p -> p.toString().endsWith(SingleChronicleQueue.SUFFIX)). findFirst().orElseThrow(() -> new AssertionError("Could not find queue file in directory " + dataDir)); assertThat(queueFile.toFile().setWritable(false), is(true)); final CountingOutputStream countingOutputStream = new CountingOutputStream(); DumpQueueMain.dump(queueFile.toFile(), new PrintStream(countingOutputStream), Long.MAX_VALUE); assertThat(countingOutputStream.bytes, is(not(0L))); } }
@Test public void shouldDumpDirectoryListing() throws Exception { final File dataDir = DirectoryUtils.tempDir(DumpQueueMainTest.class.getSimpleName()); try (final ChronicleQueue queue = SingleChronicleQueueBuilder. binary(dataDir). build()) { final ExcerptAppender excerptAppender = queue.acquireAppender(); excerptAppender.writeText("first"); excerptAppender.writeText("last"); final ByteArrayOutputStream capture = new ByteArrayOutputStream(); DumpQueueMain.dump(dataDir, new PrintStream(capture), Long.MAX_VALUE); final String capturedOutput = new String(capture.toByteArray()); assertThat(capturedOutput, containsString("listing.highestCycle")); assertThat(capturedOutput, containsString("listing.lowestCycle")); } }
Files.copy(templatePath, to, StandardCopyOption.REPLACE_EXISTING); DumpQueueMain.dump(tmpDir.toString());
DumpQueueMain.dump(queue.file(), System.out, Long.MAX_VALUE); throw new AssertionError(failureMessage);
public static void main(String[] args) throws FileNotFoundException { dump(args[0]); }
public static void dump(@NotNull String path) throws FileNotFoundException { File path2 = new File(path); PrintStream out = FILE == null ? System.out : new PrintStream(new File(FILE)); long upperLimit = Long.MAX_VALUE; dump(path2, out, upperLimit); }