[jbehave-user] Bug in StoryManager regarding timeouts?

2013-07-15 Thread Andreas Ebbert-Karroum
Hi,

as I read the specification of a timeout, it is setting the controls to let
a story time out, when a specified amount of time has passed. By the name
this is a setting per story. So, when I have a timeout of 300s per story, I
should be able to have 100 stories, which take 250 seconds each.

The way it is implemented is different, though. The StoryManager measures
the start time right after it kicked off all stories, and is waiting for
all of them to be completed.

https://github.com/jbehave/jbehave-core/blob/master/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java

public void waitUntilAllDoneOrFailed(BatchFailures failures) {
  long start = System.currentTimeMillis();
 boolean allDone = false;
 while (!allDone) {
 allDone = true;
 for (RunningStory runningStory : runningStories.values()) {
 FutureThrowableStory future = runningStory.getFuture();
 if (!future.isDone()) {
 allDone = false;
  long durationInSecs = storyDurationInSecs(start);
 long timeoutInSecs = 
 embedderControls.storyTimeoutInSecs();
  if (durationInSecs  timeoutInSecs) {
 Story story = runningStory.getStory();
 StoryDuration storyDuration = new 
 StoryDuration(durationInSecs, timeoutInSecs);
 embedderMonitor.storyTimeout(story, storyDuration);
 storyRunner.cancelStory(story, storyDuration);
 future.cancel(true);
 }
 break;


Is it just my thinking, or is that a bug in JBehave?




-- 
Mit freundlichen Grüßen / Best regards

Andreas Ebbert-Karroum | Agile Principal Consultant

codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland
tel: +49 (0) 212.23362825 | fax: +49 (0) 212.23362879 | mobil: +49 (0)
175.2664109
www.codecentric.de | blog.codecentric.de | www.meettheexperts.de |
www.more4fi.de

Sitz der Gesellschaft: Düsseldorf | HRB 63043
Vorstand: Klaus Jäger (Vorsitzender) . Michael Hochgürtel . Mirko Novakovic
. Rainer Vehns
Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Bernd Klinkmann . Jürgen
Schütz

Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche
und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige
Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie
bitte sofort den Absender und löschen Sie diese E-Mail und evtl.
beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen
evtl. beigefügter Dateien sowie die unbefugte Weitergabe dieser E-Mail ist
nicht gestattet.


RE: [jbehave-user] Bug in StoryManager regarding timeouts?

2013-07-15 Thread Jorge Pombar
We have also faced this issue before. I think is a bug on jbehave, can you 
please confirm?

To get around this we just set a super high timeout of 1 hour so the whole 
story file has time to run

Thanks,
Enrique

From: Andreas Ebbert-Karroum [mailto:andreas.ebbert-karr...@codecentric.de]
Sent: Monday, July 15, 2013 7:37 AM
To: user@jbehave.codehaus.org
Subject: [jbehave-user] Bug in StoryManager regarding timeouts?

Hi,

as I read the specification of a timeout, it is setting the controls to let a 
story time out, when a specified amount of time has passed. By the name this is 
a setting per story. So, when I have a timeout of 300s per story, I should be 
able to have 100 stories, which take 250 seconds each.

The way it is implemented is different, though. The StoryManager measures the 
start time right after it kicked off all stories, and is waiting for all of 
them to be completed.

https://github.com/jbehave/jbehave-core/blob/master/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java






public void waitUntilAllDoneOrFailed(BatchFailures failures) {




 long start = System.currentTimeMillis();




boolean allDone = false;




while (!allDone) {




allDone = true;
for (RunningStory runningStory : runningStories.values()) {




FutureThrowableStory future = runningStory.getFuture();




if (!future.isDone()) {




allDone = false;
 long durationInSecs = storyDurationInSecs(start);




long timeoutInSecs = embedderControls.storyTimeoutInSecs();




 if (durationInSecs  timeoutInSecs) {




Story story = runningStory.getStory();




StoryDuration storyDuration = new 
StoryDuration(durationInSecs, timeoutInSecs);




embedderMonitor.storyTimeout(story, storyDuration);




storyRunner.cancelStory(story, storyDuration);




future.cancel(true);




}
break;

Is it just my thinking, or is that a bug in JBehave?




--
Mit freundlichen Grüßen / Best regards

Andreas Ebbert-Karroum | Agile Principal Consultant

codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland
tel: +49 (0) 212.23362825 | fax: +49 (0) 212.23362879 | mobil: +49 (0) 
175.2664109
www.codecentric.dehttp://www.codecentric.de | 
blog.codecentric.dehttp://blog.codecentric.de | 
www.meettheexperts.dehttp://www.meettheexperts.de | 
www.more4fi.dehttp://www.more4fi.de

Sitz der Gesellschaft: Düsseldorf | HRB 63043
Vorstand: Klaus Jäger (Vorsitzender) . Michael Hochgürtel . Mirko Novakovic . 
Rainer Vehns
Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Bernd Klinkmann . Jürgen Schütz

Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche 
und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige 
Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie 
bitte sofort den Absender und löschen Sie diese E-Mail und evtl. beigefügter 
Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen evtl. beigefügter 
Dateien sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.