@Test public void testExport() throws Exception { FedoraTestSupport fedora = new FedoraTestSupport(); fedora.cleanUp(); fedora.ingest(DataStreamExportTest.class.getResource("Kramerius4ExportTestPage.xml")); File output = temp.getRoot(); boolean hierarchy = true; List<String> pids = Arrays.asList("uuid:f74f3cf3-f3be-4cac-95da-8e50331414a2"); List<String> dsIds = Arrays.asList(StringEditor.OCR_ID, "PREVIEW"); DataStreamExport instance = new DataStreamExport(fedora.getRemoteStorage(), appConfig.getExportOptions()); File target = instance.export(output, hierarchy, pids, dsIds); assertNotNull(target); File ocr = new File(target, DataStreamExport.filename(pids.get(0), dsIds.get(0))); assertTrue(ocr.exists()); assertTrue(ocr.length() == 3); File preview = new File(target, DataStreamExport.filename(pids.get(0), dsIds.get(1))); assertTrue(preview.exists()); }
public File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds) throws ExportException { if (!output.exists() || !output.isDirectory()) { throw new IllegalStateException(String.valueOf(output)); } if (pids == null || pids.isEmpty() || dsIds == null || dsIds.isEmpty()) { throw new IllegalArgumentException(); } File target = ExportUtils.createFolder(output, filename(pids.get(0), dsIds.get(0)), options.isOverwritePackage()); toExport.addAll(pids); for (String pid = toExport.poll(); pid != null; pid = toExport.poll()) { exportPid(target, hierarchy, pid, dsIds); } return target; }
DataStreamExport { public File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds) throws ExportException { if (!output.exists() || !output.isDirectory()) { throw new IllegalStateException(String.valueOf(output)); } if (pids == null || pids.isEmpty() || dsIds == null || dsIds.isEmpty()) { throw new IllegalArgumentException(); } File target = ExportUtils.createFolder(output, filename(pids.get(0), dsIds.get(0)), options.isOverwritePackage()); toExport.addAll(pids); for (String pid = toExport.poll(); pid != null; pid = toExport.poll()) { exportPid(target, hierarchy, pid, dsIds); } return target; } }
DataStreamExport { public File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds) throws ExportException { if (!output.exists() || !output.isDirectory()) { throw new IllegalStateException(String.valueOf(output)); } if (pids == null || pids.isEmpty() || dsIds == null || dsIds.isEmpty()) { throw new IllegalArgumentException(); } File target = ExportUtils.createFolder(output, filename(pids.get(0), dsIds.get(0)), options.isOverwritePackage()); toExport.addAll(pids); for (String pid = toExport.poll(); pid != null; pid = toExport.poll()) { exportPid(target, hierarchy, pid, dsIds); } return target; } DataStreamExport(RemoteStorage rstorage, ExportOptions options); }
DataStreamExport { public File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds) throws ExportException { if (!output.exists() || !output.isDirectory()) { throw new IllegalStateException(String.valueOf(output)); } if (pids == null || pids.isEmpty() || dsIds == null || dsIds.isEmpty()) { throw new IllegalArgumentException(); } File target = ExportUtils.createFolder(output, filename(pids.get(0), dsIds.get(0)), options.isOverwritePackage()); toExport.addAll(pids); for (String pid = toExport.poll(); pid != null; pid = toExport.poll()) { exportPid(target, hierarchy, pid, dsIds); } return target; } DataStreamExport(RemoteStorage rstorage, ExportOptions options); File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds); }
DataStreamExport { public File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds) throws ExportException { if (!output.exists() || !output.isDirectory()) { throw new IllegalStateException(String.valueOf(output)); } if (pids == null || pids.isEmpty() || dsIds == null || dsIds.isEmpty()) { throw new IllegalArgumentException(); } File target = ExportUtils.createFolder(output, filename(pids.get(0), dsIds.get(0)), options.isOverwritePackage()); toExport.addAll(pids); for (String pid = toExport.poll(); pid != null; pid = toExport.poll()) { exportPid(target, hierarchy, pid, dsIds); } return target; } DataStreamExport(RemoteStorage rstorage, ExportOptions options); File export(File output, boolean hierarchy, List<String> pids, List<String> dsIds);  }