diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/TurnTimer.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/TurnTimeoutTimer.java similarity index 84% rename from Server/src/main/java/uulm/teamname/marvelous/server/lobby/TurnTimer.java rename to Server/src/main/java/uulm/teamname/marvelous/server/lobby/TurnTimeoutTimer.java index 9bffb28..a5940ae 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/TurnTimer.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/TurnTimeoutTimer.java @@ -2,22 +2,23 @@ package uulm.teamname.marvelous.server.lobby; import org.tinylog.Logger; import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType; +import uulm.teamname.marvelous.server.Server; import uulm.teamname.marvelous.server.lobbymanager.Participant; import java.util.concurrent.*; import java.util.function.Consumer; /** - * The {@link TurnTimer} class is called by the {@link Lobby} to limit the amount of time a player has per round. + * The {@link TimeoutTimer} class is called by the {@link Lobby} to limit the amount of time a player has per round. */ -public class TurnTimer { +public class TimeoutTimer { private final ScheduledExecutorService timer; private final Consumer callback; private final int maxRoundTime; private ScheduledFuture current; - public TurnTimer(int maxRoundTime, Consumer callback) { + public TimeoutTimer(int maxRoundTime, Consumer callback) { String lobbyThreadName = Thread.currentThread().getName(); ThreadFactory threadFactory = new ThreadFactory() { @Override @@ -26,7 +27,7 @@ public class TurnTimer { } }; this.timer = Executors.newSingleThreadScheduledExecutor(threadFactory); - this.maxRoundTime = 3; + this.maxRoundTime = Server.getPartyConfig().maxRoundTime; this.callback = callback; } diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegment.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameLogicSegment.java similarity index 100% rename from Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegment.java rename to Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameLogicSegment.java diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/TurnTimerTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/TurnTimeoutTimerTest.java similarity index 73% rename from Server/src/test/java/uulm/teamname/marvelous/server/lobby/TurnTimerTest.java rename to Server/src/test/java/uulm/teamname/marvelous/server/lobby/TurnTimeoutTimerTest.java index fa05477..97dfb5c 100644 --- a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/TurnTimerTest.java +++ b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/TurnTimeoutTimerTest.java @@ -4,30 +4,28 @@ import org.java_websocket.WebSocket; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType; -import uulm.teamname.marvelous.server.lobbymanager.LobbyConnection; import uulm.teamname.marvelous.server.lobbymanager.Participant; import uulm.teamname.marvelous.server.netconnector.Client; import java.util.function.Consumer; -import static org.junit.jupiter.api.Assertions.*; import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; -class TurnTimerTest { - TurnTimer turnTimer; +class TimeoutTimerTest { + TimeoutTimer timeoutTimer; @BeforeEach void beforeEach(){ var callback = mock(Consumer.class); - turnTimer = new TurnTimer(20, callback); + timeoutTimer = new TimeoutTimer(20, callback); } @Test void startTurnTimerTest(){ var connection = mock(WebSocket.class); var participant = new Participant(new Client(connection), "lobby", ParticipantType.Spectator); - assertThatIllegalStateException().describedAs("Spectators don't have TurnTime").isThrownBy(() -> turnTimer.startTurnTimer(participant)); + assertThatIllegalStateException().describedAs("Spectators don't have TurnTime").isThrownBy(() -> timeoutTimer.startTurnTimer(participant)); } } diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegmentTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameLogicSegmentTest.java similarity index 100% rename from Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegmentTest.java rename to Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameLogicSegmentTest.java diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameStateSegmentTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameLogicSegmentTest.java similarity index 100% rename from Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameStateSegmentTest.java rename to Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameLogicSegmentTest.java