Generating Text File using .exec file

37 views
Skip to first unread message

Saurabh Garg

unread,
Mar 25, 2015, 9:18:12 AM3/25/15
to jac...@googlegroups.com
hi is there any way i can generate a text file containing all missed lines.



in plugin i edited some things

Inside sourceannotator class i inserted a a condition as follows in printhighlighted lines method.
private void printHighlightedLine(StringBuilder buf, int lineNumber, ICounter cov, String sourceLine, int status) {
        String Color_Of_Line=getStatusColor(status);
        if (Color_Of_Line.equals("#ffaaaa"))
        {
        buf.append("<H1>"+lineNumber + ":");

        String tooltip = getTooltip(cov);
        if (tooltip != null) {
            buf.append("•<SPAN title=\"").append(tooltip).append("\"");
        } else {
            buf.append("<SPAN");
        }

        buf.append(" style=\"BACKGROUND-COLOR: " + getStatusColor(status) + "\">").append(sourceLine).append("</SPAN>").append("<br></H1>");
           
            try {
                Pappu.Write_to_text(lineNumber, sourceLine, Color_Of_Line, buf);
            } catch (IOException ex) {
                Logger.getLogger(SourceAnnotator.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        else{
        buf.append(lineNumber + ":");
        String tooltip = getTooltip(cov);
        if (tooltip != null) {
            buf.append("•<SPAN title=\"").append(tooltip).append("\"");
        } else {
            buf.append(" <SPAN");
        }

        buf.append(" style=\"BACKGROUND-COLOR: " + getStatusColor(status) + "\">").append(sourceLine).append("</SPAN>").append("<br>");
    }
   
    }


this function when find status as #ffaaaa it calls a method in which takes four arguments its definition is like this



public void Write_to_text(int LineNumber, String SourceLine, String Color_Of_Line,StringBuilder buf) throws IOException{
        String Java_Source_Path;
        String Experiment;//=null;
        SourceLine=SourceLine.replaceAll("&nbsp"," ").replaceAll("&lt","<").replaceAll("&gt",">");
        buf.append("<H1><br>This Point was reached " );
        buf.append("</H1>");
       
//        if (Java_Source_Path!=null)
//         {
//            Java_Source_Path=Java_Source_Path.substring(Java_Source_Path.indexOf("com")-1);   
//          }
        Java_Source_Path=getSource_Path();
        Experiment="\n" + Java_Source_Path +"\t" + LineNumber + "\t"+ SourceLine;
        buf.append("<H1><br>This Point was reached " + Experiment);
        buf.append("</H1>");
        FileWriter Jacoco_File_Writer = null;
        Jacoco_File_Create = new File("/home/test/RedLines.txt");
        try {
        Jacoco_File_Writer = new FileWriter(Jacoco_File_Create,true);
        Jacoco_File_Writer.write(Experiment);
        Jacoco_File_Writer.flush();
        Jacoco_File_Writer.close();
        } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        }                            
        JacocoPub.setWrite_to_Text(Experiment);
}   

but this method writes to text file only when i click to its report on console please help me so that i can get this string as soon as i build the project in jenkins

Marc R. Hoffmann

unread,
Mar 27, 2015, 12:47:28 AM3/27/15
to jac...@googlegroups.com
Hi,

so you integrated your code into the Jenkins plugin? In this case please ask at the JaCoCo Jenkins plug-in project how the lifecycle of the plug-in works and how to hook into the buid process.

Alternatively you coud e.g. create your own Maven or Ant plugin which gets executed with your build independently of Jenkins.

Regards,
-marc
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/c69acda5-c09b-4b89-989e-4fe76c6cad64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Saurabh Garg

unread,
Mar 27, 2015, 8:23:39 AM3/27/15
to jac...@googlegroups.com

Hi do you have any related links .. For this issue so that I may understand more on this matter

You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/lDyiPeI4BmI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/5514E0D7.8080604%40mountainminds.com.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages