Package ch.inftec.ju.util.xml

Examples of ch.inftec.ju.util.xml.XmlOutputConverter


     
      this.doWork(new DataSetWork() {
        @Override
        public void execute(IDataSet dataSet) {
          try {
            XmlOutputConverter xmlConv = new XmlOutputConverter();
            ExportBuilder.writeToXml(dataSet, xmlConv.getOutputStream());
            doc.setValue(xmlConv.getDocument());
          } catch (Exception ex) {
            throw new JuDbException("Couldn't write DB data to XML document", ex);
          }
        }
      });
View Full Code Here


     
      this.doWork(new DataSetWork() {
        @Override
        public void execute(IDataSet dataSet) {
          try {
            XmlOutputConverter xmlConv = new XmlOutputConverter();
            ExportBuilder.writeToXml(dataSet, xmlConv.getOutputStream());
            doc.setValue(xmlConv.getDocument());
          } catch (Exception ex) {
            throw new JuDbException("Couldn't write DB data to XML document", ex);
          }
        }
      });
View Full Code Here

        String targetFileName = getExportFileName(dataSetExport);
       
        URL tablesDataSestUrl = JuUrl.resource().relativeTo(this.getTestClass()).get(dataSetExport.tablesDataSet());
        if (tablesDataSestUrl == null) tablesDataSestUrl = JuUrl.resource(dataSetExport.tablesDataSet());
       
        XmlOutputConverter xmlOutput = this.getDbDataUtil(emUtil).buildExport()
            .addTablesByDataSet(tablesDataSestUrl, true)
            .writeToXml();
       
        doc = xmlOutput.getDocument();
       
        if (dataSetExport.exportType() == ExportType.PHYSICAL) {
          if (JuUtils.getJuPropertyChain().get("ju-testing.export.compareToResource", Boolean.class, true)) {
            // Perform export in-memory and compare to resource
            String resourcePrefix = this.dataSetConfigInfo.getResourcePrefix();
            String resourcePath = resourcePrefix + "/" + targetFileName;
            URL resourceUrl = JuUrl.singleResource(resourcePath);
            String resourceString = new IOUtil().loadTextFromUrl(resourceUrl);
           
            String xmlString = xmlOutput.getXmlString();
           
            logger.debug("Comparing DB export to resource {}", resourceUrl);
            Assert.assertEquals(resourceString, xmlString);
          } else {
            // Perform export to file
            String targetDirName = this.dataSetConfigInfo.getResourceDirectoryFull();
            // Create target directory
            Path targetDirPath = Paths.get(this.getLocalRoot(), targetDirName);
            Files.createDirectories(targetDirPath);
           
            // Build file path
            Path targetFilePath = targetDirPath.resolve(targetFileName);
            xmlOutput.writeToXmlFile(targetFilePath);
          }
        } else if (dataSetExport.exportType() == ExportType.MEMORY) {
          // Log XML
          if (logger.isInfoEnabled()) {
            XString xs = new XString(targetFileName);
View Full Code Here

     
      this.doWork(new DataSetWork() {
        @Override
        public void execute(IDataSet dataSet) {
          try {
            XmlOutputConverter xmlConv = new XmlOutputConverter();
            ExportBuilder.writeToXml(dataSet, xmlConv.getOutputStream());
            doc.setValue(xmlConv);
          } catch (Exception ex) {
            throw new JuDbException("Couldn't write DB data to XML Output Converter", ex);
          }
        }
View Full Code Here

  @Test
  public void canExportData_toXmlOutputConverter() throws Exception {
    this.prepareExportData();
   
    DbDataUtil du = new DbDataUtil(this.em);
    XmlOutputConverter xmlOutput = du.buildExport().addTable("TestingEntity").writeToXml();
   
    // Make sure we can get the document
    this.assertXmlDocumentExport(xmlOutput.getDocument());
   
    // Make sure we can get the XML String
    TestUtils.assertEqualsResource("DbDataUtilTest_canExportData_toXmlOutputConverter.xml", xmlOutput.getXmlString());
  }
View Full Code Here

     
      this.doWork(new DataSetWork() {
        @Override
        public void execute(IDataSet dataSet) {
          try {
            XmlOutputConverter xmlConv = new XmlOutputConverter();
            ExportBuilder.writeToXml(dataSet, xmlConv.getOutputStream());
            doc.setValue(xmlConv.getDocument());
          } catch (Exception ex) {
            throw new JuDbException("Couldn't write DB data to XML document", ex);
          }
        }
      });
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.xml.XmlOutputConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.