/** * @throws IOException ShrinkWrap errors */ @Override protected void setupPathManager() throws IOException { final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class); final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive); PathManager.getInstance().useOverrideHomePath(vfs.getPath("")); }
@BeforeClass public static void setupEnvironment() throws Exception { final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class); final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive); PathManager.getInstance().useOverrideHomePath(vfs.getPath("")); /* * Create at least for each class a new headless environemnt as it is fast and prevents side effects * (Reusing a headless environment after other tests have modified the core registry isn't really clean) */ env = new HeadlessEnvironment(new Name("engine")); context = env.getContext(); moduleManager = context.get(ModuleManager.class); }
super.setup(); JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class); FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive); PathManager.getInstance().useOverrideHomePath(temporaryFolder.getRoot().toPath()); savePath = PathManager.getInstance().getSavePath("testSave");
public GenericArchive writeFaultSeqArchive(Domain domain, List<Contingency> contingencies, Network network, EurostagDictionary dictionary, Function<Integer, String> seqFileNameFct) throws IOException { if ((contingencies == null) || (contingencies.isEmpty())) { throw new RuntimeException("contingencies list is empty, cannot write .seq scenario files"); } GenericArchive archive = domain.getArchiveFactory().create(GenericArchive.class); try (FileSystem fileSystem = ShrinkWrapFileSystems.newFileSystem(archive)) { Path rootDir = fileSystem.getPath("/"); for (int i = 0; i < contingencies.size(); i++) { Contingency contingency = contingencies.get(i); Path seqFile = rootDir.resolve(seqFileNameFct.apply(i)); try (BufferedWriter writer = Files.newBufferedWriter(seqFile, StandardCharsets.UTF_8)) { writeFaultSeq(writer, contingency, network, dictionary); } } } return archive; }
@Before public void setUp() throws IOException { JavaArchive archive = ShrinkWrap.create(JavaArchive.class); fileSystem = ShrinkWrapFileSystems.newFileSystem(archive); tmpDir = fileSystem.getPath("tmp"); }
} else if (Files.isRegularFile(p) && p.getFileName().toString().endsWith(".zip")) { GenericArchive archive = ShrinkWrap.createFromZipFile(GenericArchive.class, p.toFile()); FileSystem zipFs = ShrinkWrapFileSystems.newFileSystem(archive); zipFsLs.add(zipFs); ddbPath.add(zipFs.getPath("/"));
private void writeWp43Configs(Domain domain, List<Contingency> contingencies, OutputStream os) throws IOException, ConfigurationException { // copy wp43 configuration files GenericArchive archive = domain.getArchiveFactory().create(GenericArchive.class); try (FileSystem fileSystem = ShrinkWrapFileSystems.newFileSystem(archive)) { Path rootDir = fileSystem.getPath("/"); writeWp43Configs(contingencies, rootDir); } archive.as(ZipExporter.class).exportTo(os); }
forEach(p -> { GenericArchive archive = ShrinkWrap.createDomain().getArchiveFactory().create(GenericArchive.class); try (FileSystem fileSystem = ShrinkWrapFileSystems.newFileSystem(archive)) { Path rootDir = fileSystem.getPath("/"); Files.copy(modelicaPowerSystemLibraryPath, rootDir.resolve(modelicaPowerSystemLibraryPath.getFileName())); Path sfile1 = ShrinkWrapFileSystems.newFileSystem(archive).getPath("/");
private void writeDtaAndControls(Domain domain, OutputStream ddbOs, OutputStream dictGensOs) throws IOException { GenericArchive archive = domain.getArchiveFactory().create(GenericArchive.class); try (FileSystem fileSystem = ShrinkWrapFileSystems.newFileSystem(archive)) { Path rootDir = fileSystem.getPath("/"); ddbClient.dumpDtaFile(rootDir, DTA_FILE_NAME, network, parallelIndexes.toMap(), EurostagUtil.VERSION, dictionary.toMap(), parameters); } archive.as(ZipExporter.class).exportTo(ddbOs); //put just the generators dict csv file (extracted from the ddb files) in the common files set, to be used by wp43 transient stability index if (archive.get(DDB_DICT_GENS_CSV) != null) { ByteStreams.copy(archive.get(DDB_DICT_GENS_CSV).getAsset().openStream(), dictGensOs); } else { LOGGER.warn(DDB_DICT_GENS_CSV + " is missing in the dynamic data files set: some security indexers (e.g. transient stability) need this file"); } }
protected static void writeLimits(Network network, EurostagDictionary dictionary, Domain domain, OutputStream os, EurostagEchExportConfig exportConfig) throws IOException { GenericArchive archive = domain.getArchiveFactory().create(GenericArchive.class); try (FileSystem fileSystem = ShrinkWrapFileSystems.newFileSystem(archive)) { Path rootDir = fileSystem.getPath("/");