Added empty data sources, to be used by VisualiserRace.
Created FrameRateTracker which can be used to track framerate. Updated RequestToJoinEnum and JoinAcceptanceEnum to match the agreed connection API. Added AssignPlayerBoat message, which is used internally on the client to assign the player a source ID once they have connected. Fixed some race conditions in the MessageRouter. Updated ConnectionAcceptor.CheckClientConnection to wait slightly longer before removing connection (there was a slight race condition before). Race no longer has a reference to LatestMessages. LatestMessages no longer has specific messages types in it. Created RaceState class, which contains the state that is shared between VisualiserRaceState and MockRaceState (currently only used on visualiser). Split VisualiserRace into VisualiserRaceState and VisualiserRaceService. Added the VisualiserRace commands (BoatLocatonCommand, RaceStatusCommand, etc...). Slightly increased the preferred width of race.fxml table columns. issues #27 #37 #35 #story[1095]
This commit is contained in:
+7
-8
@@ -7,8 +7,7 @@ import network.Messages.Enums.RequestToJoinEnum;
|
||||
import network.Messages.JoinAcceptance;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import visualiser.Commands.ConnectionToServerCommands.JoinSuccessfulCommand;
|
||||
import visualiser.Commands.ConnectionToServerCommands.RaceParticipantsFullCommand;
|
||||
import visualiser.Commands.ConnectionToServerCommands.JoinSuccessParticipantCommand;
|
||||
import visualiser.Commands.ConnectionToServerCommands.ServerFullCommand;
|
||||
import visualiser.enums.ConnectionToServerState;
|
||||
|
||||
@@ -50,7 +49,7 @@ public class ConnectionToServerSpectatorTest {
|
||||
public void expectRequestSent() throws Exception {
|
||||
|
||||
//Need to wait for connection thread to execute commands.
|
||||
Thread.sleep(20);
|
||||
Thread.sleep(250);
|
||||
|
||||
assertEquals(ConnectionToServerState.REQUEST_SENT, connectionToServer.getConnectionState());
|
||||
}
|
||||
@@ -63,19 +62,19 @@ public class ConnectionToServerSpectatorTest {
|
||||
@Test
|
||||
public void sendJoinSuccessCommand() throws Exception {
|
||||
int sourceID = 0;
|
||||
JoinAcceptance joinAcceptance = new JoinAcceptance(JoinAcceptanceEnum.JOIN_SUCCESSFUL, sourceID);
|
||||
JoinAcceptance joinAcceptance = new JoinAcceptance(JoinAcceptanceEnum.JOIN_SUCCESSFUL_PARTICIPANT, sourceID);
|
||||
|
||||
Command command = new JoinSuccessfulCommand(joinAcceptance, connectionToServer);
|
||||
Command command = new JoinSuccessParticipantCommand(joinAcceptance, connectionToServer);
|
||||
|
||||
incomingCommands.put(command);
|
||||
|
||||
//Need to wait for connection thread to execute commands.
|
||||
Thread.sleep(20);
|
||||
Thread.sleep(250);
|
||||
|
||||
assertEquals(ConnectionToServerState.CONNECTED, connectionToServer.getConnectionState());
|
||||
assertTrue(connectionToServer.getJoinAcceptance() != null);
|
||||
assertEquals(sourceID, connectionToServer.getJoinAcceptance().getSourceID());
|
||||
assertEquals(JoinAcceptanceEnum.JOIN_SUCCESSFUL, connectionToServer.getJoinAcceptance().getAcceptanceType());
|
||||
assertEquals(JoinAcceptanceEnum.JOIN_SUCCESSFUL_PARTICIPANT, connectionToServer.getJoinAcceptance().getAcceptanceType());
|
||||
|
||||
|
||||
}
|
||||
@@ -95,7 +94,7 @@ public class ConnectionToServerSpectatorTest {
|
||||
incomingCommands.put(command);
|
||||
|
||||
//Need to wait for connection thread to execute commands.
|
||||
Thread.sleep(20);
|
||||
Thread.sleep(250);
|
||||
|
||||
assertEquals(ConnectionToServerState.DECLINED, connectionToServer.getConnectionState());
|
||||
assertTrue(connectionToServer.getJoinAcceptance() != null);
|
||||
|
||||
Reference in New Issue
Block a user