Title: [1010] trunk: Dropped container support spike (now a branch if needed).
Revision
1010
Author
mauro
Date
2008-11-18 17:56:34 -0600 (Tue, 18 Nov 2008)

Log Message

Dropped container support spike (now a branch if needed).
A more injectable and IoC-friendly approach is more elegant and desirable.

Modified Paths

Removed Paths

Diff

Modified: trunk/examples/trader/pom.xml (1009 => 1010)

--- trunk/examples/trader/pom.xml	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/examples/trader/pom.xml	2008-11-18 23:56:34 UTC (rev 1010)
@@ -10,18 +10,6 @@
   <name>JBehave Trader Example</name>
 
   <dependencies>
-    <dependency>
-      <groupId>org.picocontainer.script</groupId>
-      <artifactId>picocontainer-script-core</artifactId>
-      <version>2.0</version>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.thoughtworks.xstream</groupId>
-      <artifactId>xstream</artifactId>
-      <version>1.3</version>
-      <scope>compile</scope>
-    </dependency>
   </dependencies>
   <build>
     <sourceDirectory>src/main/java</sourceDirectory>

Deleted: trunk/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/TraderContainerSteps.java (1009 => 1010)

--- trunk/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/TraderContainerSteps.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/examples/trader/src/main/java/org/jbehave/examples/trader/scenarios/TraderContainerSteps.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,58 +0,0 @@
-package org.jbehave.examples.trader.scenarios;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.jbehave.Ensure.ensureThat;
-
-import java.util.List;
-
-import org.jbehave.container.Container;
-import org.jbehave.examples.trader.container.TraderContainer;
-import org.jbehave.examples.trader.model.Stock;
-import org.jbehave.examples.trader.model.Trader;
-import org.jbehave.examples.trader.persistence.TraderPersister;
-import org.jbehave.scenario.annotations.Given;
-import org.jbehave.scenario.annotations.Then;
-import org.jbehave.scenario.annotations.When;
-import org.jbehave.scenario.steps.Steps;
-import org.jbehave.scenario.steps.StepsConfiguration;
-
-public class TraderContainerSteps extends Steps {
-
-    private double threshold;
-    private Stock stock;
-    private Trader trader;
-    private Container container;
-
-    public TraderContainerSteps(double threshold, ClassLoader classLoader) {
-        super(new StepsConfiguration());
-        this.threshold = threshold;
-        this.container = new TraderContainer(classLoader);
-    }
-
-    @Given("a trader of name $name")
-    public void aTrader(String name) {
-        this.trader = container.getComponent(TraderPersister.class).retrieveTrader(name);
-    }
-
-    @Given("a stock of prices $prices")
-    public void aStockOfPrice(List<Double> prices) {
-        stock = new Stock(prices, threshold);
-    }
-
-    @When("the stock is traded at $price")
-    public void theStockIsTradedAt(double price) {
-        stock.tradeAt(price);
-    }
-
-    @Then("the alert status should be $status")
-    public void theAlertStatusShouldBe(String status) {
-        ensureThat(stock.getStatus().name(), equalTo(status));
-    }
-
-    @Then("the trader sells all stocks")
-    public void theTraderSellsAllStocks() {
-        trader.sellAllStocks();
-        ensureThat(trader.getStocks().size(), equalTo(0));
-    }
-
-}

Modified: trunk/jbehave-core/pom.xml (1009 => 1010)

--- trunk/jbehave-core/pom.xml	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/pom.xml	2008-11-18 23:56:34 UTC (rev 1010)
@@ -16,14 +16,6 @@
       <groupId>org.apache.ant</groupId>
       <artifactId>ant</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.picocontainer.script</groupId>
-      <artifactId>picocontainer-script-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-    </dependency>
   </dependencies>
 
 </project>

Deleted: trunk/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java (1009 => 1010)

--- trunk/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,5 +0,0 @@
-package org.jbehave.container;
-
-public class AComponent {
-
-}

Deleted: trunk/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java (1009 => 1010)

--- trunk/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,5 +0,0 @@
-package org.jbehave.container;
-
-public class AnotherComponent {
-
-}

Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioClassLoaderBehaviour.java (1009 => 1010)

--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioClassLoaderBehaviour.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioClassLoaderBehaviour.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -7,7 +7,6 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.jbehave.container.pico.XMLPicoContainer;
 import org.junit.Test;
 
 public class ScenarioClassLoaderBehaviour {
@@ -19,16 +18,6 @@
         String scenarioClassName = MyScenario.class.getName();
         assertScenarioIsInstantiated(classLoader, scenarioClassName);
     }
-
-    @Test
-    public void canInstantiateNewContainerScenario() throws MalformedURLException {
-        List<String> elements = Arrays.asList();
-        ClassLoader parent = Thread.currentThread().getContextClassLoader();
-        ScenarioClassLoader classLoader = new ScenarioClassLoader(elements, parent);
-        String scenarioClassName = MyContainerScenario.class.getName();
-        assertScenarioIsInstantiated(classLoader, scenarioClassName);
-    }
-
     
     private void assertScenarioIsInstantiated(ScenarioClassLoader classLoader, String scenarioClassName) {
         RunnableScenario scenario = classLoader.newScenario(scenarioClassName);
@@ -43,11 +32,4 @@
         }
     }
 
-    private static class MyContainerScenario extends JUnitScenario {
-
-        public MyContainerScenario(ClassLoader classLoader){
-            new XMLPicoContainer("org/jbehave/scenario/container.xml");
-        }
-    }
-
 }

Deleted: trunk/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java (1009 => 1010)

--- trunk/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,20 +0,0 @@
-package org.jbehave.container;
-
-
-/**
- * Thrown when no component is found for a given key or type in the container
- * 
- * @author Mauro Talevi
- */
[EMAIL PROTECTED]("serial")
-public class ComponentNotFoundException extends RuntimeException {
-
-    public ComponentNotFoundException(String message) {
-        super(message);
-    }
-
-    public ComponentNotFoundException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}

Deleted: trunk/jbehave-core/src/java/org/jbehave/container/Container.java (1009 => 1010)

--- trunk/jbehave-core/src/java/org/jbehave/container/Container.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/java/org/jbehave/container/Container.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,32 +0,0 @@
-package org.jbehave.container;
-
-/**
- * Container represents a simple facade to access components from lightweight
- * containers. Different implementations will provide adapters to different
- * containers.
- * 
- * @author Mauro Talevi
- */
-public interface Container {
-
-    /**
-     * Returns a component of a given type
-     * 
-     * @param type the component Class type
-     * @return The component instance of type <T>
-     * @throws ComponentNotFoundException when component not found
-     */
-    <T> T getComponent(Class<T> type);
-
-    /**
-     * Returns a component for a given type and key. It first looks up the
-     * components by type and then from these the one with the provided key.
-     * 
-     * @param type the component Class type
-     * @param key the component Object key
-     * @return The component instance of type <T>
-     * @throws ComponentNotFoundException when component not found
-     */
-    <T> T getComponent(Class<T> type, Object key);
-
-}

Deleted: trunk/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java (1009 => 1010)

--- trunk/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,45 +0,0 @@
-package org.jbehave.container;
-
-import org.jbehave.container.pico.XMLPicoContainerSteps;
-import org.jbehave.scenario.steps.Steps;
-import org.jbehave.scenario.steps.StepsConfiguration;
-
-/**
- * <p>
- * Abstract steps decorator which adds container support. Users need to extend
- * this class and provide a concrete implementation of Container.
- * </p>
- * <p>
- * Concrete implementations provided are [EMAIL PROTECTED] XMLPicoContainerSteps}.
- * </p>
- * 
- * @author Mauro Talevi
- */
-public abstract class ContainerSteps extends Steps {
-
-    private Container container;
-
-    public ContainerSteps(String containerResource) {
-        this(containerResource, Thread.currentThread().getContextClassLoader());
-    }
-
-    public ContainerSteps(String containerResource, ClassLoader classLoader) {    
-        this(containerResource, classLoader, new StepsConfiguration());
-    }
-
-    public ContainerSteps(String containerResource, ClassLoader classLoader, StepsConfiguration configuration) {
-        super(configuration);
-        container = createContainer(containerResource, classLoader);
-    }
-
-    public <T> T component(Class<T> type) {
-        return container.getComponent(type);
-    }
-
-    public <T> T getComponent(Class<T> type, Object key) {
-        return container.getComponent(type, key);
-    }
-
-    protected abstract Container createContainer(String containerResource, ClassLoader classLoader);
-
-}

Deleted: trunk/jbehave-core/src/java/org/jbehave/container/InvalidContainerException.java (1009 => 1010)

--- trunk/jbehave-core/src/java/org/jbehave/container/InvalidContainerException.java	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/jbehave-core/src/java/org/jbehave/container/InvalidContainerException.java	2008-11-18 23:56:34 UTC (rev 1010)
@@ -1,20 +0,0 @@
-package org.jbehave.container;
-
-
-/**
- * Thrown when a container cannot be created
- * 
- * @author Mauro Talevi
- */
[EMAIL PROTECTED]("serial")
-public class InvalidContainerException extends RuntimeException {
-
-    public InvalidContainerException(String message) {
-        super(message);
-    }
-
-    public InvalidContainerException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}

Modified: trunk/pom.xml (1009 => 1010)

--- trunk/pom.xml	2008-11-18 23:44:51 UTC (rev 1009)
+++ trunk/pom.xml	2008-11-18 23:56:34 UTC (rev 1010)
@@ -41,19 +41,6 @@
         <version>1.7.0</version>
         <scope>provided</scope>
       </dependency>
-      <dependency>
-        <!-- Optional as only used by ContainerSteps -->
-        <groupId>org.picocontainer.script</groupId>
-        <artifactId>picocontainer-script-core</artifactId>
-        <version>2.0</version>
-        <scope>provided</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-beans</artifactId>
-        <version>2.5.5</version>
-        <scope>provided</scope>
-      </dependency>
       <!-- Only used for tests -->
       <dependency>
         <groupId>org.mockito</groupId>


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to