WCAUtils { public static void exportState(Network network, Path folder, int faultNum, int actionNum) { Objects.requireNonNull(network); Objects.requireNonNull(folder); Properties parameters = new Properties(); parameters.setProperty("iidm.export.xml.indent", "true"); parameters.setProperty("iidm.export.xml.with-branch-state-variables", "true"); DataSource dataSource = new GzFileDataSource(folder, network.getId() + "_" + faultNum + "_" + actionNum); Exporters.export("XIIDM", network, parameters, dataSource); } private  WCAUtils(); static void exportState(Network network, Path folder, int faultNum, int actionNum); static WCADomainsResult readDomainsResult(String domainsPrefix, Path workingDir, String uncertaintiesFile); static WCAClustersResult readClustersResult(String clustersPrefix, Path workingDir, String flowsFile, String uncertaintiesFile); static void writeContingencies(Collection<Contingency> contingencies, DataSource dataSource, StringToIntMapper<AmplSubset> mapper); static void writeActions(Collection<String> actionIds, DataSource dataSource, StringToIntMapper<AmplSubset> mapper,
                                     String title, AmplSubset amplSubset); static void applyInjections(Network network, String stateId, Map<String, Float> injections); static boolean containsViolation(List<LimitViolation> violations, LimitViolation violation);  }
@Test public void testExportState() throws IOException, URISyntaxException { Path folder = Files.createDirectory(fileSystem.getPath("/export-folder")); Network network = NetworkTest1Factory.create(); network.setCaseDate(new DateTime(1483228800000L).withZone(DateTimeZone.UTC)); WCAUtils.exportState(network, folder, 0, 0); Path exportedState = folder.resolve(network.getId() + "_0_0.xiidm.gz"); assertTrue(Files.exists(exportedState)); try (GZIPInputStream stream = new GZIPInputStream(Files.newInputStream(exportedState))) { assertTrue(IOUtils.contentEquals(getClass().getResourceAsStream("/network1.xiidm"), stream)); } }