Added NetworkGameControl
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@503 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
e79295f271
commit
f3f8ffe462
22 changed files with 227 additions and 83 deletions
|
@ -51,7 +51,7 @@ public class RoundControlTest {
|
|||
private boolean roundEnded;
|
||||
private Score roundScore;
|
||||
protected boolean roundRestarted;
|
||||
|
||||
|
||||
Stone blueFour = new Stone(4, BLUE);
|
||||
Stone blackFour = new Stone(4, BLACK);
|
||||
Stone redFour = new Stone(4, RED);
|
||||
|
@ -67,15 +67,15 @@ public class RoundControlTest {
|
|||
Stone blueOne = new Stone(1, BLUE);
|
||||
Stone blueTwo = new Stone(2, BLUE);
|
||||
Stone blueThree = new Stone(3, BLUE);
|
||||
|
||||
|
||||
Stone blueTen = new Stone(10, BLUE);
|
||||
Stone redTen = new Stone(10, RED);
|
||||
Stone blueEleven = new Stone(11, BLUE);
|
||||
|
||||
|
||||
Stone redEight = new Stone(8, RED);
|
||||
Stone redNine = new Stone(9, RED);
|
||||
Stone redEleven = new Stone(11, RED);
|
||||
|
||||
|
||||
Stone blueEight = new Stone(8, BLUE);
|
||||
Stone blackEight = new Stone(8, BLACK);
|
||||
Stone orangeEight = new Stone(8, ORANGE);
|
||||
|
@ -105,7 +105,7 @@ public class RoundControlTest {
|
|||
new PlayerSettings("Matthias", Color.YELLOW));
|
||||
gameSettings.getPlayerList().add(new PlayerSettings("Jannis", Color.GREEN));
|
||||
gameSettings.getPlayerList().add(new PlayerSettings("Bennet", Color.BLACK));
|
||||
roundState = new RoundState(gameSettings);
|
||||
roundState = new RoundState(gameSettings, null);
|
||||
roundControl = new RoundControl(roundState, view);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.junit.Test;
|
|||
public class SaveControlTest {
|
||||
/**
|
||||
* @throws IOException
|
||||
* if input cannot be saved/loaded
|
||||
* if input cannot be saved/loaded
|
||||
*/
|
||||
@Test
|
||||
public void testSaveLoad() throws IOException {
|
||||
|
@ -33,7 +33,7 @@ public class SaveControlTest {
|
|||
settings.getPlayerList().add(new PlayerSettings("Ida", Color.PINK));
|
||||
|
||||
GameState gameState = new GameState();
|
||||
RoundState roundState = new RoundState(settings);
|
||||
RoundState roundState = new RoundState(settings, null);
|
||||
|
||||
Stone stone1 = new Stone(1, RED);
|
||||
Stone stone2 = new Stone(5, RED);
|
||||
|
@ -57,12 +57,11 @@ public class SaveControlTest {
|
|||
new IListener3<GameSettings, GameState, IRoundState>() {
|
||||
|
||||
@Override
|
||||
public void handle(GameSettings settings,
|
||||
GameState gameState, IRoundState roundState) {
|
||||
public void handle(GameSettings settings, GameState gameState,
|
||||
IRoundState roundState) {
|
||||
assertEquals(2, settings.getPlayerList().size());
|
||||
assertEquals(1, roundState.getTable().getSize());
|
||||
assertEquals(2, roundState.getActivePlayer().getHand()
|
||||
.getSize());
|
||||
assertEquals(2, roundState.getActivePlayer().getHand().getSize());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package jrummikub.control.network;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.UUID;
|
||||
|
@ -37,7 +36,7 @@ public class GameJoinControlTest {
|
|||
mockConnection.nickname = "Karl";
|
||||
view = new MockView();
|
||||
loginData = new LoginData("Karl", "server", "password", "channel");
|
||||
networkControl = new NetworkControl(loginData, mockConnection, view);
|
||||
networkControl = new NetworkControl(loginData, mockConnection, null, view);
|
||||
networkControl.startNetwork();
|
||||
|
||||
mockConnection.connectedEvent.emit();
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package jrummikub.control.network;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.UUID;
|
||||
|
@ -36,7 +33,7 @@ public class GameOfferControlTest {
|
|||
mockConnection.nickname = "Karl";
|
||||
view = new MockView();
|
||||
loginData = new LoginData("Karl", "server", "password", "channel");
|
||||
networkControl = new NetworkControl(loginData, mockConnection, view);
|
||||
networkControl = new NetworkControl(loginData, mockConnection, null, view);
|
||||
networkControl.startNetwork();
|
||||
|
||||
mockConnection.connectedEvent.emit();
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package jrummikub.control.network;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.UUID;
|
||||
|
@ -38,7 +35,7 @@ public class NetworkControlTest {
|
|||
mockConnection.nickname = "Karl";
|
||||
view = new MockView();
|
||||
loginData = new LoginData("Karl", "server", "password", "channel");
|
||||
networkControl = new NetworkControl(loginData, mockConnection, view);
|
||||
networkControl = new NetworkControl(loginData, mockConnection, null, view);
|
||||
networkControl.startNetwork();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class NetworkRoundControlTest {
|
|||
gameSettings.getPlayerList().get(1).setType(Type.COMPUTER);
|
||||
gameSettings.getPlayerList().get(2).setType(Type.NETWORK);
|
||||
gameSettings.getPlayerList().get(3).setType(Type.COMPUTER);
|
||||
testRoundState = new RoundState(gameSettings);
|
||||
testRoundState = new RoundState(gameSettings, null);
|
||||
testRound = new NetworkRoundControl(testRoundState, view,
|
||||
connectionControl, true);
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class NetworkRoundControlTest {
|
|||
gameSettings.getPlayerList().get(0).setType(Type.NETWORK);
|
||||
gameSettings.getPlayerList().get(1).setType(Type.COMPUTER);
|
||||
gameSettings.getPlayerList().get(3).setType(Type.COMPUTER);
|
||||
testRoundState = new RoundState(gameSettings);
|
||||
testRoundState = new RoundState(gameSettings, null);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
IPlayer player = testRoundState.getNthPlayer(i);
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package jrummikub.control.network;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -35,7 +32,7 @@ public class NetworkSettingsControlTest {
|
|||
mockConnection.nickname = "Karl";
|
||||
view = new MockView();
|
||||
loginData = new LoginData("Karl", "server", "password", "channel");
|
||||
networkControl = new NetworkControl(loginData, mockConnection, view);
|
||||
networkControl = new NetworkControl(loginData, mockConnection, null, view);
|
||||
networkControl.startNetwork();
|
||||
|
||||
mockConnection.connectedEvent.emit();
|
||||
|
|
|
@ -21,7 +21,7 @@ public class RoundStateTest {
|
|||
settings.getPlayerList().add(new PlayerSettings("Player 2", Color.YELLOW));
|
||||
settings.getPlayerList().add(new PlayerSettings("Player 3", Color.BLUE));
|
||||
|
||||
testRound = new RoundState(settings);
|
||||
testRound = new RoundState(settings, null);
|
||||
}
|
||||
|
||||
/** */
|
||||
|
|
Reference in a new issue