@Test public void testExportResult() throws Exception { File target = temp.getRoot(); ExportResult export = new ExportResult(); export.setStatus(ResultStatus.OK); export.setInputPid("pid1"); export.getError().add(new ResultError("childPid1", "error1")); export.getError().add(new ResultError("childpid2", new IllegalStateException("error2"))); export.getError().add(new ResultError("childPid3", "msg", "error3")); export.getError().add(new ResultError("childPid4", "msg", Arrays.asList("validation1", "validation2"))); export.setEnd(new Date()); ExportResultLog log = new ExportResultLog(); log.getExports().add(export); ExportUtils.writeExportResult(target, log); File statusFile = new File(target, ExportUtils.PROARC_EXPORT_STATUSLOG); assertTrue(statusFile.exists()); String result = FileUtils.readFileToString(statusFile); assertTrue(result, result.contains("error1")); assertTrue(result, result.contains("error2")); assertTrue(result, result.contains("error3")); assertTrue(result, result.contains("validation1")); assertTrue(result, result.contains("validation2")); }
public static void writeExportResult(File targetFolder, ExportResultLog result) { if (result.getEnd() == null) { result.setEnd(new Date()); } if (result.getExports().size() == 1) { result.setBegin(null); result.setEnd(null); } File resultFile = new File(targetFolder, PROARC_EXPORT_STATUSLOG); try { JAXB.marshal(result, resultFile); } catch (Exception e) { LOG.log(Level.SEVERE, targetFolder.toString(), e); } }
ExportUtils { public static void writeExportResult(File targetFolder, ExportResultLog result) { if (result.getEnd() == null) { result.setEnd(new Date()); } if (result.getExports().size() == 1) { result.setBegin(null); result.setEnd(null); } File resultFile = new File(targetFolder, PROARC_EXPORT_STATUSLOG); try { JAXB.marshal(result, resultFile); } catch (Exception e) { LOG.log(Level.SEVERE, targetFolder.toString(), e); } } }
ExportUtils { public static void writeExportResult(File targetFolder, ExportResultLog result) { if (result.getEnd() == null) { result.setEnd(new Date()); } if (result.getExports().size() == 1) { result.setBegin(null); result.setEnd(null); } File resultFile = new File(targetFolder, PROARC_EXPORT_STATUSLOG); try { JAXB.marshal(result, resultFile); } catch (Exception e) { LOG.log(Level.SEVERE, targetFolder.toString(), e); } }  }
ExportUtils { public static void writeExportResult(File targetFolder, ExportResultLog result) { if (result.getEnd() == null) { result.setEnd(new Date()); } if (result.getExports().size() == 1) { result.setBegin(null); result.setEnd(null); } File resultFile = new File(targetFolder, PROARC_EXPORT_STATUSLOG); try { JAXB.marshal(result, resultFile); } catch (Exception e) { LOG.log(Level.SEVERE, targetFolder.toString(), e); } }  static File createFolder(File parent, String name, boolean overwrite); static File pidAsXmlFile(File output, String pid); static void writeExportResult(File targetFolder, ExportResultLog result); static void storeObjectExportResult(String pid, String target, String type, String log); static String toString(Iterable<?> lines); static String toString(Iterable<?> lines, String lineEnd); static String toString(Throwable ex); }
ExportUtils { public static void writeExportResult(File targetFolder, ExportResultLog result) { if (result.getEnd() == null) { result.setEnd(new Date()); } if (result.getExports().size() == 1) { result.setBegin(null); result.setEnd(null); } File resultFile = new File(targetFolder, PROARC_EXPORT_STATUSLOG); try { JAXB.marshal(result, resultFile); } catch (Exception e) { LOG.log(Level.SEVERE, targetFolder.toString(), e); } }  static File createFolder(File parent, String name, boolean overwrite); static File pidAsXmlFile(File output, String pid); static void writeExportResult(File targetFolder, ExportResultLog result); static void storeObjectExportResult(String pid, String target, String type, String log); static String toString(Iterable<?> lines); static String toString(Iterable<?> lines, String lineEnd); static String toString(Throwable ex); static final String PROARC_EXPORT_STATUSLOG; }