Commit d47fd6f3 authored by Aneta Steimarova's avatar Aneta Steimarova

#929 Made timeout in during test running whatever app is doing

parent fbceb167
NewUserScenario
TestScenarioSpecial
TestScenarioHallOfFameRobberyTrophies
TestGameShootingRangeEasyNoneStar
TestGameRobberyMediumOneStar
TestStatisticsInTheDarkness
TestEncyclopedia
TestProfile
OfficeTestScenario
......@@ -33,7 +33,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.StringBuilder;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.async.AsyncExecutor;
import com.badlogic.gdx.utils.async.AsyncResult;
import com.badlogic.gdx.utils.async.AsyncTask;
......@@ -52,7 +51,9 @@ import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
import java.util.Timer;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaApplication;
......@@ -867,18 +868,18 @@ public abstract class AbstractTestScenario implements Runnable {
*/
protected class ExecutionTimeout<T> {
private Timer.Task timer;
private Timer timer;
public ExecutionTimeout(long timeoutInSec, final T task) {
timer = Timer.schedule(new Timer.Task() {
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
// we were waiting for some task / event to happen which should cancel this timer.
// When this not occur we send event about timeout of waiting
ApplicationBus.getInstance().publishAsync(new TaskWaitingTimeout<T>(task));
}
}, timeoutInSec);
}, timeoutInSec*1000);
}
public void cancelWaiting() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment