-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from livio/bugfix/issue_12
Fixe Issue #12: Handle quickly canceled tasks before operations
- Loading branch information
Showing
3 changed files
with
113 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
Taskmaster/src/test/java/com/livio/taskmaster/smoketests/CancelTasksTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.livio.taskmaster.smoketests; | ||
|
||
import com.livio.taskmaster.Queue; | ||
import com.livio.taskmaster.Task; | ||
|
||
public class CancelTasksTest extends BaseTest { | ||
Queue queue; | ||
|
||
public CancelTasksTest(ITest callback) { | ||
super(1, callback); | ||
} | ||
|
||
@Override | ||
public void setUp() { | ||
queue = taskmaster.createQueue("Queue", 1, false); | ||
queue.add(taskA, false); | ||
taskA.cancelTask(); | ||
queue.add(taskB, false); | ||
queue.add(taskC, false); | ||
} | ||
|
||
|
||
Task taskA = new Task("-- Task A --") { | ||
|
||
@Override | ||
public void onExecute() { | ||
System.out.println("-------- Running task A, this should not happen"); | ||
this.onFinished(); | ||
} | ||
}; | ||
|
||
Task taskB = new Task("-- Task B --") { | ||
|
||
@Override | ||
public void onExecute() { | ||
System.out.println("-------- Running task B"); | ||
this.onFinished(); | ||
} | ||
}; | ||
Task taskC = new Task("-- Task C --") { | ||
|
||
@Override | ||
public void onExecute() { | ||
System.out.println("-------- Running task C"); | ||
this.onFinished(); | ||
taskmaster.shutdown(); | ||
onTestCompleted(true); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters