Package ch.inftec.ju.testing.db.DbDataUtil

Examples of ch.inftec.ju.testing.db.DbDataUtil.ExportBuilder


        }
       
        URL tablesDataSestUrl = JuUrl.resource().relativeTo(this.getTestClass()).get(dataSetExport.tablesDataSet());
        if (tablesDataSestUrl == null) tablesDataSestUrl = JuUrl.resource(dataSetExport.tablesDataSet());
       
        ExportBuilder eb = this.getDbDataUtil(emUtil).buildExport()
            .addTablesByDataSet(tablesDataSestUrl, true);
       
        doc = eb.writeToXmlDocument();
       
        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 = dataSetExport.resourcePrefix();
            String resourcePath = resourcePrefix + "/" + targetFileName;
            URL resourceUrl = JuUrl.singleResource(resourcePath);
            String resourceString = new IOUtil().loadTextFromUrl(resourceUrl);
           
            String xmlString = eb.writeToXmlString();
           
            logger.debug("Comparing DB export to resource {}", resourceUrl);
            Assert.assertEquals(resourceString, xmlString);
          } else {
            // Perform export to file
            String targetDirName = dataSetExport.targetDir();
            // Create target directory
            Path targetDirPath = Paths.get(this.getLocalRoot(), targetDirName);
            Files.createDirectories(targetDirPath);
           
            // Build file path
            Path targetFilePath = targetDirPath.resolve(targetFileName);
            eb.writeToXmlFile(targetFilePath);
          }
        } else if (dataSetExport.exportType() == ExportType.MEMORY) {
          // Log XML
          if (logger.isInfoEnabled()) {
            XString xs = new XString(targetFileName);
View Full Code Here


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

          , JuStringUtils.removeNonAlphabeticalLeadingCharacters(this.testMethodReadableName));
     
      URL tablesDataSestUrl = JuUrl.resource().relativeTo(this.getTestClass()).get(dataSetExport.tablesDataSet());
      if (tablesDataSestUrl == null) tablesDataSestUrl = JuUrl.resource(dataSetExport.tablesDataSet());
     
      ExportBuilder eb = new DbDataUtil(emUtil).buildExport()
          .addTablesByDataSet(tablesDataSestUrl, true);
     
      doc = eb.writeToXmlDocument();
     
      if (dataSetExport.doPhysicalExport()) {
        if (JuUtils.getJuPropertyChain().get("ju-testing.export.compareToResource", Boolean.class, true)) {
          // Perform export in-memory and compare to resource
          String resourcePrefix = dataSetExport.resourcePrefix();
          String resourcePath = resourcePrefix + "/" + targetFileName;
          URL resourceUrl = JuUrl.singleResource(resourcePath);
          String resourceString = new IOUtil().loadTextFromUrl(resourceUrl);
         
          String xmlString = eb.writeToXmlString();
         
          logger.debug("Comparing DB export to resource {}", resourceUrl);
          Assert.assertEquals(resourceString, xmlString);
        } else {
          // Perform export to file
          String targetDirName = dataSetExport.targetDir();
          // Create target directory
          Path targetDirPath = Paths.get(this.getLocalRoot(), targetDirName);
          Files.createDirectories(targetDirPath);
         
          // Build file path
          Path targetFilePath = targetDirPath.resolve(targetFileName);
          eb.writeToXmlFile(targetFilePath.toString());
        }
      } else {
        // Log XML
        if (logger.isInfoEnabled()) {
          XString xs = new XString(targetFileName);
View Full Code Here

        }
       
        URL tablesDataSestUrl = JuUrl.resource().relativeTo(this.getTestClass()).get(dataSetExport.tablesDataSet());
        if (tablesDataSestUrl == null) tablesDataSestUrl = JuUrl.resource(dataSetExport.tablesDataSet());
       
        ExportBuilder eb = this.getDbDataUtil(emUtil).buildExport()
            .addTablesByDataSet(tablesDataSestUrl, true);
       
        doc = eb.writeToXmlDocument();
       
        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 = dataSetExport.resourcePrefix();
            String resourcePath = resourcePrefix + "/" + targetFileName;
            URL resourceUrl = JuUrl.singleResource(resourcePath);
            String resourceString = new IOUtil().loadTextFromUrl(resourceUrl);
           
            String xmlString = eb.writeToXmlString();
           
            logger.debug("Comparing DB export to resource {}", resourceUrl);
            Assert.assertEquals(resourceString, xmlString);
          } else {
            // Perform export to file
            String targetDirName = dataSetExport.targetDir();
            // Create target directory
            Path targetDirPath = Paths.get(this.getLocalRoot(), targetDirName);
            Files.createDirectories(targetDirPath);
           
            // Build file path
            Path targetFilePath = targetDirPath.resolve(targetFileName);
            eb.writeToXmlFile(targetFilePath);
          }
        } else if (dataSetExport.exportType() == ExportType.MEMORY) {
          // Log XML
          if (logger.isInfoEnabled()) {
            XString xs = new XString(targetFileName);
View Full Code Here

TOP

Related Classes of ch.inftec.ju.testing.db.DbDataUtil.ExportBuilder

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.