org.specrunner.report.core
Class ResumeReporter

java.lang.Object
  extended by org.specrunner.report.core.ResumeReporter
All Implemented Interfaces:
IReporter

public class ResumeReporter
extends Object
implements IReporter

Reporter which accumulates resumes over execution.

Author:
Thiago Santos

Field Summary
static String FEATURE_DUMPERS
          Feature to set dumpers of report.
protected static int PERCENTAGE
          Divisor.
 
Constructor Summary
ResumeReporter()
           
 
Method Summary
 ResumeReporter add(IResumeDumper dumper)
          Add a dumper of resumes.
 void analyse(IContext context, IResultSet result, Map<String,Object> model)
          Add information to the reporter.
 double asPercentage(Long time)
          Returns a time as percentage.
protected  Resume createInstance(IResultSet result, Map<String,Object> model)
          Create a resume instance.
 List<IResumeDumper> getDumpers()
          Get dumpers list.
 int getIndex()
          Get resumes index.
 Status getResultStatus()
          Get execution status.
 List<Resume> getResumes()
          Get resume set.
 Map<Status,Integer> getStatus()
          Map of status counts.
 Long getTotal()
          Get total execution time.
 Map<ActionType,Integer> getTypes()
          Map if action types.
protected  Resume newResume(IContext context, IResultSet result, Map<String,Object> model)
          Create a resume of result.
protected  List<Resume> orderedList(List<Resume> list, Comparator<Resume> comparator)
          Creates a copy of the resume list.
 Object partial(SRServices services)
          Short information about report.
 void report(SRServices services)
          Dump report information.
protected  void setFeatures(SRServices services)
          Prepare feature settings.
 
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

FEATURE_DUMPERS

public static final String FEATURE_DUMPERS
Feature to set dumpers of report.

Constructor Detail

ResumeReporter

public ResumeReporter()
Method Detail

getTotal

public Long getTotal()
Get total execution time.

Returns:
Total time.

getIndex

public int getIndex()
Get resumes index.

Returns:
Index.

getResultStatus

public Status getResultStatus()
Get execution status.

Returns:
A status.

getStatus

public Map<Status,Integer> getStatus()
Map of status counts.

Returns:
Map of status to counts.

getTypes

public Map<ActionType,Integer> getTypes()
Map if action types.

Returns:
Map of types.

getResumes

public List<Resume> getResumes()
Get resume set.

Returns:
Resume set.

getDumpers

public List<IResumeDumper> getDumpers()
Get dumpers list.

Returns:
A list.

add

public ResumeReporter add(IResumeDumper dumper)
Add a dumper of resumes.

Parameters:
dumper - A dumper.
Returns:
The reporter itself.

setFeatures

protected void setFeatures(SRServices services)
Prepare feature settings.

Parameters:
services - Services.

analyse

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

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

partial

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

Specified by:
partial 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.

newResume

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

Parameters:
context - A test context.
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.

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.

asPercentage

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

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


Copyright © 2015. All rights reserved.