Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String resultsFolder = "target"+java.io.File.separatorChar+"results";
            string resultsFolder = "target" + Path.DirectorySeparatorChar + "results";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String reportsFolder = "target"+java.io.File.separatorChar+"reports";
            string reportsFolder = "target" + Path.DirectorySeparatorChar + "reports";

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String htmlReportFilename = reportsFolder + java.io.File.separatorChar + "sql-statement-log-report.html";
            string htmlReportFilename = reportsFolder + Path.DirectorySeparatorChar + "sql-statement-log-report.html";

            const string jsonReportFilename = "sql-statement-log-report.json";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String jsonReportPath = reportsFolder + java.io.File.separatorChar + jsonReportFilename;
            string jsonReportPath = reportsFolder + Path.DirectorySeparatorChar + jsonReportFilename;

            const string csvReportFilename = "sql-statement-log-report.csv";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String csvReportPath = reportsFolder + java.io.File.separatorChar + csvReportFilename;
            string csvReportPath = reportsFolder + Path.DirectorySeparatorChar + csvReportFilename;

            // make sure reports folder exists
            File reportsFolderFile = new File(reportsFolder);

            if (!reportsFolderFile.exists())
            {
                reportsFolderFile.mkdir();
            }

            SqlStatementCountAggregator aggregator        = new SqlStatementCountAggregator(resultsFolder);
            TabularResultSet            aggregatedResults = aggregator.execute();

            // write Json report
            JsonUtil.writeObjectToFile(jsonReportPath, aggregatedResults);
            // write CSV Report
            CsvUtil.saveResultSetToFile(csvReportPath, aggregatedResults);

            // format HTML report
            HtmlReportBuilder reportWriter = (new HtmlReportBuilder(aggregatedResults)).name("Sql Statement Log Report").resultDetailsFolder(".." + Path.DirectorySeparatorChar + "results" + Path.DirectorySeparatorChar).createImageLinks(true).jsonSource(jsonReportFilename).csvSource(csvReportFilename);

            string report = reportWriter.execute();

            FileUtil.writeStringToFile(report, htmlReportFilename);
        }
Ejemplo n.º 2
0
        private static void writeReport(string resultsFolder, string reportsFolder, string benchmarkName, TabularResultAggregator aggregator, string reportDescription)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String htmlReportFilename = reportsFolder + java.io.File.separatorChar + benchmarkName+"-report.html";
            string htmlReportFilename = reportsFolder + Path.DirectorySeparatorChar + benchmarkName + "-report.html";

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String jsonReportFilename = benchmarkName+"-report.json";
            string jsonReportFilename = benchmarkName + "-report.json";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String jsonReportPath = reportsFolder + java.io.File.separatorChar + jsonReportFilename;
            string jsonReportPath = reportsFolder + Path.DirectorySeparatorChar + jsonReportFilename;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String csvReportFilename = benchmarkName+"-report.csv";
            string csvReportFilename = benchmarkName + "-report.csv";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String csvReportPath = reportsFolder + java.io.File.separatorChar + csvReportFilename;
            string csvReportPath = reportsFolder + Path.DirectorySeparatorChar + csvReportFilename;

            // make sure reports folder exists
            File reportsFolderFile = new File(reportsFolder);

            if (!reportsFolderFile.exists())
            {
                reportsFolderFile.mkdir();
            }

            TabularResultSet aggregatedResults = aggregator.execute();

            // write Json report
            JsonUtil.writeObjectToFile(jsonReportPath, aggregatedResults);

            // format HTML report
            HtmlReportBuilder reportWriter = (new HtmlReportBuilder(aggregatedResults)).name(reportDescription).resultDetailsFolder(".." + Path.DirectorySeparatorChar + "results" + Path.DirectorySeparatorChar).createImageLinks(true).jsonSource(jsonReportFilename).csvSource(csvReportFilename);

            string report = reportWriter.execute();

            FileUtil.writeStringToFile(report, htmlReportFilename);

            // write CSV report
            CsvUtil.saveResultSetToFile(csvReportPath, aggregatedResults);
        }