Still fixing tests.
This commit is contained in:
@@ -28,6 +28,11 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import de.pokerth.protocol.ProtoBuf.NetGameInfo;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.NetGameInfo.EndRaiseMode;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.NetGameInfo.NetGameType;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.PokerTHMessage;
|
||||||
|
|
||||||
|
|
||||||
public class SeatStateTest extends TestBase {
|
public class SeatStateTest extends TestBase {
|
||||||
|
|
||||||
@@ -35,14 +40,11 @@ public class SeatStateTest extends TestBase {
|
|||||||
public void testSeatState() throws Exception {
|
public void testSeatState() throws Exception {
|
||||||
long firstPlayerId = userInit();
|
long firstPlayerId = userInit();
|
||||||
|
|
||||||
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
|
Collection<Integer> l = new ArrayList<Integer>();
|
||||||
String gameName = AuthUser + " run normal game for seatState";
|
String gameName = AuthUser + " run normal game for seatState";
|
||||||
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 200, gameName, l, 10, 0, 2, 10000);
|
NetGameInfo gameInfo = createGameInfo(NetGameType.normalGame, 5, 7, 5, EndRaiseMode.doubleBlinds, 0, 200, gameName, l, 10, 0, 2, 10000);
|
||||||
sendMessage(createGameRequestMsg(
|
sendMessage(createGameRequestMsg(
|
||||||
gameInfo,
|
gameInfo,
|
||||||
NetGameTypeEnumType.EnumType.normalGame,
|
|
||||||
5,
|
|
||||||
7,
|
|
||||||
"",
|
"",
|
||||||
false));
|
false));
|
||||||
|
|
||||||
|
|||||||
@@ -24,66 +24,80 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import de.pokerth.protocol.ProtoBuf.NetGameInfo;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.NetGameInfo.EndRaiseMode;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.NetGameInfo.NetGameType;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.PokerTHMessage.PokerTHMessageType;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.PokerTHMessage;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.StartEventAckMessage;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.StartEventMessage;
|
||||||
|
import de.pokerth.protocol.ProtoBuf.StartEventMessage.StartEventType;
|
||||||
|
|
||||||
public class StartNormalGameTest extends TestBase {
|
public class StartNormalGameTest extends TestBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGameStartMessage() throws Exception {
|
public void testGameStartMessage() throws Exception {
|
||||||
guestInit();
|
guestInit();
|
||||||
|
|
||||||
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
|
Collection<Integer> l = new ArrayList<Integer>();
|
||||||
NetGameInfo gameInfo = createGameInfo(10, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " start normal game", l, 10, 0, 11, 20000);
|
NetGameInfo gameInfo = createGameInfo(NetGameType.normalGame, 10, 7, 10, EndRaiseMode.doubleBlinds, 0, 100, GuestUser + " start normal game", l, 10, 0, 11, 20000);
|
||||||
sendMessage(createGameRequestMsg(
|
sendMessage(createGameRequestMsg(
|
||||||
gameInfo,
|
gameInfo,
|
||||||
NetGameTypeEnumType.EnumType.normalGame,
|
|
||||||
10,
|
|
||||||
7,
|
|
||||||
"",
|
"",
|
||||||
false));
|
false));
|
||||||
|
|
||||||
PokerTHMessage msg;
|
PokerTHMessage msg;
|
||||||
// Waiting for player list update.
|
// Waiting for player list update.
|
||||||
msg = receiveMessage();
|
msg = receiveMessage();
|
||||||
if (!msg.isPlayerListMessageSelected()) {
|
if (!msg.hasPlayerListMessage()) {
|
||||||
failOnErrorMessage(msg);
|
failOnErrorMessage(msg);
|
||||||
fail("Invalid message.");
|
fail("Invalid message.");
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = receiveMessage();
|
msg = receiveMessage();
|
||||||
if (!msg.isGameListMessageSelected()) {
|
if (!msg.hasGameListNewMessage()) {
|
||||||
failOnErrorMessage(msg);
|
failOnErrorMessage(msg);
|
||||||
fail("Invalid message.");
|
fail("Invalid message.");
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = receiveMessage();
|
msg = receiveMessage();
|
||||||
if (msg.isJoinGameReplyMessageSelected()) {
|
if (!msg.hasJoinGameAckMessage()) {
|
||||||
if (!msg.getJoinGameReplyMessage().getValue().getJoinGameResult().isJoinGameAckSelected()) {
|
failOnErrorMessage(msg);
|
||||||
fail("Could not create game!");
|
fail("Could not create game!");
|
||||||
}
|
}
|
||||||
}
|
int gameId = msg.getJoinGameAckMessage().getGameId();
|
||||||
else {
|
|
||||||
failOnErrorMessage(msg);
|
|
||||||
fail("Invalid message.");
|
|
||||||
}
|
|
||||||
long gameId = msg.getJoinGameReplyMessage().getValue().getGameId().getValue();
|
|
||||||
|
|
||||||
StartEvent startEvent = new StartEvent();
|
StartEventMessage startMsg = StartEventMessage.newBuilder()
|
||||||
startEvent.setFillWithComputerPlayers(true);
|
.setGameId(gameId)
|
||||||
StartEventTypeChoiceType eventType = new StartEventTypeChoiceType();
|
.setFillWithComputerPlayers(true)
|
||||||
eventType.selectStartEvent(startEvent);
|
.setStartEventType(StartEventType.startEvent)
|
||||||
StartEventMessageSequenceType gameStartType = new StartEventMessageSequenceType();
|
.build();
|
||||||
gameStartType.setGameId(new NonZeroId(gameId));
|
msg = PokerTHMessage.newBuilder()
|
||||||
gameStartType.setStartEventType(eventType);
|
.setMessageType(PokerTHMessageType.Type_StartEventMessage)
|
||||||
StartEventMessage startMsg = new StartEventMessage();
|
.setStartEventMessage(startMsg)
|
||||||
startMsg.setValue(gameStartType);
|
.build();
|
||||||
msg = new PokerTHMessage();
|
|
||||||
msg.selectStartEventMessage(startMsg);
|
|
||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
msg = receiveMessage();
|
msg = receiveMessage();
|
||||||
} while (msg.isGameListMessageSelected());
|
} while (msg.hasGameListPlayerJoinedMessage() || msg.hasGamePlayerJoinedMessage());
|
||||||
|
|
||||||
if (msg.isGameStartMessageSelected()) {
|
assertTrue(msg.hasStartEventMessage() && msg.getMessageType() == PokerTHMessageType.Type_StartEventMessage);
|
||||||
|
|
||||||
|
StartEventAckMessage startAck = StartEventAckMessage.newBuilder()
|
||||||
|
.setGameId(gameId)
|
||||||
|
.build();
|
||||||
|
msg = PokerTHMessage.newBuilder()
|
||||||
|
.setMessageType(PokerTHMessageType.Type_StartEventAckMessage)
|
||||||
|
.setStartEventAckMessage(startAck)
|
||||||
|
.build();
|
||||||
|
sendMessage(msg);
|
||||||
|
|
||||||
|
do {
|
||||||
|
msg = receiveMessage();
|
||||||
|
} while (msg.hasGameListUpdateMessage());
|
||||||
|
|
||||||
|
if (!msg.hasGameStartInitialMessage()) {
|
||||||
failOnErrorMessage(msg);
|
failOnErrorMessage(msg);
|
||||||
fail("Invalid message.");
|
fail("Invalid message.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user