/** * Convert a result into a string, where the fields of the result are * separated by the default delimiter. * * @param event * the sample event to be converted * @return the separated value representation of the result */ public static String resultToDelimitedString(SampleEvent event) { return resultToDelimitedString(event, event.getResult().getSaveConfig() .getDelimiter()); }
/** * Convert a result into a string, where the fields of the result are * separated by a specified String. * * @param event * the sample event to be converted * @param delimiter * the separation string * @return the separated value representation of the result */ public static String resultToDelimitedString(SampleEvent event, final String delimiter) { return resultToDelimitedString(event, event.getResult(), event.getResult().getSaveConfig(), delimiter); }
/** * @param event {@link SampleEvent} * @param out {@link PrintWriter} to which samples will be written */ public static void saveSampleResult(SampleEvent event, PrintWriter out) { SampleSaveConfiguration saveConfiguration = event.getResult().getSaveConfig(); String delimiter = saveConfiguration.getDelimiter(); String savee = resultToDelimitedString(event, event.getResult(), saveConfiguration, delimiter); out.println(savee); if(saveConfiguration.saveSubresults()) { SampleResult result = event.getResult(); for (SampleResult subResult : result.getSubResults()) { savee = resultToDelimitedString(event, subResult, saveConfiguration, delimiter); out.println(savee); } } } }
public void mergeSamples(CorrectedResultCollector crc, List<SampleResult> samples) { SampleEvent event; try { initializeFileOutput(crc.getFilename(), crc.getSaveConfig()); } catch (IOException e) { log.warn("Error trying to initialize output file " + e.toString()); } for (SampleResult result : samples) { SampleSaveConfiguration config = crc.getSaveConfig(); event = new SampleEvent(result, null); try { if (config.saveAsXml()) { SaveService.saveSampleResult(event, out); } else { // !saveAsXml String savee = CSVSaveService .resultToDelimitedString(event); out.println(savee); } } catch (Exception err) { log.error("Error trying to record a sample", err); // should throw exception back to caller } } finalizeFileOutput(); }
public void mergeSamples(CorrectedResultCollector crc, List<SampleResult> samples) { SampleEvent event; try { initializeFileOutput(crc.getFilename(), crc.getSaveConfig()); } catch (IOException e) { log.warn("Error trying to initialize output file " + e.toString()); } for (SampleResult result : samples) { SampleSaveConfiguration config = crc.getSaveConfig(); event = new SampleEvent(result, null); try { if (config.saveAsXml()) { SaveService.saveSampleResult(event, out); } else { // !saveAsXml String savee = CSVSaveService .resultToDelimitedString(event); out.println(savee); } } catch (Exception err) { log.error("Error trying to record a sample", err); // should throw exception back to caller } } finalizeFileOutput(); }