static public ReportDTO parse(OMElement rep) throws XdsInternalException { ReportDTO r = new ReportDTO(); r.setName(rep.getAttributeValue(name_qname)); r.setValue(rep.toString()); // Was: r.setValue(rep.getText()); -- This caused & to be dropped out and appear simply as & Which caused wstxlazyexception unexpected character error. if (r.getName() == null || r.getName().equals("")) throw new XdsInternalException("Cannot parse Report: " + rep.toString()); return r; }
public void addReport(OMElement r) { ReportDTO reportDTO = new ReportDTO(); reportDTO.setName(r.getAttributeValue(new QName("name"))); reportDTO.setSection(r.getAttributeValue(new QName("section"))); reportDTO.setXpath(r.getText()); reportDTO.setEscapedCharsInXml(r.getAttributeValue(new QName("escapedCharsInXml"))); addReport(reportDTO); }
logger.info("Generating Report " + reportDTO.toString()); if (StringUtils.isBlank(reportDTO.getXpath())) continue; OMElement section = getSection(reportDTO.getSection()); if (section == null) { logger.error("Section " + reportDTO.getName() + " is not defined"); throw new XdsInternalException("Section " + reportDTO.getName() + " is not defined"); xpathExpression = new AXIOMXPath(reportDTO.getXpath()); if ("true".equals(reportDTO.getEscapedCharsInXml())) { String sectionStr = section.toString(); sectionStr = getDecodedStr(sectionStr); List nodeList = xpathExpression.selectNodes(section); if (nodeList.size() != 1) { logger.info("ReportManager: section path extraction failed! ReportDTO: " + reportDTO.toString()); logger.info(val); reportDTO.setValue(val); if (StringUtils.isBlank(val)) { val = "Report " + reportDTO.getName() + " which has XPath " + reportDTO.getXpath() + " evaluates to [" + val + "] when evaluated " + "against section " + reportDTO.getSection(); logger.info(val); throw new XdsInternalException("Error evaluating Report " + reportDTO.getName(), e);
@Override protected void run(OMElement request) throws Exception { PlanContext planContext = s_ctx.getPlan(); Map<String, String> params = planContext.getExtraLinkage(); for (String name : params.keySet()) { ReportDTO report = new ReportDTO(); report.setName(name); report.setValue(params.get(name)); getReportManager().addReport(report); } reportManagerPostRun(); }
public void add(String name, String value) { ReportDTO ur = new ReportDTO(name, value); reportDTOs.add(ur); }
public OMElement toXML() { OMElement top = MetadataSupport.om_factory.createOMElement("Reports", null); for (ReportDTO reportDTO : reportDTOs) { OMElement rep = MetadataSupport.om_factory.createOMElement("Report", null); rep.addAttribute("name", reportDTO.getName(), null); rep.setText(reportDTO.getValue()); top.addChild(rep); } return top; }
static public void setSection(List<ReportDTO> reportDTOs, String section) { for (ReportDTO reportDTO : reportDTOs) { reportDTO.setSection(section); } }
public void report(Map <String, String> map) { if (map == null) return; for (String name : map.keySet()) { String value = map.get(name); ReportDTO r = new ReportDTO(name, value); reportDTOs.add(r); } }
static public void setSection(List<ReportDTO> reportDTOs, String section) { for (ReportDTO reportDTO : reportDTOs) { reportDTO.setSection(section); } }
public void report(Map <String, String> map, String nameSuffix) { for (String name : map.keySet()) { String value = map.get(name); ReportDTO r = new ReportDTO(name + nameSuffix, value); reportDTOs.add(r); } }
public String reportsToString() { StringBuffer buf = new StringBuffer(); buf.append('['); for (String section : sectionLogs.keySet()) { buf.append("Section: ").append(section).append(": "); LogFileContentDTO log = sectionLogs.get(section); try { List<ReportDTO> reportDTOs = log.getReportDTOs(); for (ReportDTO r : reportDTOs) { r.setSection(section); } buf.append(reportDTOs.toString()); } catch (Exception e) { System.out.println("Cannot find Reports for section " + section); } } buf.append(']'); return buf.toString(); }
void reportStepParameters() { logger.info("generating linkageAsReports"); if (reportManager == null) reportManager = new ReportManager(testConfig); Map<String, String> params = getStep().getPlan().getExtraLinkage(); logger.info("transaction: " + params); for (String name : params.keySet()) { String value = params.get(name); ReportDTO reportDTO = new ReportDTO(name, value); logger.info("adding ReportDTO " + reportDTO); reportManager.addReport(reportDTO); logger.info("ReportBuilder manager has " + reportManager.toString()); } }
private void parseReports() { // See Issue #418 Duplicate UseReports/Reports in Conformance tool Section/Step UI (Test log.xml file contains singular values though). // without use of the map we get duplicates because of the Assertions // section of the log.xml file format // Map<String, String> map = new HashMap<>(); for (OMElement ele : XmlUtil.decendentsWithLocalName(root, "Report")) { String name = ele.getAttributeValue(nameQname); String value = ele.getText(); c.getReportsSummary().add(name + " = " + value); c.addReportDTO(new ReportDTO(name, value)); // map.put(name, value); } // for(String key : map.keySet()) { // c.getReportsSummary().add(key + " = " + map.get(key)); // c.addReportDTO(new ReportDTO(key, map.get(key))); // } }
private void prsSameKOSDcm(AssertionEngine engine, Assertion a, OMElement assertion_output) throws XdsInternalException { try { // pfn of std KON.dcm String pfn = a.xpath.trim(); String stdDcmPfn = Paths.get(testConfig.testplanDir.getAbsolutePath(), pfn).toString(); SimulatorTransaction simulatorTransaction = getSimulatorTransaction(a); simulatorTransaction.setStdPfn(stdDcmPfn); // load sop instance uid from test kos for later comparison String tstKOSPfn = simulatorTransaction.getPfns().get(0); DicomInputStream din = new DicomInputStream(new File(tstKOSPfn)); Attributes at = din.readDataset(-1, Tag.PixelData); String siu = at.getString(Tag.SOPInstanceUID); reportManager.addReport(new ReportDTO("SOPInstanceUID", siu)); din.close(); TestRAD68 testInstance = new TestRAD68(); testInstance.initializeTest(a.process, simulatorTransaction); testInstance.runTest(); Results results = testInstance.getResults(a.process); String rep = results.toString(); CAT cat = CAT.SUCCESS; if (results.getErrorCount() > 0) cat = CAT.ERROR; store(engine, cat, rep); reportManagerPostRun(); } catch (Exception e) { e.printStackTrace(); throw new XdsInternalException("ImgDetailTransaction - sameKOSDcm: " + e.getMessage()); } }