org.specrunner.report.core
Class AbstractReport

java.lang.Object
  extended by org.specrunner.report.core.AbstractReport
All Implemented Interfaces:
IReporter
Direct Known Subclasses:
ReporterTxt

public abstract class AbstractReport
extends Object
implements IReporter

Generic extractor of usefull information for reporter dumps.

Author:
Thiago Santos

Field Summary
static List<ReportPart> DEFAULT_PARTS
          Default behavior.
static String FEATURE_PARTS
          Feature to set parts of report.
protected  int index
          The test index.
protected  List<ReportPart> parts
          Final report parts.
protected static int PERCENTAGE
          Divisor.
protected  List<Resume> resumes
          List of resume of results.
protected  Map<Status,Integer> status
          Hash of state counters.
protected  Long total
          Total processing time.
protected  Map<ActionType,Integer> types
          Hash of actions counters.
 
Constructor Summary
AbstractReport()
           
 
Method Summary
 void analyse(IResultSet result, Map<String,Object> model)
          Add information to the reporter.
protected  double asPercentage(Long time)
          Returns a time as percentage.
protected  Resume createInstance(IResultSet result, Map<String,Object> model)
          Create a resume instance.
protected  Resume createResume(IResultSet result, Map<String,Object> model)
          Create a resume of result.
protected abstract  void dumpEnd(SRServices services)
          Dump report ending.
protected abstract  void dumpPart(SRServices services, String header, List<Resume> list)
          Dump the resume declaration.
protected abstract  void dumpResume(SRServices services, String resume)
          Dump resume.
protected abstract  void dumpStart(SRServices services)
          Dump report starting.
 List<ReportPart> getParts()
          Get the report pats.
protected  List<Resume> orderedList(List<Resume> list, Comparator<Resume> comparator)
          Creates a copy of the resume list.
 void report(SRServices services)
          Dump report information.
 String resume(SRServices services)
          Short information about report.
protected  String resume(SRServices services, boolean finalResume)
          Partial resume.
protected  void setFeatures(SRServices services)
          Prepare feature settings.
 void setParts(List<ReportPart> parts)
          Set the parts.
protected  String status()
          Global status as string.
protected  String types()
          Global action types as string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERCENTAGE

protected static final int PERCENTAGE
Divisor.

See Also:
Constant Field Values

total

protected Long total
Total processing time.


index

protected int index
The test index.


status

protected Map<Status,Integer> status
Hash of state counters.


types

protected Map<ActionType,Integer> types
Hash of actions counters.


resumes

protected List<Resume> resumes
List of resume of results.


FEATURE_PARTS

public static final String FEATURE_PARTS
Feature to set parts of report.


parts

protected List<ReportPart> parts
Final report parts.


DEFAULT_PARTS

public static final List<ReportPart> DEFAULT_PARTS
Default behavior.

Constructor Detail

AbstractReport

public AbstractReport()
Method Detail

getParts

public List<ReportPart> getParts()
Get the report pats.

Returns:
The parts.

setParts

public void setParts(List<ReportPart> parts)
Set the parts.

Parameters:
parts - The parts.

setFeatures

protected void setFeatures(SRServices services)
Prepare feature settings.

Parameters:
services - Services.

analyse

public void analyse(IResultSet result,
                    Map<String,Object> model)
Description copied from interface: IReporter
Add information to the reporter.

Specified by:
analyse in interface IReporter
Parameters:
result - The result.
model - The model.

resume

public String resume(SRServices services)
Description copied from interface: IReporter
Short information about report.

Specified by:
resume in interface IReporter
Parameters:
services - The services instance to be used. This is required, since report is made on shutdown process, where SRServices.get() is not available.
Returns:
A partial version of resume.

resume

protected String resume(SRServices services,
                        boolean finalResume)
Partial resume.

Parameters:
services - The services instance.
finalResume - If it is the final resume.
Returns:
The resume.

status

protected String status()
Global status as string.

Returns:
The overall execution resume.

types

protected String types()
Global action types as string.

Returns:
The overall execution resume.

createResume

protected Resume createResume(IResultSet result,
                              Map<String,Object> model)
Create a resume of result.

Parameters:
result - The result.
model - The model.
Returns:
The resume.

createInstance

protected Resume createInstance(IResultSet result,
                                Map<String,Object> model)
Create a resume instance. Override it to a different report.

Parameters:
result - The result set.
model - The model.
Returns:
A new resume instance.

report

public void report(SRServices services)
Description copied from interface: IReporter
Dump report information.

Specified by:
report in interface IReporter
Parameters:
services - The services instance to be used. This is required, since report is made on shutdown process, where SRServices.get() is not available.

dumpStart

protected abstract void dumpStart(SRServices services)
Dump report starting.

Parameters:
services - Current instance.

orderedList

protected List<Resume> orderedList(List<Resume> list,
                                   Comparator<Resume> comparator)
Creates a copy of the resume list.

Parameters:
list - The list to be ordered.
comparator - The comparator.
Returns:
The list ordered.

dumpPart

protected abstract void dumpPart(SRServices services,
                                 String header,
                                 List<Resume> list)
Dump the resume declaration.

Parameters:
services - Current instance.
header - The header.
list - The list of resumes.

dumpResume

protected abstract void dumpResume(SRServices services,
                                   String resume)
Dump resume.

Parameters:
services - Current instance.
resume - Resume information.

dumpEnd

protected abstract void dumpEnd(SRServices services)
Dump report ending.

Parameters:
services - Current instance.

asPercentage

protected double asPercentage(Long time)
Returns a time as percentage.

Parameters:
time - The time.
Returns:
The percentage value.


Copyright © 2014. All rights reserved.