Package com.dtrules.xmlparser

Examples of com.dtrules.xmlparser.XMLPrinter


            throws Exception {
        RArray entitystack = new RArray(0,false,false);
        for(int i=0; i< session.getState().edepth()-2; i++){
            entitystack.add(session.getState().entityfetch(i));
        }
        session.printEntityReport(new XMLPrinter(out),true, false, session.getState(), "entitystack", entitystack);
    }
View Full Code Here


        removeIds(child);
      }
    }
    
    public void compareTestResults() throws Exception {
        XMLPrinter report = new XMLPrinter(compareTestResultsReport());
       
        System.out.println();
       
        report.opentag("results");
        File outputs = new File(getOutputDirectory());
        if(outputs == null || !outputs.isDirectory()){
            System.out.println("'"+getOutputDirectory()+"' does not exist or is not a directory");
        }
        boolean changes = false;
        boolean missingResults = false;
        File files[] = outputs.listFiles();
        for(File file : files){
            if(file.getName().endsWith("_results.xml")){
                Node result1=null, result2=null;
                try{
                    result1 = XMLTree.BuildTree(new FileInputStream(file),false,false);
                    result2 = XMLTree.BuildTree(new FileInputStream(getResultDirectory()+file.getName()),false, false);
                    if(result1 != null && result2 != null){
                        removeIds(result1);
                        removeIds(result2);
                        String msg = compareNodes(result1,result2);
                        if(msg == null){
                            report.printdata("match","file",file.getName(),"");
                        }else{
                          changes = true;
                          System.out.flush();
                          System.err.println(file.getName()+"--> "+msg);
                          System.err.flush();
                          report.printdata("resultChanged","file",file.getName(),msg);
                        }
                    }else{
                      System.out.flush();
                      System.err.println(file.getName()+" has no result file; No compare done.");
                      System.err.flush();
                        report.printdata("error","file",file.getName(),"");
                    }
                }catch (Exception e){
                  missingResults = true;
                    report.printdata("unknown","file",file.getName(),"Missing Files to do the compare");
                }
            }
        }
        report.closetag();
       
        if(changes){
          System.err.println("\nSome results have changed.  Check the TestResults.xml for all results.");
        }else{
          System.out.println("\nALL PASS: No changes found when compared to results files.");
View Full Code Here

           compareMapping(report);
       report.close();
   }
  
   public void compare(OutputStream reportStream) throws Exception {
       XMLPrinter report = new XMLPrinter(reportStream);
       compare(report);
   }
View Full Code Here

       compareDecisionTables(buff);
       return buff.toString();
   }
  
   public void compareDecisionTables(OutputStream reportStream) throws Exception {
       XMLPrinter report = new XMLPrinter(reportStream);
       compareDecisionTables(report);
   }
View Full Code Here

       return buff.toString();
   }
  
  
   public void compareEDD(OutputStream reportStream) throws Exception {
       XMLPrinter report = new XMLPrinter(reportStream);
       compareEDD(report);
   }
View Full Code Here

       return buff.toString();
   }
  
  
   public void compareMapping(OutputStream reportStream) throws Exception {
       XMLPrinter report = new XMLPrinter(reportStream);
       compareMapping(report);
   }
View Full Code Here

  /**
   * Print the TraceNode tree for this object.
   */
  public void print(){
    XMLPrinter out = new XMLPrinter(System.out);
    out.setSpaceCnt(2);
    if(root != null ){
      root.print( out);
    }else{
      System.out.println("No tree has been loaded");
    }
View Full Code Here

    private void coverage(File f) throws Exception {
        GenericXMLParser.load(new FileInputStream(f),new TraceLoad());
    }
   
    public void printReport(PrintStream o){
        XMLPrinter xout = new XMLPrinter(o);
        xout.opentag("coverage");
       
        xout.opentag("trace_files");
        for(String file : traceFilesProcessed){
            xout.printdata("trace_file",file);
        }
        xout.closetag();
       
       
        Object keys[] = tables.keySet().toArray();
       
        for(int i=0;i<keys.length-1;i++){
            for(int j=0;j<keys.length-1-i;j++){
                if(keys[j].toString().compareTo(keys[j+1].toString())>0){
                    Object hld = keys[j];
                    keys[j]    = keys[j+1];
                    keys[j+1= hld;
                }
            }
        }
       
        xout.opentag("tables");
        for(Object key : keys){
            Stats stats = tables.get(key);
            int total_columns = 0;
            int columns_covered = 0;
            if(stats.table.getHasNullColumn()){
               total_columns ++;
            }
            if(stats.noColumns>0){
                columns_covered++;
            }
            for(int i=0; i< stats.columnCount; i++){
                if(stats.table.getColumnsSpecified()[i]){
                    total_columns++;
                    if( stats.columnHits[i]>0){
                        columns_covered++;
                    }
                }
            }
        
            double fpercent = ((double) columns_covered / total_columns)*100.0;
            int    percent  = (int) fpercent;
            int    fraction = (int) ((fpercent - percent)*100);
           
            xout.opentag("table","name",key,"count_of_calls",stats.calledCount, "percent_covered",percent+"."+fraction);
           
            if(stats.table.getHasNullColumn()){
                xout.printdata("column","n","none","hits",stats.noColumns,null);
            }
           
            for(int i=0; i< stats.columnCount; i++){
                if(stats.table.getColumnsSpecified()[i]){
                    xout.printdata("column","n",i+1,"hits",stats.columnHits[i],null);
                }
            }
            xout.closetag();
        }
        xout.closetag();
        xout.closetag();
    }
View Full Code Here

          ITestHarness t = new TestKidAid();
          t.runTests();
      }
     
      public void printReport(int runNumber, IRSession session, PrintStream _out) throws RulesException {
          XMLPrinter xout = new XMLPrinter(_out);
          xout.opentag("results","runNumber",runNumber);
          RArray results = session.getState().find("job.results").rArrayValue();
          for(IRObject r :results){
              IREntity result = r.rEntityValue();

              xout.opentag("Client","id",result.get("client_id").stringValue());
              prt(xout,result,"totalGroupIncome");
              prt(xout,result,"client_fpl");
              if(result.get("eligible").booleanValue()){
                  xout.opentag("Approved");
                    prt(xout,result,"program");
                    prt(xout,result,"programLevel");
                    RArray notes = result.get("notes").rArrayValue();
                    xout.opentag("Notes");
                        for(IRObject n : notes){
                           xout.printdata("note",n.stringValue());
                        }
                      xout.closetag();
                  xout.closetag();
              }else{
                  xout.opentag("NotApproved");
                      prt(xout,result,"program");
                      RArray notes = result.get("notes").rArrayValue();
                      xout.opentag("Notes");
                          for(IRObject n : notes){
                             xout.printdata("note",n.stringValue());
                          }
                      xout.closetag();
                  xout.closetag();
              }
              xout.closetag();
          }
          xout.close();
      }
View Full Code Here

     * Set the output streams for debug and trace.
     */
    public void setOutput(OutputStream debugtrace, OutputStream error) {
        if (debugtrace != null) {
            outPs = new PrintStream(debugtrace);
            out = new XMLPrinter(outPs);
        }
        err = new PrintStream(error);
    }
View Full Code Here

TOP

Related Classes of com.dtrules.xmlparser.XMLPrinter

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.