Title: [1617] trunk/core/examples/trader: JBEHAVE-277: Refactored ScenarioReporterBuilder to require explicit withDefaultFormats() invocation so it can be done after specification of the output directory.

Diff

Modified: trunk/core/examples/trader/build.xml (1616 => 1617)

--- trunk/core/examples/trader/build.xml	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/examples/trader/build.xml	2010-04-26 11:53:05 UTC (rev 1617)
@@ -95,7 +95,7 @@
       classpathref="scenario.classpath" />
 
     <reportRenderer outputDirectory="${basedir}/target/jbehave-reports"
-      formats="txt,html,xml" templateProperties="defaultFormats=stats\nrenderedDirectory=rendered" />
+      formats="txt,html,xml" templateProperties="defaultFormats=stats" />
 
   </target>
 

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

--- trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderScenario.java	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/TraderScenario.java	2010-04-26 11:53:05 UTC (rev 1617)
@@ -46,12 +46,9 @@
                 // specifying output allows a workaround for Ant classloader that return 
                 // $ANT_HOME/lib as the default code source location (cf JBEHAVE-277)
                 return new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, resolver))
-                            .outputTo("target/jbehave-reports") 
-                            .outputAsAbsolute(true)
-                            .with(CONSOLE)
-                            .with(TXT)
-                            .with(HTML)
-                            .with(XML)
+                            .outputTo("target/jbehave-reports").outputAsAbsolute(true)
+                            .withDefaultFormats()
+                            .with(CONSOLE).with(TXT).with(HTML).with(XML)
                             .build();
             }
 

Modified: trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/ClaimsWithNullCalendar.java (1616 => 1617)

--- trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/ClaimsWithNullCalendar.java	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/ClaimsWithNullCalendar.java	2010-04-26 11:53:05 UTC (rev 1617)
@@ -46,6 +46,8 @@
             @Override
             public ScenarioReporter forReportingScenarios() {
                 return new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, converter))
+                            .outputTo("target/jbehave").outputAsAbsolute(true)
+                            .withDefaultFormats()
                             .with(CONSOLE)
                             .with(TXT)
                             .with(HTML)

Modified: trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/PriorityMatching.java (1616 => 1617)

--- trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/PriorityMatching.java	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/PriorityMatching.java	2010-04-26 11:53:05 UTC (rev 1617)
@@ -34,6 +34,8 @@
             @Override
             public ScenarioReporter forReportingScenarios() {
                 return new ScenarioReporterBuilder(new FilePrintStreamFactory(PriorityMatching.class, resolver))
+                            .outputTo("target/jbehave").outputAsAbsolute(true)
+                            .withDefaultFormats()
                             .with(CONSOLE)
                             .with(TXT)
                             .with(HTML)

Modified: trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/spring/SpringTraderRunner.java (1616 => 1617)

--- trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/spring/SpringTraderRunner.java	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/examples/trader/src/main/java/org/jbehave/examples/trader/spring/SpringTraderRunner.java	2010-04-26 11:53:05 UTC (rev 1617)
@@ -76,11 +76,13 @@
 			}
 
 			@Override
-			public ScenarioReporter forReportingScenarios() {
-				return new ScenarioReporterBuilder(new FilePrintStreamFactory(
-						scenarioClass, resolver)).with(CONSOLE).with(TXT).with(
-						HTML).with(XML).build();
-			}
+            public ScenarioReporter forReportingScenarios() {
+                return new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, resolver))
+                            .outputTo("target/jbehave").outputAsAbsolute(true)
+                            .withDefaultFormats()
+                            .with(CONSOLE).with(TXT).with(HTML).with(XML)
+                            .build();
+            }
 		};
 	}
 }

Modified: trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/ScenarioReporterBuilderBehaviour.java (1616 => 1617)

--- trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/ScenarioReporterBuilderBehaviour.java	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/ScenarioReporterBuilderBehaviour.java	2010-04-26 11:53:05 UTC (rev 1617)
@@ -28,7 +28,7 @@
         ScenarioReporterBuilder builder = new ScenarioReporterBuilder(factory);
 
         // When
-        ScenarioReporter reporter = builder.build();
+        ScenarioReporter reporter = builder.withDefaultFormats().build();
         
         // Then
         ensureThat(reporter instanceof DelegatingScenarioReporter);
@@ -71,7 +71,7 @@
         };
         
         // When
-        ScenarioReporter reporter = builder.with(TXT).build();
+        ScenarioReporter reporter = builder.withDefaultFormats().with(TXT).build();
         
         // Then
         ensureThat(reporter instanceof DelegatingScenarioReporter);

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporterBuilder.java (1616 => 1617)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporterBuilder.java	2010-04-24 13:12:25 UTC (rev 1616)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporterBuilder.java	2010-04-26 11:53:05 UTC (rev 1617)
@@ -69,11 +69,10 @@
 
     public ScenarioReporterBuilder(FilePrintStreamFactory factory) {
         this.factory = factory;
-        withDefaultFormats();
     }
 
-    protected void withDefaultFormats() {
-        with(Format.STATS);
+    public ScenarioReporterBuilder withDefaultFormats() {
+        return with(Format.STATS);
     }
 
     public ScenarioReporter build() {


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to