Title: [1564] trunk/core/distribution: JBEHAVE-133/240: Added dependency-injection documentation.

Diff

Modified: trunk/core/distribution/pom.xml (1563 => 1564)

--- trunk/core/distribution/pom.xml	2010-02-08 16:05:28 UTC (rev 1563)
+++ trunk/core/distribution/pom.xml	2010-02-09 10:29:26 UTC (rev 1564)
@@ -19,6 +19,16 @@
     </dependency>
     <dependency>
       <groupId>${pom.groupId}</groupId>
+      <artifactId>jbehave-pico</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>jbehave-spring</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
       <artifactId>jbehave-ant</artifactId>
       <version>${pom.version}</version>
     </dependency>
@@ -82,6 +92,46 @@
             </configuration>
           </execution>
           <execution>
+            <id>unpack-javadoc-pico</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.directory}/site/javadoc/pico</outputDirectory>
+              <overWriteReleases>false</overWriteReleases>
+              <overWriteSnapshots>true</overWriteSnapshots>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>${pom.groupId}</groupId>
+                  <artifactId>jbehave-pico</artifactId>
+                  <version>${pom.version}</version>
+                  <classifier>javadoc</classifier>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+          <execution>
+            <id>unpack-javadoc-spring</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.directory}/site/javadoc/spring</outputDirectory>
+              <overWriteReleases>false</overWriteReleases>
+              <overWriteSnapshots>true</overWriteSnapshots>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>${pom.groupId}</groupId>
+                  <artifactId>jbehave-spring</artifactId>
+                  <version>${pom.version}</version>
+                  <classifier>javadoc</classifier>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+          <execution>
             <id>unpack-javadoc-ant</id>
             <phase>generate-resources</phase>
             <goals>

Modified: trunk/core/distribution/src/site/content/dependencies.html (1563 => 1564)

--- trunk/core/distribution/src/site/content/dependencies.html	2010-02-08 16:05:28 UTC (rev 1563)
+++ trunk/core/distribution/src/site/content/dependencies.html	2010-02-09 10:29:26 UTC (rev 1564)
@@ -36,6 +36,24 @@
     href="" Maven Plugin</a>
 modules.</p>
 
+<h3>JBehave Pico</h3>
+
+<p>The <a href="" Pico</a> module
+requires the following dependencies (and their transitive dependencies)
+to be in the classpath (in addition to Core and its dependencies):</p>
+<ul>
+    <li><a href=""
+</ul>
+
+<h3>JBehave Spring</h3>
+
+<p>The <a href="" Spring</a> module
+requires the following dependencies (and their transitive dependencies)
+to be in the classpath (in addition to Core and its dependencies):</p>
+<ul>
+    <li><a href=""
+</ul>
+
 <h3>JBehave Ant</h3>
 
 <p>The <a href="" Ant</a> module

Added: trunk/core/distribution/src/site/content/dependency-injection.html (0 => 1564)

--- trunk/core/distribution/src/site/content/dependency-injection.html	                        (rev 0)
+++ trunk/core/distribution/src/site/content/dependency-injection.html	2010-02-09 10:29:26 UTC (rev 1564)
@@ -0,0 +1,86 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Dependency Injection</title>
+</head>
+
+<body>
+
+<h2>Introduction</h2>
+
+<p><a href=""
+Injection</a> has become an integral part of modern software design. We
+discuss here the different ways in which JBehave supports dependency
+injection.</p>
+
+<h2>Steps class-level injection</h2>
+
+<p>Steps classes often use external dependencies to interface to the
+system whose behaviour is being verified.</p>
+
+<h3>Using PicoContainer</h3>
+
+<p>Steps can be instantiated via PicoContainer using the <a
+    href=""
+(the extension module <b>jbehave-pico</b> needs to be added to the classpath):
+</p>
+
+<pre class="brush: java">
+public class PicoTraderScenario extends TraderScenario {
+
+    public PicoTraderScenario(Class scenarioClass) {
+        super(scenarioClass);
+    }
+
+    @Override
+    protected CandidateSteps[] createSteps(StepsConfiguration configuration) {
+        PicoContainer parent = createPicoContainer();
+        return new PicoStepsFactory(configuration, parent).createCandidateSteps();
+    }
+
+    private PicoContainer createPicoContainer() { 
+        // users can also use any other way to create a PicoContainer, e.g. via a script language        
+        MutablePicoContainer parent = new DefaultPicoContainer(new Caching().wrap(new ConstructorInjection()));
+        parent.as(Characteristics.USE_NAMES).addComponent(TradingService.class);
+        parent.as(Characteristics.USE_NAMES).addComponent(TraderSteps.class);
+        parent.as(Characteristics.USE_NAMES).addComponent(BeforeAfterSteps.class);
+        return parent;
+    }
+    
+}
+</pre>
+
+<h3>Using Spring</h3>
+
+<p>Steps can be instantiated via Spring using the <a
+    href=""
+(the extension module <b>jbehave-spring</b> needs to be added to the classpath):
+</p>
+
+<pre class="brush: java">
+public class SpringTraderScenario extends TraderScenario {
+
+    public SpringTraderScenario(Class scenarioClass) {
+        super(scenarioClass);
+    }
+
+    @Override
+    protected CandidateSteps[] createSteps(StepsConfiguration configuration) {
+        ListableBeanFactory parent = createBeanFactory();
+        return new SpringStepsFactory(configuration, parent).createCandidateSteps();
+    }
+
+    private ListableBeanFactory createBeanFactory() {
+        return (ListableBeanFactory) new ClassPathXmlApplicationContext(
+                new String[] { "org/jbehave/examples/trader/spring/steps.xml" });
+    }
+
+}
+</pre>
+
+<div class="clear">
+<hr />
+</div>
+
+</body>
+</html>

Modified: trunk/core/distribution/src/site/content/download.html (1563 => 1564)

--- trunk/core/distribution/src/site/content/download.html	2010-02-08 16:05:28 UTC (rev 1563)
+++ trunk/core/distribution/src/site/content/download.html	2010-02-09 10:29:26 UTC (rev 1564)
@@ -44,6 +44,16 @@
 specifying the correct version.
 </p>
 
+<p>If you are using the JBehave dependency-injection extensions
+you'll need to also add the corresponding module</p>
+<script type="syntaxhighlighter" class="brush: xml"><![CDATA[
+  <dependency> 
+    <groupId>org.jbehave</groupId>
+    <artifactId>jbehave-[pico|spring]</artifactId>
+    <version>[version]</version>
+  </dependency>
+]]></script>
+
 <p>JBehave was designed to be embeddable in different development
 environments. The <b>jbehave-core</b> contains support for running
 scenarios as JUnit tests - which can be run either in your favourite IDE

Modified: trunk/core/distribution/src/site/content/javadoc.html (1563 => 1564)

--- trunk/core/distribution/src/site/content/javadoc.html	2010-02-08 16:05:28 UTC (rev 1563)
+++ trunk/core/distribution/src/site/content/javadoc.html	2010-02-09 10:29:26 UTC (rev 1564)
@@ -11,6 +11,12 @@
 
 <p><a href="" Core</a> contains the fundamental functionality of JBehave</p>
 
+<h2>JBehave Extensions</h2>
+
+<p><a href="" Pico</a> adds support for dependency injection using <a href=""
+
+<p><a href="" Spring</a> adds support for dependency injection using <a href="" Framework</a></p>
+
 <h2>JBehave Plugins</h2>
 
 <p><a href="" Ant</a> contains the Ant task to run JBehave scenarios.</p>

Modified: trunk/core/distribution/src/site/content/sitemap.xml (1563 => 1564)

--- trunk/core/distribution/src/site/content/sitemap.xml	2010-02-08 16:05:28 UTC (rev 1563)
+++ trunk/core/distribution/src/site/content/sitemap.xml	2010-02-09 10:29:26 UTC (rev 1564)
@@ -31,6 +31,7 @@
   <section>
     <name>Advanced Topics</name>
     <page>aliases.html</page>
+    <page>dependency-injection.html</page>
     <page>parameter-injection.html</page>
     <page>parameter-converters.html</page>
     <page>table-examples.html</page>


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to