From 52e10997f1f760bab8749f9e1c01e904796785bf Mon Sep 17 00:00:00 2001 From: Calum Date: Sun, 13 Aug 2017 21:07:21 +1200 Subject: [PATCH] Build issues caused by vm unable to open socket connections. Leaving as is for now. #bug --- .../RegularPacketsTest.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/test/java/seng302/visualiser/ClientToServerTests/RegularPacketsTest.java b/src/test/java/seng302/visualiser/ClientToServerTests/RegularPacketsTest.java index f0a148b9..bf5fcab1 100644 --- a/src/test/java/seng302/visualiser/ClientToServerTests/RegularPacketsTest.java +++ b/src/test/java/seng302/visualiser/ClientToServerTests/RegularPacketsTest.java @@ -30,23 +30,23 @@ public class RegularPacketsTest { @Test public void packetsSentAtRegularIntervals () throws Exception { -// final double TEST_DISTANCE = 10.0; -// serverThread.startGame(); -// SleepThreadMaxDelay(); -// Yacht yacht = new ArrayList<>(GameState.getYachts().values()).get(0); -// double startAngle = yacht.getHeading(); -// long startTime = System.currentTimeMillis(); -// clientThread.sendBoatAction(BoatAction.UPWIND); -// Thread.sleep(200); -// while (Math.abs(yacht.getHeading() - startAngle) < TEST_DISTANCE) { -// Thread.sleep(1); -// } -// clientThread.sendBoatAction(BoatAction.MAINTAIN_HEADING); -// long endTime = System.currentTimeMillis(); -// SleepThreadMaxDelay(); -// //Allowed to be two loops of delay due to loop delay and processing delay at client + server ends. -// Assert.assertEquals(TEST_DISTANCE / Yacht.TURN_STEP * ClientToServerThread.PACKET_SENDING_INTERVAL_MS, -// (endTime - startTime), 2 * ClientToServerThread.PACKET_SENDING_INTERVAL_MS); + final double TEST_DISTANCE = 10.0; + serverThread.startGame(); + SleepThreadMaxDelay(); + Yacht yacht = new ArrayList<>(GameState.getYachts().values()).get(0); + double startAngle = yacht.getHeading(); + long startTime = System.currentTimeMillis(); + clientThread.sendBoatAction(BoatAction.UPWIND); + Thread.sleep(200); + while (Math.abs(yacht.getHeading() - startAngle) < TEST_DISTANCE) { + Thread.sleep(1); + } + clientThread.sendBoatAction(BoatAction.MAINTAIN_HEADING); + long endTime = System.currentTimeMillis(); + SleepThreadMaxDelay(); + //Allowed to be two loops of delay due to loop delay and processing delay at client + server ends. + Assert.assertEquals(TEST_DISTANCE / Yacht.TURN_STEP * ClientToServerThread.PACKET_SENDING_INTERVAL_MS, + (endTime - startTime), 2 * ClientToServerThread.PACKET_SENDING_INTERVAL_MS); } @Test