[jbehave-scm] [953] trunk/jbehave-core/src/behaviour/org/jbehave/container/spring/SpringContainerBehaviour.java: Fixed resource paths.

2008-09-28 Thread mauro
Title:  [953] trunk/jbehave-core/src/behaviour/org/jbehave/container/spring/SpringContainerBehaviour.java: Fixed resource paths.







Revision 953
Author mauro
Date 2008-09-29 01:44:54 -0500 (Mon, 29 Sep 2008)


Log Message
Fixed resource paths.

Modified Paths

trunk/jbehave-core/src/behaviour/org/jbehave/container/spring/SpringContainerBehaviour.java




Diff

Modified: trunk/jbehave-core/src/behaviour/org/jbehave/container/spring/SpringContainerBehaviour.java (952 => 953)

--- trunk/jbehave-core/src/behaviour/org/jbehave/container/spring/SpringContainerBehaviour.java	2008-09-28 16:36:52 UTC (rev 952)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/container/spring/SpringContainerBehaviour.java	2008-09-29 06:44:54 UTC (rev 953)
@@ -21,25 +21,25 @@
 
 @Test
 public void canGetComponentByKey() {
-Container container = new SpringContainer("/org/jbehave/container/spring/components.xml");
+Container container = new SpringContainer("org/jbehave/container/spring/components.xml");
 assertNotNull(container.getComponent(AComponent.class, "a-component"));
 }
 
 @Test(expected = ComponentNotFoundException.class)
 public void cannotGetComponentByInexistentKey() {
-Container container = new SpringContainer("/org/jbehave/container/spring/components.xml");
+Container container = new SpringContainer("org/jbehave/container/spring/components.xml");
 container.getComponent(AComponent.class, "inexistent-key");
 }
 
 @Test
 public void canGetComponentByType() {
-Container container = new SpringContainer("/org/jbehave/container/spring/components.xml");
+Container container = new SpringContainer("org/jbehave/container/spring/components.xml");
 assertNotNull(container.getComponent(AnotherComponent.class));
 }
 
 //[EMAIL PROTECTED]
 public void canGetComponentsWithCustomClassLoader() {
-Container container = new SpringContainer("/org/jbehave/container/spring/components.xml", Thread
+Container container = new SpringContainer("org/jbehave/container/spring/components.xml", Thread
 .currentThread().getContextClassLoader());
 assertNotNull(container.getComponent(AComponent.class));
 assertNotNull(container.getComponent(AnotherComponent.class));
@@ -47,12 +47,12 @@
 
 @Test(expected = InvalidContainerException.class)
 public void cannotGetComponentsWithInvalidClassLoader() throws MalformedURLException {
-new SpringContainer("/org/jbehave/container/spring/components.xml", new InvalidClassLoader());
+new SpringContainer("org/jbehave/container/spring/components.xml", new InvalidClassLoader());
 }
 
 @Test(expected = ComponentNotFoundException.class)
 public void cannotGetComponentWithNoneConfigured() {
-Container container = new SpringContainer("/org/jbehave/container/spring/no-components.xml");
+Container container = new SpringContainer("org/jbehave/container/spring/no-components.xml");
 container.getComponent(AComponent.class);
 }
 










To unsubscribe from this list please visit:


http://xircles.codehaus.org/manage_email



[jbehave-dev] Re: making Scenario framework-agnostic

2008-09-28 Thread Mauro Talevi

Dan North wrote:
I agree that having Scenario extend SomethingScenario is weird, but 
still it's somehow pleasing. Like jam with cheese.


My thinking is, if I don't care and I'm always going to use the default 
setup, then all I care about is having a Scenario. Like if I want to 
rent a car, I just phone up and ask for a Car. It might be the default 
car (hence DefaultCar) which itself might be a Mazda. It might simply be 
the only car they have.


Usually we represent this with an interface and a factory:

   Car anyOldCar = carHireShop.rentalCar();

but in this case we want to give people an actual class they can extend. 
Perhaps we've just stumbled on a new convention where the thing you want 
people to use (extend) most often is just called Thing (the "default" is 
implied), so there is nothing in its name to distract you from using it. 
It actually fits the Dreyfus learning model rather nicely. A novice just 
wants a Thing and some rules to make the thing work. Words like 
"Default" or "JUnit" are context - which the novice isn't ready for.




Ok - not feeling strongly about it either way.  I've un-dreprecated 
Scenario and added javadoc comment as to provided the suggested entry 
point for novice scenario developers.



-
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




[jbehave-scm] [952] trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java: Undeprecated Scenario to represent suggested entry point for developers - as per list discussion.

2008-09-28 Thread mauro
Title:  [952] trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java: Undeprecated Scenario to represent suggested entry point for developers - as per list discussion.







Revision 952
Author mauro
Date 2008-09-28 11:36:52 -0500 (Sun, 28 Sep 2008)


Log Message
Undeprecated Scenario to represent suggested entry point for developers - as per list discussion.

Modified Paths

trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java




Diff

Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java (951 => 952)

--- trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java	2008-09-28 16:33:06 UTC (rev 951)
+++ trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java	2008-09-28 16:36:52 UTC (rev 952)
@@ -4,11 +4,10 @@
 
 /**
  * 
- * Scenario is deprecated to allow for support of multiple test frameworks.
- * Users should extend a scenario class that supports the desired test framework.
+ * Scenario represents the suggested entry point for the scenario developers. 
+ * It's a simple extension of JUnitScenario but users can choose to extend
+ * other abstract implementations of RunnableScenario.
  * 
- * 
- * @deprecated Since 2.1 use JUnitScenario
  */
 public abstract class Scenario extends JUnitScenario {
 










To unsubscribe from this list please visit:


http://xircles.codehaus.org/manage_email



[jbehave-dev] [jira] Created: (JBEHAVE-134) Extract CandidateSteps interface

2008-09-28 Thread Mauro Talevi (JIRA)
Extract CandidateSteps interface


 Key: JBEHAVE-134
 URL: http://jira.codehaus.org/browse/JBEHAVE-134
 Project: JBehave
  Issue Type: Improvement
Affects Versions: 2.0
Reporter: Mauro Talevi
Assignee: Mauro Talevi
 Fix For: 2.1


Extract CandidateSteps interface from Steps class so to allow composition over 
inheritance.

-- 
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] [951] trunk/jbehave-core/src/java/org/jbehave/scenario: JBEHAVE-134: Extracted CandidateSteps interface from Steps.

2008-09-28 Thread mauro
Title:  [951] trunk/jbehave-core/src/java/org/jbehave/scenario: JBEHAVE-134:  Extracted CandidateSteps interface from Steps.







Revision 951
Author mauro
Date 2008-09-28 11:33:06 -0500 (Sun, 28 Sep 2008)


Log Message
JBEHAVE-134:  Extracted CandidateSteps interface from Steps.

Modified Paths

trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java
trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java
trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java
trunk/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java
trunk/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java
trunk/jbehave-core/src/java/org/jbehave/scenario/Scenario.java
trunk/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java
trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateStep.java
trunk/jbehave-core/src/java/org/jbehave/scenario/steps/StepCreator.java
trunk/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java
trunk/jbehave-core/src/java/org/jbehave/scenario/steps/UnmatchedToPendingStepCreator.java


Added Paths

trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateSteps.java




Diff

Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java (950 => 951)

--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java	2008-09-28 15:25:43 UTC (rev 950)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java	2008-09-28 16:33:06 UTC (rev 951)
@@ -13,6 +13,7 @@
 import org.jbehave.scenario.errors.PendingErrorStrategy;
 import org.jbehave.scenario.parser.ScenarioDefiner;
 import org.jbehave.scenario.reporters.ScenarioReporter;
+import org.jbehave.scenario.steps.CandidateSteps;
 import org.jbehave.scenario.steps.StepCreator;
 import org.jbehave.scenario.steps.Steps;
 import org.junit.Test;
@@ -28,7 +29,7 @@
 public void shouldLoadStoryDefinitionAndRunUsingTheScenarioRunner() throws Throwable {
 ScenarioRunner runner = mock(ScenarioRunner.class);
 MockedConfiguration configuration = new MockedConfiguration();
-Steps steps = mock(Steps.class);
+CandidateSteps steps = mock(Steps.class);
 RunnableScenario scenario = new MyScenario(runner, configuration, steps);
 
 StoryDefinition storyDefinition = new StoryDefinition(Blurb.EMPTY, Collections.EMPTY_LIST);
@@ -42,7 +43,7 @@
 private class MyScenario extends JUnitScenario {
 
 public MyScenario(ScenarioRunner runner,
-MockedConfiguration configuration, Steps steps) {
+MockedConfiguration configuration, CandidateSteps steps) {
 super(runner, configuration, steps);
 }
 


Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java (950 => 951)

--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java	2008-09-28 15:25:43 UTC (rev 950)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java	2008-09-28 16:33:06 UTC (rev 951)
@@ -16,6 +16,7 @@
 import org.jbehave.scenario.errors.PendingErrorStrategy;
 import org.jbehave.scenario.reporters.ScenarioReporter;
 import org.jbehave.scenario.steps.CandidateStep;
+import org.jbehave.scenario.steps.CandidateSteps;
 import org.jbehave.scenario.steps.Step;
 import org.jbehave.scenario.steps.StepCreator;
 import org.jbehave.scenario.steps.StepResult;
@@ -40,7 +41,7 @@
 
 ScenarioReporter reporter = mock(ScenarioReporter.class);
 StepCreator creator = mock(StepCreator.class);
-Steps mySteps = mock(Steps.class);
+CandidateSteps mySteps = mock(Steps.class);
 
 stub(mySteps.getSteps()).toReturn(someCandidateSteps);
 IllegalArgumentException anException = new IllegalArgumentException();
@@ -164,7 +165,7 @@
 stub(pendingStep.perform()).toReturn(StepResult.pending("pendingStep"));
 stub(secondStep.perform()).toReturn(StepResult.success("secondStep"));
 StepCreator creator = mock(StepCreator.class);
-Steps mySteps = mock(Steps.class);
+CandidateSteps mySteps = mock(Steps.class);
 
 ScenarioDefinition scenario1 = mock(ScenarioDefinition.class);
 ScenarioDefinition scenario2 = mock(ScenarioDefinition.class);


Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java (950 => 951)

--- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java	2008-09-28 15:25:43 UTC (rev 950)
+++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java	2008-09-28 16:33:06 UTC (rev 951)
@@ -16,7 +16,7 @@
 UnmatchedToPendingStepCreator creator = new UnmatchedToPendingStepCreator();
 
 CandidateStep candidate = mock(CandidateStep.class);
-Steps steps = mock(Steps.

[jbehave-scm] [950] trunk/jbehave-core/src/java/org/jbehave/container/pico/AbstractPicoContainer.java: Ensure components are returned only if not null.

2008-09-28 Thread mauro
Title:  [950] trunk/jbehave-core/src/java/org/jbehave/container/pico/AbstractPicoContainer.java: Ensure components are returned only if not null.







Revision 950
Author mauro
Date 2008-09-28 10:25:43 -0500 (Sun, 28 Sep 2008)


Log Message
Ensure components are returned only if not null.

Modified Paths

trunk/jbehave-core/src/java/org/jbehave/container/pico/AbstractPicoContainer.java




Diff

Modified: trunk/jbehave-core/src/java/org/jbehave/container/pico/AbstractPicoContainer.java (949 => 950)

--- trunk/jbehave-core/src/java/org/jbehave/container/pico/AbstractPicoContainer.java	2008-09-27 17:27:10 UTC (rev 949)
+++ trunk/jbehave-core/src/java/org/jbehave/container/pico/AbstractPicoContainer.java	2008-09-28 15:25:43 UTC (rev 950)
@@ -47,10 +47,14 @@
 throw new ComponentNotFoundException(message);
 }
 if (key != null) {
+T component = null;
 // a key has been provided: return the component for that key
 for (ComponentAdapter adapter : adapters) {
 if (key.equals(adapter.getComponentKey())) {
-return adapter.getComponentInstance(container, type);
+component = adapter.getComponentInstance(container, type);
+if ( component != null ){
+return component;
+}
 }
 }
 String message = format("No component registered in container of type {0} and for key {1}", type, key);










To unsubscribe from this list please visit:


http://xircles.codehaus.org/manage_email