[jbehave-dev] [jira] Resolved: (JBEHAVE-228) ScenarioReporterBuilder

2009-12-26 Thread Mauro Talevi (JIRA)

 [ 
http://jira.codehaus.org/browse/JBEHAVE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mauro Talevi resolved JBEHAVE-228.
--

Resolution: Fixed

> ScenarioReporterBuilder
> ---
>
> Key: JBEHAVE-228
> URL: http://jira.codehaus.org/browse/JBEHAVE-228
> Project: JBehave
>  Issue Type: New Feature
>  Components: Core
>Reporter: Mauro Talevi
>Assignee: Mauro Talevi
> Fix For: 2.4
>
>
> A scenario reporter builder that allows easy instantiation of a delegating 
> scenario reporter for multiple formats, e.g.
> {code}
> new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
> converter))
> .with(CONSOLE).with(STATS)
> .with(TXT).with(HTML).with(XML)
> .build();
> {code}
> It should provide a default for all formats, but allow for configurability 
> for each format.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-scm] [1471] trunk/core/distribution/src/site/content: JBEHAVE-228: Added ScenarioReporterBuilder.

2009-12-26 Thread mauro
Title:  [1471] trunk/core/distribution/src/site/content: JBEHAVE-228: Added ScenarioReporterBuilder.







Revision 1471
Author mauro
Date 2009-12-26 05:11:17 -0600 (Sat, 26 Dec 2009)


Log Message
JBEHAVE-228: Added ScenarioReporterBuilder.  Updated trader example and PrintStreamScenarioReporterBehaviour to use it.   Updated documentation.

Modified Paths

trunk/core/distribution/src/site/content/reports.html
trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderScenario.java
trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporterBehaviour.java
trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/FilePrintStreamFactory.java


Added Paths

trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporterBuilder.java




Diff

Modified: trunk/core/distribution/src/site/content/reports.html (1470 => 1471)

--- trunk/core/distribution/src/site/content/reports.html	2009-12-24 17:50:15 UTC (rev 1470)
+++ trunk/core/distribution/src/site/content/reports.html	2009-12-26 11:11:17 UTC (rev 1471)
@@ -53,29 +53,23 @@
 
 @Override
 public ScenarioReporter forReportingScenarios() {
-return new DelegatingScenarioReporter(
-// report to System.out
-new PrintStreamScenarioReporter(),
-// report to .txt file in PLAIN format
-new PrintStreamScenarioReporter(new FilePrintStreamFactory(scenarioClass, converter,
-new FileConfiguration("txt")).getPrintStream()),
-// report to .html file in HTML format
-new HtmlPrintStreamScenarioReporter(new FilePrintStreamFactory(scenarioClass, converter,
-new FileConfiguration("html")).getPrintStream()),
-// report to .xml file in XML format
-new XmlPrintStreamScenarioReporter(new FilePrintStreamFactory(scenarioClass, converter,
-new FileConfiguration("xml")).getPrintStream()),
-// report to .stats file in Properties format
-new StatisticsScenarioReporter(new FilePrintStreamFactory(scenarioClass, converter,
-new FileConfiguration("stats")).getPrintStream()));
+return new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, converter))
+.with(CONSOLE) // report to System.out
+.with(STATS)  // report to .stats file in Properties format
+.with(TXT)// report to .txt file in PLAIN format
+.with(HTML)   // report to .html file in HTML format
+.with(XML)// report to .xml file in XML format
+.build();
 }
 
 }, new TraderSteps());
 }
 
 
-Note that for the file-based reporters we use the +Note that we use the  in which we inject the @@ -84,6 +78,22 @@
 we'll end up with file report outputs of the form: com.example.my_scenario.[format]
 (where format is any of txt,html,xml,stats in the example above).
 
+The builder provides defaults for all the formats supported, but if the user needs to create a bespoke instance of 
+a reporter for a given format, it can be easily done by overriding the default.  E.g. to override the reporter for TXT format
+to use a ".text" extension (a possibly keywords for a different Locale):
+
+
+ScenarioReporter reporter = new ScenarioReporterBuilder(factory){
+   public ScenarioReporter reporterFor(Format format){
+   switch (format) {
+   case TXT:
+   factory.useConfiguration(new FileConfiguration("text"));
+   return new PrintStreamScenarioReporter(factory.getPrintStream(), new Properties(),  new I18nKeyWords(Locale.ITALIAN), true);
+default:
+   return super.reporterFor(format);
+   }
+   }
+
 Report Rendering
 
 The generation of the reports is only the first part of a


Modified: trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderScenario.java (1470 => 1471)

--- trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderScenario.java	2009-12-24 17:50:15 UTC (rev 1470)
+++ trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderScenario.java	2009-12-26 11:11:17 UTC (rev 1471)
@@ -1,5 +1,11 @@
 package org.jbehave.examples.trader;
 
+import static org.jbehave.scenario.reporters.ScenarioReporterBuilder.Format.CONSOLE;
+import static org.jbehave.scenario.reporters.ScenarioReporterBuilder.Format.HTML;
+import static org.jbehave.scenario.reporters.ScenarioReporterBuilder.Form

[jbehave-dev] [jira] Updated: (JBEHAVE-228) ScenarioReporterBuilder

2009-12-26 Thread Mauro Talevi (JIRA)

 [ 
http://jira.codehaus.org/browse/JBEHAVE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mauro Talevi updated JBEHAVE-228:
-

Description: 
A scenario reporter builder that allows easy instantiation of a delegating 
scenario reporter for multiple formats, e.g.

{code}
new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
converter))
.with(CONSOLE).with(STATS)
.with(TXT).with(HTML).with(XML)
.build();
{code}

It should provide a default for all formats, but allow for configurability for 
each format.

  was:
A scenario reporter builder that allows easy instantiation of a delegating 
scenario reporter for multiple formats, e.g.


new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
converter))
.with(CONSOLE).with(STATS)
.with(TXT).with(HTML).with(XML)
.build();


It should provide a default for all formats, but allow for configurability for 
each format.


> ScenarioReporterBuilder
> ---
>
> Key: JBEHAVE-228
> URL: http://jira.codehaus.org/browse/JBEHAVE-228
> Project: JBehave
>  Issue Type: New Feature
>  Components: Core
>Reporter: Mauro Talevi
>Assignee: Mauro Talevi
> Fix For: 2.4
>
>
> A scenario reporter builder that allows easy instantiation of a delegating 
> scenario reporter for multiple formats, e.g.
> {code}
> new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
> converter))
> .with(CONSOLE).with(STATS)
> .with(TXT).with(HTML).with(XML)
> .build();
> {code}
> It should provide a default for all formats, but allow for configurability 
> for each format.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] Updated: (JBEHAVE-228) ScenarioReporterBuilder

2009-12-26 Thread Mauro Talevi (JIRA)

 [ 
http://jira.codehaus.org/browse/JBEHAVE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mauro Talevi updated JBEHAVE-228:
-

Description: 
A scenario reporter builder that allows easy instantiation of a delegating 
scenario reporter for multiple formats, e.g.


new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
converter))
.with(CONSOLE).with(STATS)
.with(TXT).with(HTML).with(XML)
.build();


It should provide a default for all formats, but allow for configurability for 
each format.

  was:
A scenario reporter builder that allows easy instantiation of a delegating 
scenario reporter for multiple formats, e.g.


new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
converter))
.with(CONSOLE).with(STATS)
.with(TXT).with(HTML).with(XML)
.build();


It should provide default for all formats, but allow for configurability for 
each format.


> ScenarioReporterBuilder
> ---
>
> Key: JBEHAVE-228
> URL: http://jira.codehaus.org/browse/JBEHAVE-228
> Project: JBehave
>  Issue Type: New Feature
>  Components: Core
>Reporter: Mauro Talevi
>Assignee: Mauro Talevi
> Fix For: 2.4
>
>
> A scenario reporter builder that allows easy instantiation of a delegating 
> scenario reporter for multiple formats, e.g.
> 
> new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
> converter))
> .with(CONSOLE).with(STATS)
> .with(TXT).with(HTML).with(XML)
> .build();
> 
> It should provide a default for all formats, but allow for configurability 
> for each format.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] Created: (JBEHAVE-228) ScenarioReporterBuilder

2009-12-26 Thread Mauro Talevi (JIRA)
ScenarioReporterBuilder
---

 Key: JBEHAVE-228
 URL: http://jira.codehaus.org/browse/JBEHAVE-228
 Project: JBehave
  Issue Type: New Feature
  Components: Core
Reporter: Mauro Talevi
Assignee: Mauro Talevi
 Fix For: 2.4


A scenario reporter builder that allows easy instantiation of a delegating 
scenario reporter for multiple formats, e.g.


new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, 
converter))
.with(CONSOLE).with(STATS)
.with(TXT).with(HTML).with(XML)
.build();


It should provide default for all formats, but allow for configurability for 
each format.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email