@Test public void persists_several_changesets_on_file() throws IOException { Collection<Changeset> changesets = Arrays.asList( changeset("identifier", "fbiville", "CREATE (n: SomeNode {text:'yeah'})"), changeset("identifier2", "mgazanayi", "CREATE (n2: SomeNode {text:'yeah'})", "preprod,prod") ); writer.write(changesets); String fileContents = String.join("\n", Files.readAllLines(outputFile.toPath(), StandardCharsets.UTF_8)); assertThat(fileContents).isEqualTo( " " "CREATE (n: SomeNode {text:'yeah'})\n" + " " "CREATE (n2: SomeNode {text:'yeah'})" ); }
@Override public void write(Collection<Changeset> changelogsToInsert) { try { LOGGER.info("About to dry-run Liquigraph. Results in file {}", outputFile.getAbsolutePath()); Path path = outputFile.toPath(); reinitializeFile(path); if (changelogsToInsert.isEmpty()) { writeNothingToPersist(path); return; } writeHeaderMaybe(path); for (Changeset changeset : changelogsToInsert) { writeChangeset(changeset, path); } } catch (IOException e) { throw propagate(e); } }
ChangelogFileWriter implements ChangelogWriter { @Override public void write(Collection<Changeset> changelogsToInsert) { try { LOGGER.info("About to dry-run Liquigraph. Results in file {}", outputFile.getAbsolutePath()); Path path = outputFile.toPath(); reinitializeFile(path); if (changelogsToInsert.isEmpty()) { writeNothingToPersist(path); return; } writeHeaderMaybe(path); for (Changeset changeset : changelogsToInsert) { writeChangeset(changeset, path); } } catch (IOException e) { throw propagate(e); } } }
ChangelogFileWriter implements ChangelogWriter { @Override public void write(Collection<Changeset> changelogsToInsert) { try { LOGGER.info("About to dry-run Liquigraph. Results in file {}", outputFile.getAbsolutePath()); Path path = outputFile.toPath(); reinitializeFile(path); if (changelogsToInsert.isEmpty()) { writeNothingToPersist(path); return; } writeHeaderMaybe(path); for (Changeset changeset : changelogsToInsert) { writeChangeset(changeset, path); } } catch (IOException e) { throw propagate(e); } } ChangelogFileWriter(ConditionPrinter conditionPrinter, String database, File outputFile); }
ChangelogFileWriter implements ChangelogWriter { @Override public void write(Collection<Changeset> changelogsToInsert) { try { LOGGER.info("About to dry-run Liquigraph. Results in file {}", outputFile.getAbsolutePath()); Path path = outputFile.toPath(); reinitializeFile(path); if (changelogsToInsert.isEmpty()) { writeNothingToPersist(path); return; } writeHeaderMaybe(path); for (Changeset changeset : changelogsToInsert) { writeChangeset(changeset, path); } } catch (IOException e) { throw propagate(e); } } ChangelogFileWriter(ConditionPrinter conditionPrinter, String database, File outputFile); @Override void write(Collection<Changeset> changelogsToInsert); }
ChangelogFileWriter implements ChangelogWriter { @Override public void write(Collection<Changeset> changelogsToInsert) { try { LOGGER.info("About to dry-run Liquigraph. Results in file {}", outputFile.getAbsolutePath()); Path path = outputFile.toPath(); reinitializeFile(path); if (changelogsToInsert.isEmpty()) { writeNothingToPersist(path); return; } writeHeaderMaybe(path); for (Changeset changeset : changelogsToInsert) { writeChangeset(changeset, path); } } catch (IOException e) { throw propagate(e); } } ChangelogFileWriter(ConditionPrinter conditionPrinter, String database, File outputFile); @Override void write(Collection<Changeset> changelogsToInsert);  }