Updating protocol files for tests.

This commit is contained in:
lotodore
2011-07-17 14:16:13 +00:00
parent d8ccf015d3
commit 77f7287851
20 changed files with 256 additions and 184 deletions
+2 -1
View File
@@ -36,6 +36,7 @@ import pokerth_protocol.ChatRequestMessage.ChatRequestMessageSequenceType;
import pokerth_protocol.ChatRequestMessage.ChatRequestMessageSequenceType.ChatRequestTypeChoiceType;
import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class ChatTest extends TestBase {
@@ -162,7 +163,7 @@ public class ChatTest extends TestBase {
assertEquals(playerId[0], msg.getChatMessage().getValue().getChatType().getChatTypePrivate().getPlayerId().getValue().longValue());
// Game messages can be sent by registered users within a game.
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " game list normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg(
gameInfo,
+4 -4
View File
@@ -34,10 +34,10 @@ public class CreateGameTest extends TestBase {
public void testJoinGameRequestMessage() throws Exception {
guestInit();
Collection<Integer> l = new ArrayList<Integer>();
l.add(250);
l.add(600);
l.add(1000);
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
l.add(new InitialNonZeroAmountOfMoney(250));
l.add(new InitialNonZeroAmountOfMoney(600));
l.add(new InitialNonZeroAmountOfMoney(1000));
NetGameInfo gameInfo = createGameInfo(8, EndRaiseModeEnumType.EnumType.raiseByEndValue, 1000, 100, GuestUser + " create test game", l, 10, 0, 7, 2000);
sendMessage(createGameRequestMsg(
gameInfo,
@@ -35,7 +35,7 @@ public class CreateRankingGameTest extends TestBase {
private void createRankingGame(String password) throws Exception {
counter++;
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
NetGameInfo gameInfo = createGameInfo(8, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 50, GuestUser + " create ranking game " + counter, l, 10, 0, 11, 10000);
sendMessage(createGameRequestMsg(
gameInfo,
+2 -1
View File
@@ -33,6 +33,7 @@ import pokerth_protocol.NetGameMode;
import pokerth_protocol.PokerTHMessage;
import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class GameListTest extends TestBase {
@@ -67,7 +68,7 @@ public class GameListTest extends TestBase {
assertTrue(msg.isPlayerListMessageSelected());
// Create a new game.
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " game list normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg(
gameInfo,
+2 -2
View File
@@ -64,7 +64,7 @@ public class LoadTest extends TestBase {
fail("Invalid message.");
}
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
String gameName = AuthUser + " load game " + i;
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 200, gameName, l, 10, 0, 1, 10000);
sendMessage(createGameRequestMsg(
@@ -142,7 +142,7 @@ public class LoadTest extends TestBase {
myRequest.setGameState(msg.getPlayersTurnMessage().getValue().getGameState());
myRequest.setHandNum(new NonZeroId(handNum));
myRequest.setMyAction(action);
myRequest.setMyRelativeBet(0);
myRequest.setMyRelativeBet(new AmountOfMoney(0));
MyActionRequestMessage myAction = new MyActionRequestMessage();
myAction.setValue(myRequest);
PokerTHMessage outMsg = new PokerTHMessage();
@@ -33,6 +33,7 @@ import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.SubscriptionRequestMessage.SubscriptionRequestMessageSequenceType;
import pokerth_protocol.SubscriptionRequestMessage.SubscriptionRequestMessageSequenceType.SubscriptionActionEnumType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class LobbySubscriptionTest extends TestBase {
@@ -59,7 +60,7 @@ public class LobbySubscriptionTest extends TestBase {
sendMessage(msg);
// Create a new game.
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " game list normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg(
gameInfo,
@@ -37,6 +37,7 @@ import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.StartEventAckMessage.StartEventAckMessageSequenceType;
import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class RunNormalGameTest extends TestBase {
@@ -45,7 +46,7 @@ public class RunNormalGameTest extends TestBase {
public void testRunNormalGameAsGuest() throws Exception {
guestInit();
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " run normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg(
gameInfo,
@@ -147,14 +148,14 @@ public class RunNormalGameTest extends TestBase {
msg = receiveMessage();
if (msg.isEndOfHandMessageSelected()) {
if (msg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandHideCardsSelected()) {
lastPlayerMoney = msg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandHideCards().getPlayerMoney();
lastPlayerMoney = msg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandHideCards().getPlayerMoney().getValue();
} else if (msg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandShowCardsSelected()) {
Collection<PlayerResult> result = msg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandShowCards().getPlayerResults();
assertFalse(result.isEmpty());
long maxPlayerMoney = 0;
for (Iterator<PlayerResult> it = result.iterator(); it.hasNext(); ) {
PlayerResult r = it.next();
long curMoney = r.getPlayerMoney();
long curMoney = r.getPlayerMoney().getValue();
if (curMoney > maxPlayerMoney) {
maxPlayerMoney = curMoney;
}
@@ -26,7 +26,6 @@ import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.StringTokenizer;
import org.junit.Test;
@@ -58,7 +57,7 @@ public class RunRankingGameTest extends TestBase {
fail("Invalid message.");
}
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
String gameName = AuthUser + " run ranking game";
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 50, gameName, l, 10, 0, 11, 10000);
sendMessage(createGameRequestMsg(
@@ -216,7 +215,7 @@ public class RunRankingGameTest extends TestBase {
myRequest.setGameState(msg.getPlayersTurnMessage().getValue().getGameState());
myRequest.setHandNum(new NonZeroId(handNum));
myRequest.setMyAction(action);
myRequest.setMyRelativeBet(0);
myRequest.setMyRelativeBet(new AmountOfMoney(0));
MyActionRequestMessage myAction = new MyActionRequestMessage();
myAction.setValue(myRequest);
PokerTHMessage outMsg = new PokerTHMessage();
@@ -237,7 +236,7 @@ public class RunRankingGameTest extends TestBase {
myRequest.setGameState(inMsg.getPlayersTurnMessage().getValue().getGameState());
myRequest.setHandNum(new NonZeroId(handNum));
myRequest.setMyAction(action);
myRequest.setMyRelativeBet(0);
myRequest.setMyRelativeBet(new AmountOfMoney(0));
MyActionRequestMessage myAction = new MyActionRequestMessage();
myAction.setValue(myRequest);
PokerTHMessage outMsg = new PokerTHMessage();
@@ -247,14 +246,14 @@ public class RunRankingGameTest extends TestBase {
}
else if (inMsg.isEndOfHandMessageSelected()) {
if (inMsg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandHideCardsSelected()) {
lastPlayerMoney = inMsg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandHideCards().getPlayerMoney();
lastPlayerMoney = inMsg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandHideCards().getPlayerMoney().getValue();
} else if (inMsg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandShowCardsSelected()) {
Collection<PlayerResult> result = inMsg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandShowCards().getPlayerResults();
assertFalse(result.isEmpty());
long maxPlayerMoney = 0;
for (Iterator<PlayerResult> it = result.iterator(); it.hasNext(); ) {
PlayerResult r = it.next();
long curMoney = r.getPlayerMoney();
long curMoney = r.getPlayerMoney().getValue();
if (curMoney > maxPlayerMoney) {
maxPlayerMoney = curMoney;
}
@@ -35,7 +35,7 @@ public class StartNormalGameTest extends TestBase {
public void testGameStartMessage() throws Exception {
guestInit();
Collection<Integer> l = new ArrayList<Integer>();
Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
NetGameInfo gameInfo = createGameInfo(10, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " start normal game", l, 10, 0, 11, 20000);
sendMessage(createGameRequestMsg(
gameInfo,
+3 -3
View File
@@ -288,13 +288,13 @@ public abstract class TestBase {
}
public NetGameInfo createGameInfo(int delayBetweenHands, EndRaiseModeEnumType.EnumType endMode, int endRaiseValue, int sb, String gameName,
Collection<Integer> manualBlinds, int maxNumPlayers, int raiseEveryMinutes, int raiseEveryHands, int startMoney) {
Collection<InitialNonZeroAmountOfMoney> manualBlinds, int maxNumPlayers, int raiseEveryMinutes, int raiseEveryHands, int startMoney) {
NetGameInfo gameInfo = new NetGameInfo();
EndRaiseModeEnumType endRaise = new EndRaiseModeEnumType();
endRaise.setValue(endMode);
gameInfo.setDelayBetweenHands(delayBetweenHands);
gameInfo.setEndRaiseMode(endRaise);
gameInfo.setEndRaiseSmallBlindValue(endRaiseValue);
gameInfo.setEndRaiseSmallBlindValue(new InitialAmountOfMoney(endRaiseValue));
gameInfo.setFirstSmallBlind(sb);
gameInfo.setGameName(gameName);
gameInfo.setManualBlinds(manualBlinds);
@@ -307,7 +307,7 @@ public abstract class TestBase {
raiseInterval.selectRaiseEveryHands(raiseEveryHands);
}
gameInfo.setRaiseIntervalMode(raiseInterval);
gameInfo.setStartMoney(startMoney);
gameInfo.setStartMoney(new InitialNonZeroAmountOfMoney(startMoney));
return gameInfo;
}