Fixed failing tests & other bug fixes

- Fixed server capacity in server list
- Fixed failing unit tests for chat

Tags: #story[1281] #pair[mra106, cir27]
This commit is contained in:
Michael Rausch
2017-09-27 20:37:29 +13:00
parent 2b3a972ed5
commit 5cc4898ab5
12 changed files with 390 additions and 289 deletions
@@ -37,6 +37,7 @@ import seng302.model.stream.xml.generator.RaceXMLTemplate;
import seng302.model.stream.xml.generator.RegattaXMLTemplate;
import seng302.utilities.XMLGenerator;
import seng302.utilities.XMLParser;
import seng302.visualiser.controllers.ViewManager;
/**
* A class describing a single connection to a Server for the purposes of sending and receiving on
@@ -168,6 +169,9 @@ public class ClientToServerThread implements Runnable {
logger.warn("Closed connection to server", 1);
notifyDisconnectListeners("Connection to server was terminated");
closeSocket();
ViewManager.getInstance().goToStartView();
ViewManager.getInstance().showErrorSnackBar("Server rejected connection.");
}
public void sendCustomizationRequest(CustomizeRequestType reqType, byte[] payload) {
@@ -230,7 +234,6 @@ public class ClientToServerThread implements Runnable {
return;
}
logger.error("Server Denied Connection, Exiting");
final String alertErrorText;
@@ -243,7 +246,8 @@ public class ClientToServerThread implements Runnable {
}
handleConnectionError("Server no longer available.");
notifyDisconnectListeners(alertErrorText);
closeSocket();
System.out.println();
}
/**
@@ -59,7 +59,7 @@ public class StartScreenController implements Initializable{
/**
* Changes the view to the Server Browser.
*/
private void goToServerBrowser() {
public void goToServerBrowser() {
try {
ViewManager.getInstance().setScene(serverList);
} catch (Exception e) {