// a.writeComponentsHTML("/stash/");
// a.writeComponentsHTML("/Users/michaelneale/foo.html");
// a.writeComponentsHTML("/home/trikkola/");
// a.writeComponentsHTML("c:/");
VerifierReport result = verifier.getResult();
VerifierReportWriter reportwriter = VerifierReportWriterFactory.newHTMLReportWriter();
FileOutputStream out = new FileOutputStream( "/Users/rikkola/Desktop/testReport.zip" );
reportwriter.writeReport( out,
result );
Collection<VerifierMessageBase> msgs = result.getBySeverity( Severity.ERROR );
for ( Iterator iterator = msgs.iterator(); iterator.hasNext(); ) {
VerifierMessageBase msg = (VerifierMessageBase) iterator.next();
System.out.println( "ERR: " + msg.getMessage() );
}
msgs = result.getBySeverity( Severity.WARNING );
for ( Iterator iterator = msgs.iterator(); iterator.hasNext(); ) {
VerifierMessageBase msg = (VerifierMessageBase) iterator.next();
System.out.println( "WARN (" + msg.getClass().getSimpleName() + "): " + msg.getMessage() );
System.out.println( "\t FAULT: [" + msg.getClass().getSimpleName() + "] " + msg.getFaulty() );
if ( msg instanceof VerifierMessage ) {
System.out.println( "\t CAUSES (message):" );
VerifierMessage amsg = (VerifierMessage) msg;
for ( Iterator iterator2 = amsg.getCauses().iterator(); iterator2.hasNext(); ) {
Cause c = (Cause) iterator2.next();
System.out.println( "\t\t [" + c.getClass().getSimpleName() + "]" + c );
}
} else if ( msg instanceof VerifierRangeCheckMessage ) {
System.out.println( "\t CAUSES (range):" );
VerifierRangeCheckMessage amsg = (VerifierRangeCheckMessage) msg;
for ( Iterator iterator2 = amsg.getCauses().iterator(); iterator2.hasNext(); ) {
Cause c = (Cause) iterator2.next();
System.out.println( "\t\t" + c );
}
}
}
msgs = result.getBySeverity( Severity.NOTE );
for ( Iterator iterator = msgs.iterator(); iterator.hasNext(); ) {
VerifierMessageBase msg = (VerifierMessageBase) iterator.next();
System.out.println( "NOTE: " + msg.getMessage() );
System.out.println( "\t" + msg.getFaulty() );
}
Collection<ObjectType> classes = result.getVerifierData().getAll( VerifierComponentType.OBJECT_TYPE );
for ( Iterator iterator = classes.iterator(); iterator.hasNext(); ) {
ObjectType c = (ObjectType) iterator.next();
Collection<VerifierRule> cr = result.getVerifierData().getRulesByObjectTypePath( c.getPath() );
System.err.println( "Class rules:" + cr );
Set<Field> flds = c.getFields();
for ( Iterator iterator2 = flds.iterator(); iterator2.hasNext(); ) {
Field f = (Field) iterator2.next();
cr = result.getVerifierData().getRulesByFieldPath( f.getPath() );
System.err.println( "Field rules: " + cr );
}
}