From cf0d7e81675655a45af8eb957406cbdb0cacf242 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sun, 6 Feb 2011 15:00:36 +0000 Subject: [PATCH] Updating test files for new protocol version. --- .../JoinGameRequestMessage.java | 18 ++++++++++++++++++ tests/src/pokerth_protocol/NetGameInfo.java | 2 +- tests/src/pokerth_test/CreateGameTest.java | 3 ++- .../pokerth_test/CreateRankingGameTest.java | 3 ++- tests/src/pokerth_test/RunNormalGameTest.java | 3 ++- tests/src/pokerth_test/RunRankingGameTest.java | 5 +++-- .../src/pokerth_test/StartNormalGameTest.java | 3 ++- tests/src/pokerth_test/TestBase.java | 8 +++++--- 8 files changed, 35 insertions(+), 10 deletions(-) diff --git a/tests/src/pokerth_protocol/JoinGameRequestMessage.java b/tests/src/pokerth_protocol/JoinGameRequestMessage.java index d4667e33..a6b004eb 100644 --- a/tests/src/pokerth_protocol/JoinGameRequestMessage.java +++ b/tests/src/pokerth_protocol/JoinGameRequestMessage.java @@ -118,6 +118,12 @@ import org.bn.types.*; private String password = null; + @ASN1Boolean( name = "" ) + + @ASN1Element ( name = "autoLeave", isOptional = false , hasTag = false , hasDefaultValue = false ) + + private Boolean autoLeave = null; + public JoinGameActionChoiceType getJoinGameAction () { @@ -147,6 +153,18 @@ import org.bn.types.*; } + + public Boolean getAutoLeave () { + return this.autoLeave; + } + + + + public void setAutoLeave (Boolean value) { + this.autoLeave = value; + } + + public void initWithDefaults() { diff --git a/tests/src/pokerth_protocol/NetGameInfo.java b/tests/src/pokerth_protocol/NetGameInfo.java index dff374f5..e0cf56df 100644 --- a/tests/src/pokerth_protocol/NetGameInfo.java +++ b/tests/src/pokerth_protocol/NetGameInfo.java @@ -272,7 +272,7 @@ import org.bn.types.*; @ASN1Integer( name = "" ) @ASN1ValueRangeConstraint ( - min = 5L, + min = 0L, max = 60L diff --git a/tests/src/pokerth_test/CreateGameTest.java b/tests/src/pokerth_test/CreateGameTest.java index 0d631ebf..740d327e 100644 --- a/tests/src/pokerth_test/CreateGameTest.java +++ b/tests/src/pokerth_test/CreateGameTest.java @@ -44,7 +44,8 @@ public class CreateGameTest extends TestBase { NetGameTypeEnumType.EnumType.normalGame, 20, 7, - GamePassword)); + GamePassword, + false)); PokerTHMessage msg; msg = receiveMessage(); diff --git a/tests/src/pokerth_test/CreateRankingGameTest.java b/tests/src/pokerth_test/CreateRankingGameTest.java index 2f5aca11..88e82acb 100644 --- a/tests/src/pokerth_test/CreateRankingGameTest.java +++ b/tests/src/pokerth_test/CreateRankingGameTest.java @@ -42,7 +42,8 @@ public class CreateRankingGameTest extends TestBase { NetGameTypeEnumType.EnumType.rankingGame, 20, 7, - password)); + password, + false)); } @Test diff --git a/tests/src/pokerth_test/RunNormalGameTest.java b/tests/src/pokerth_test/RunNormalGameTest.java index 14fe2a8d..51560e41 100644 --- a/tests/src/pokerth_test/RunNormalGameTest.java +++ b/tests/src/pokerth_test/RunNormalGameTest.java @@ -48,7 +48,8 @@ public class RunNormalGameTest extends TestBase { NetGameTypeEnumType.EnumType.normalGame, 10, 5, - "")); + "", + false)); PokerTHMessage msg; diff --git a/tests/src/pokerth_test/RunRankingGameTest.java b/tests/src/pokerth_test/RunRankingGameTest.java index a257cc0b..20650d5d 100644 --- a/tests/src/pokerth_test/RunRankingGameTest.java +++ b/tests/src/pokerth_test/RunRankingGameTest.java @@ -95,7 +95,8 @@ public class RunRankingGameTest extends TestBase { NetGameTypeEnumType.EnumType.rankingGame, 5, 7, - "")); + "", + false)); PokerTHMessage msg; @@ -134,7 +135,7 @@ public class RunRankingGameTest extends TestBase { String username = "test" + (i+1); String password = username; playerId[i] = userInit(s[i], username, password); - sendMessage(joinGameRequestMsg(gameId, ""), s[i]); + sendMessage(joinGameRequestMsg(gameId, "", false), s[i]); do { msg = receiveMessage(s[i]); failOnErrorMessage(msg); diff --git a/tests/src/pokerth_test/StartNormalGameTest.java b/tests/src/pokerth_test/StartNormalGameTest.java index 63794533..4daba42d 100644 --- a/tests/src/pokerth_test/StartNormalGameTest.java +++ b/tests/src/pokerth_test/StartNormalGameTest.java @@ -42,7 +42,8 @@ public class StartNormalGameTest extends TestBase { NetGameTypeEnumType.EnumType.normalGame, 10, 7, - "")); + "", + false)); PokerTHMessage msg; msg = receiveMessage(); diff --git a/tests/src/pokerth_test/TestBase.java b/tests/src/pokerth_test/TestBase.java index f5404258..ce54c119 100644 --- a/tests/src/pokerth_test/TestBase.java +++ b/tests/src/pokerth_test/TestBase.java @@ -40,7 +40,7 @@ import java.util.Collection; public abstract class TestBase { - public final int PROTOCOL_VERSION_MAJOR = 1; + public final int PROTOCOL_VERSION_MAJOR = 2; public final int PROTOCOL_VERSION_MINOR = 0; public final String AuthUser = "user"; public final String AuthPassword = "pencil"; @@ -198,7 +198,7 @@ public abstract class TestBase { return playerId; } - public PokerTHMessage createGameRequestMsg(NetGameInfo gameInfo, NetGameTypeEnumType.EnumType type, int playerActionTimeout, int guiSpeed, String password) { + public PokerTHMessage createGameRequestMsg(NetGameInfo gameInfo, NetGameTypeEnumType.EnumType type, int playerActionTimeout, int guiSpeed, String password, boolean autoLeave) { NetGameTypeEnumType gameType = new NetGameTypeEnumType(); gameType.setValue(type); gameInfo.setNetGameType(gameType); @@ -213,6 +213,7 @@ public abstract class TestBase { if (!password.isEmpty()) { joinType.setPassword(password); } + joinType.setAutoLeave(autoLeave); JoinGameRequestMessage joinRequest = new JoinGameRequestMessage(); joinRequest.setValue(joinType); @@ -221,7 +222,7 @@ public abstract class TestBase { return msg; } - public PokerTHMessage joinGameRequestMsg(long gameId, String password) { + public PokerTHMessage joinGameRequestMsg(long gameId, String password, boolean autoLeave) { JoinExistingGame joinExisting = new JoinExistingGame(); joinExisting.setGameId(new NonZeroId(gameId)); JoinGameActionChoiceType joinAction = new JoinGameActionChoiceType(); @@ -231,6 +232,7 @@ public abstract class TestBase { if (!password.isEmpty()) { joinType.setPassword(password); } + joinType.setAutoLeave(autoLeave); JoinGameRequestMessage joinRequest = new JoinGameRequestMessage(); joinRequest.setValue(joinType);