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
@@ -0,0 +1,58 @@
package pokerth_protocol;
//
// This file was generated by the BinaryNotes compiler.
// See http://bnotes.sourceforge.net
// Any modifications to this file will be lost upon recompilation of the source ASN.1.
//
import org.bn.*;
import org.bn.annotations.*;
import org.bn.annotations.constraints.*;
import org.bn.coders.*;
import org.bn.types.*;
@ASN1PreparedElement
@ASN1BoxedType ( name = "AmountOfMoney" )
public class AmountOfMoney implements IASN1PreparedElement {
@ASN1Integer( name = "AmountOfMoney" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
private Integer value;
public AmountOfMoney() {
}
public AmountOfMoney(Integer value) {
this.value = value;
}
public void setValue(Integer value) {
this.value = value;
}
public Integer getValue() {
return this.value;
}
public void initWithDefaults() {
}
private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(AmountOfMoney.class);
public IASN1PreparedElementData getPreparedData() {
return preparedData;
}
}
@@ -23,31 +23,15 @@ import org.bn.types.*;
private NonZeroId playerId = null; private NonZeroId playerId = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "moneyWon", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "moneyWon", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer moneyWon = null; private AmountOfMoney moneyWon = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer playerMoney = null; private AmountOfMoney playerMoney = null;
@@ -63,25 +47,25 @@ import org.bn.types.*;
public Integer getMoneyWon () { public AmountOfMoney getMoneyWon () {
return this.moneyWon; return this.moneyWon;
} }
public void setMoneyWon (Integer value) { public void setMoneyWon (AmountOfMoney value) {
this.moneyWon = value; this.moneyWon = value;
} }
public Integer getPlayerMoney () { public AmountOfMoney getPlayerMoney () {
return this.playerMoney; return this.playerMoney;
} }
public void setPlayerMoney (Integer value) { public void setPlayerMoney (AmountOfMoney value) {
this.playerMoney = value; this.playerMoney = value;
} }
@@ -0,0 +1,58 @@
package pokerth_protocol;
//
// This file was generated by the BinaryNotes compiler.
// See http://bnotes.sourceforge.net
// Any modifications to this file will be lost upon recompilation of the source ASN.1.
//
import org.bn.*;
import org.bn.annotations.*;
import org.bn.annotations.constraints.*;
import org.bn.coders.*;
import org.bn.types.*;
@ASN1PreparedElement
@ASN1BoxedType ( name = "InitialAmountOfMoney" )
public class InitialAmountOfMoney implements IASN1PreparedElement {
@ASN1Integer( name = "InitialAmountOfMoney" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 1000000L
)
private Integer value;
public InitialAmountOfMoney() {
}
public InitialAmountOfMoney(Integer value) {
this.value = value;
}
public void setValue(Integer value) {
this.value = value;
}
public Integer getValue() {
return this.value;
}
public void initWithDefaults() {
}
private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(InitialAmountOfMoney.class);
public IASN1PreparedElementData getPreparedData() {
return preparedData;
}
}
@@ -0,0 +1,58 @@
package pokerth_protocol;
//
// This file was generated by the BinaryNotes compiler.
// See http://bnotes.sourceforge.net
// Any modifications to this file will be lost upon recompilation of the source ASN.1.
//
import org.bn.*;
import org.bn.annotations.*;
import org.bn.annotations.constraints.*;
import org.bn.coders.*;
import org.bn.types.*;
@ASN1PreparedElement
@ASN1BoxedType ( name = "InitialNonZeroAmountOfMoney" )
public class InitialNonZeroAmountOfMoney implements IASN1PreparedElement {
@ASN1Integer( name = "InitialNonZeroAmountOfMoney" )
@ASN1ValueRangeConstraint (
min = 1L,
max = 1000000L
)
private Integer value;
public InitialNonZeroAmountOfMoney() {
}
public InitialNonZeroAmountOfMoney(Integer value) {
this.value = value;
}
public void setValue(Integer value) {
this.value = value;
}
public Integer getValue() {
return this.value;
}
public void initWithDefaults() {
}
private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(InitialNonZeroAmountOfMoney.class);
public IASN1PreparedElementData getPreparedData() {
return preparedData;
}
}
@@ -44,18 +44,10 @@ import org.bn.types.*;
private NetPlayerAction myAction = null; private NetPlayerAction myAction = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "myRelativeBet", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "myRelativeBet", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer myRelativeBet = null; private AmountOfMoney myRelativeBet = null;
@@ -107,13 +99,13 @@ import org.bn.types.*;
public Integer getMyRelativeBet () { public AmountOfMoney getMyRelativeBet () {
return this.myRelativeBet; return this.myRelativeBet;
} }
public void setMyRelativeBet (Integer value) { public void setMyRelativeBet (AmountOfMoney value) {
this.myRelativeBet = value; this.myRelativeBet = value;
} }
+9 -26
View File
@@ -295,33 +295,16 @@ import org.bn.types.*;
private Integer firstSmallBlind = null; private Integer firstSmallBlind = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 1000000L
)
@ASN1Element ( name = "endRaiseSmallBlindValue", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "endRaiseSmallBlindValue", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer endRaiseSmallBlindValue = null; private InitialAmountOfMoney endRaiseSmallBlindValue = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 1L,
max = 1000000L
)
@ASN1Element ( name = "startMoney", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "startMoney", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer startMoney = null; private InitialNonZeroAmountOfMoney startMoney = null;
@ASN1Integer( name = "" )
@ASN1SequenceOf( name = "manualBlinds", isSetOf = false ) @ASN1SequenceOf( name = "manualBlinds", isSetOf = false )
@@ -335,7 +318,7 @@ import org.bn.types.*;
@ASN1Element ( name = "manualBlinds", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "manualBlinds", isOptional = false , hasTag = false , hasDefaultValue = false )
private java.util.Collection<Integer> manualBlinds = null; private java.util.Collection<InitialNonZeroAmountOfMoney> manualBlinds = null;
@@ -447,37 +430,37 @@ import org.bn.types.*;
public Integer getEndRaiseSmallBlindValue () { public InitialAmountOfMoney getEndRaiseSmallBlindValue () {
return this.endRaiseSmallBlindValue; return this.endRaiseSmallBlindValue;
} }
public void setEndRaiseSmallBlindValue (Integer value) { public void setEndRaiseSmallBlindValue (InitialAmountOfMoney value) {
this.endRaiseSmallBlindValue = value; this.endRaiseSmallBlindValue = value;
} }
public Integer getStartMoney () { public InitialNonZeroAmountOfMoney getStartMoney () {
return this.startMoney; return this.startMoney;
} }
public void setStartMoney (Integer value) { public void setStartMoney (InitialNonZeroAmountOfMoney value) {
this.startMoney = value; this.startMoney = value;
} }
public java.util.Collection<Integer> getManualBlinds () { public java.util.Collection<InitialNonZeroAmountOfMoney> getManualBlinds () {
return this.manualBlinds; return this.manualBlinds;
} }
public void setManualBlinds (java.util.Collection<Integer> value) { public void setManualBlinds (java.util.Collection<InitialNonZeroAmountOfMoney> value) {
this.manualBlinds = value; this.manualBlinds = value;
} }
+6 -22
View File
@@ -50,31 +50,15 @@ import org.bn.types.*;
private Long cardsValue = null; private Long cardsValue = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "moneyWon", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "moneyWon", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer moneyWon = null; private AmountOfMoney moneyWon = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer playerMoney = null; private AmountOfMoney playerMoney = null;
@@ -138,25 +122,25 @@ import org.bn.types.*;
public Integer getMoneyWon () { public AmountOfMoney getMoneyWon () {
return this.moneyWon; return this.moneyWon;
} }
public void setMoneyWon (Integer value) { public void setMoneyWon (AmountOfMoney value) {
this.moneyWon = value; this.moneyWon = value;
} }
public Integer getPlayerMoney () { public AmountOfMoney getPlayerMoney () {
return this.playerMoney; return this.playerMoney;
} }
public void setPlayerMoney (Integer value) { public void setPlayerMoney (AmountOfMoney value) {
this.playerMoney = value; this.playerMoney = value;
} }
@@ -44,57 +44,25 @@ import org.bn.types.*;
private NetPlayerAction playerAction = null; private NetPlayerAction playerAction = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "totalPlayerBet", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "totalPlayerBet", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer totalPlayerBet = null; private AmountOfMoney totalPlayerBet = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer playerMoney = null; private AmountOfMoney playerMoney = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "highestSet", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "highestSet", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer highestSet = null; private AmountOfMoney highestSet = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "minimumRaise", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "minimumRaise", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer minimumRaise = null; private AmountOfMoney minimumRaise = null;
@@ -146,49 +114,49 @@ import org.bn.types.*;
public Integer getTotalPlayerBet () { public AmountOfMoney getTotalPlayerBet () {
return this.totalPlayerBet; return this.totalPlayerBet;
} }
public void setTotalPlayerBet (Integer value) { public void setTotalPlayerBet (AmountOfMoney value) {
this.totalPlayerBet = value; this.totalPlayerBet = value;
} }
public Integer getPlayerMoney () { public AmountOfMoney getPlayerMoney () {
return this.playerMoney; return this.playerMoney;
} }
public void setPlayerMoney (Integer value) { public void setPlayerMoney (AmountOfMoney value) {
this.playerMoney = value; this.playerMoney = value;
} }
public Integer getHighestSet () { public AmountOfMoney getHighestSet () {
return this.highestSet; return this.highestSet;
} }
public void setHighestSet (Integer value) { public void setHighestSet (AmountOfMoney value) {
this.highestSet = value; this.highestSet = value;
} }
public Integer getMinimumRaise () { public AmountOfMoney getMinimumRaise () {
return this.minimumRaise; return this.minimumRaise;
} }
public void setMinimumRaise (Integer value) { public void setMinimumRaise (AmountOfMoney value) {
this.minimumRaise = value; this.minimumRaise = value;
} }
@@ -23,18 +23,10 @@ import org.bn.types.*;
private NonZeroId playerId = null; private NonZeroId playerId = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "playerMoney", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer playerMoney = null; private AmountOfMoney playerMoney = null;
@@ -50,13 +42,13 @@ import org.bn.types.*;
public Integer getPlayerMoney () { public AmountOfMoney getPlayerMoney () {
return this.playerMoney; return this.playerMoney;
} }
public void setPlayerMoney (Integer value) { public void setPlayerMoney (AmountOfMoney value) {
this.playerMoney = value; this.playerMoney = value;
} }
@@ -39,18 +39,10 @@ import org.bn.types.*;
private NetPlayerAction yourAction = null; private NetPlayerAction yourAction = null;
@ASN1Integer( name = "" )
@ASN1ValueRangeConstraint (
min = 0L,
max = 10000000L
)
@ASN1Element ( name = "yourRelativeBet", isOptional = false , hasTag = false , hasDefaultValue = false ) @ASN1Element ( name = "yourRelativeBet", isOptional = false , hasTag = false , hasDefaultValue = false )
private Integer yourRelativeBet = null; private AmountOfMoney yourRelativeBet = null;
@@ -140,13 +132,13 @@ import org.bn.types.*;
public Integer getYourRelativeBet () { public AmountOfMoney getYourRelativeBet () {
return this.yourRelativeBet; return this.yourRelativeBet;
} }
public void setYourRelativeBet (Integer value) { public void setYourRelativeBet (AmountOfMoney value) {
this.yourRelativeBet = value; this.yourRelativeBet = value;
} }
+2 -1
View File
@@ -36,6 +36,7 @@ import pokerth_protocol.ChatRequestMessage.ChatRequestMessageSequenceType;
import pokerth_protocol.ChatRequestMessage.ChatRequestMessageSequenceType.ChatRequestTypeChoiceType; import pokerth_protocol.ChatRequestMessage.ChatRequestMessageSequenceType.ChatRequestTypeChoiceType;
import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType; import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType; import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class ChatTest extends TestBase { 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()); assertEquals(playerId[0], msg.getChatMessage().getValue().getChatType().getChatTypePrivate().getPlayerId().getValue().longValue());
// Game messages can be sent by registered users within a game. // 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); NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " game list normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, gameInfo,
+4 -4
View File
@@ -34,10 +34,10 @@ public class CreateGameTest extends TestBase {
public void testJoinGameRequestMessage() throws Exception { public void testJoinGameRequestMessage() throws Exception {
guestInit(); guestInit();
Collection<Integer> l = new ArrayList<Integer>(); Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
l.add(250); l.add(new InitialNonZeroAmountOfMoney(250));
l.add(600); l.add(new InitialNonZeroAmountOfMoney(600));
l.add(1000); l.add(new InitialNonZeroAmountOfMoney(1000));
NetGameInfo gameInfo = createGameInfo(8, EndRaiseModeEnumType.EnumType.raiseByEndValue, 1000, 100, GuestUser + " create test game", l, 10, 0, 7, 2000); NetGameInfo gameInfo = createGameInfo(8, EndRaiseModeEnumType.EnumType.raiseByEndValue, 1000, 100, GuestUser + " create test game", l, 10, 0, 7, 2000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, gameInfo,
@@ -35,7 +35,7 @@ public class CreateRankingGameTest extends TestBase {
private void createRankingGame(String password) throws Exception { private void createRankingGame(String password) throws Exception {
counter++; 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); NetGameInfo gameInfo = createGameInfo(8, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 50, GuestUser + " create ranking game " + counter, l, 10, 0, 11, 10000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, gameInfo,
+2 -1
View File
@@ -33,6 +33,7 @@ import pokerth_protocol.NetGameMode;
import pokerth_protocol.PokerTHMessage; import pokerth_protocol.PokerTHMessage;
import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType; import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType; import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class GameListTest extends TestBase { public class GameListTest extends TestBase {
@@ -67,7 +68,7 @@ public class GameListTest extends TestBase {
assertTrue(msg.isPlayerListMessageSelected()); assertTrue(msg.isPlayerListMessageSelected());
// Create a new game. // 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); NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " game list normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, gameInfo,
+2 -2
View File
@@ -64,7 +64,7 @@ public class LoadTest extends TestBase {
fail("Invalid message."); fail("Invalid message.");
} }
Collection<Integer> l = new ArrayList<Integer>(); Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
String gameName = AuthUser + " load game " + i; String gameName = AuthUser + " load game " + i;
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 200, gameName, l, 10, 0, 1, 10000); NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 200, gameName, l, 10, 0, 1, 10000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
@@ -142,7 +142,7 @@ public class LoadTest extends TestBase {
myRequest.setGameState(msg.getPlayersTurnMessage().getValue().getGameState()); myRequest.setGameState(msg.getPlayersTurnMessage().getValue().getGameState());
myRequest.setHandNum(new NonZeroId(handNum)); myRequest.setHandNum(new NonZeroId(handNum));
myRequest.setMyAction(action); myRequest.setMyAction(action);
myRequest.setMyRelativeBet(0); myRequest.setMyRelativeBet(new AmountOfMoney(0));
MyActionRequestMessage myAction = new MyActionRequestMessage(); MyActionRequestMessage myAction = new MyActionRequestMessage();
myAction.setValue(myRequest); myAction.setValue(myRequest);
PokerTHMessage outMsg = new PokerTHMessage(); PokerTHMessage outMsg = new PokerTHMessage();
@@ -33,6 +33,7 @@ import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType; import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.SubscriptionRequestMessage.SubscriptionRequestMessageSequenceType; import pokerth_protocol.SubscriptionRequestMessage.SubscriptionRequestMessageSequenceType;
import pokerth_protocol.SubscriptionRequestMessage.SubscriptionRequestMessageSequenceType.SubscriptionActionEnumType; import pokerth_protocol.SubscriptionRequestMessage.SubscriptionRequestMessageSequenceType.SubscriptionActionEnumType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class LobbySubscriptionTest extends TestBase { public class LobbySubscriptionTest extends TestBase {
@@ -59,7 +60,7 @@ public class LobbySubscriptionTest extends TestBase {
sendMessage(msg); sendMessage(msg);
// Create a new game. // 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); NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " game list normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, gameInfo,
@@ -37,6 +37,7 @@ import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType; import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.StartEventAckMessage.StartEventAckMessageSequenceType; import pokerth_protocol.StartEventAckMessage.StartEventAckMessageSequenceType;
import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType; import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
public class RunNormalGameTest extends TestBase { public class RunNormalGameTest extends TestBase {
@@ -45,7 +46,7 @@ public class RunNormalGameTest extends TestBase {
public void testRunNormalGameAsGuest() throws Exception { public void testRunNormalGameAsGuest() throws Exception {
guestInit(); 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); NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " run normal game", l, 10, 0, 2, 2000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, gameInfo,
@@ -147,14 +148,14 @@ public class RunNormalGameTest extends TestBase {
msg = receiveMessage(); msg = receiveMessage();
if (msg.isEndOfHandMessageSelected()) { if (msg.isEndOfHandMessageSelected()) {
if (msg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandHideCardsSelected()) { 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()) { } else if (msg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandShowCardsSelected()) {
Collection<PlayerResult> result = msg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandShowCards().getPlayerResults(); Collection<PlayerResult> result = msg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandShowCards().getPlayerResults();
assertFalse(result.isEmpty()); assertFalse(result.isEmpty());
long maxPlayerMoney = 0; long maxPlayerMoney = 0;
for (Iterator<PlayerResult> it = result.iterator(); it.hasNext(); ) { for (Iterator<PlayerResult> it = result.iterator(); it.hasNext(); ) {
PlayerResult r = it.next(); PlayerResult r = it.next();
long curMoney = r.getPlayerMoney(); long curMoney = r.getPlayerMoney().getValue();
if (curMoney > maxPlayerMoney) { if (curMoney > maxPlayerMoney) {
maxPlayerMoney = curMoney; maxPlayerMoney = curMoney;
} }
@@ -26,7 +26,6 @@ import static org.junit.Assert.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.StringTokenizer;
import org.junit.Test; import org.junit.Test;
@@ -58,7 +57,7 @@ public class RunRankingGameTest extends TestBase {
fail("Invalid message."); fail("Invalid message.");
} }
Collection<Integer> l = new ArrayList<Integer>(); Collection<InitialNonZeroAmountOfMoney> l = new ArrayList<InitialNonZeroAmountOfMoney>();
String gameName = AuthUser + " run ranking game"; String gameName = AuthUser + " run ranking game";
NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 50, gameName, l, 10, 0, 11, 10000); NetGameInfo gameInfo = createGameInfo(5, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 50, gameName, l, 10, 0, 11, 10000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
@@ -216,7 +215,7 @@ public class RunRankingGameTest extends TestBase {
myRequest.setGameState(msg.getPlayersTurnMessage().getValue().getGameState()); myRequest.setGameState(msg.getPlayersTurnMessage().getValue().getGameState());
myRequest.setHandNum(new NonZeroId(handNum)); myRequest.setHandNum(new NonZeroId(handNum));
myRequest.setMyAction(action); myRequest.setMyAction(action);
myRequest.setMyRelativeBet(0); myRequest.setMyRelativeBet(new AmountOfMoney(0));
MyActionRequestMessage myAction = new MyActionRequestMessage(); MyActionRequestMessage myAction = new MyActionRequestMessage();
myAction.setValue(myRequest); myAction.setValue(myRequest);
PokerTHMessage outMsg = new PokerTHMessage(); PokerTHMessage outMsg = new PokerTHMessage();
@@ -237,7 +236,7 @@ public class RunRankingGameTest extends TestBase {
myRequest.setGameState(inMsg.getPlayersTurnMessage().getValue().getGameState()); myRequest.setGameState(inMsg.getPlayersTurnMessage().getValue().getGameState());
myRequest.setHandNum(new NonZeroId(handNum)); myRequest.setHandNum(new NonZeroId(handNum));
myRequest.setMyAction(action); myRequest.setMyAction(action);
myRequest.setMyRelativeBet(0); myRequest.setMyRelativeBet(new AmountOfMoney(0));
MyActionRequestMessage myAction = new MyActionRequestMessage(); MyActionRequestMessage myAction = new MyActionRequestMessage();
myAction.setValue(myRequest); myAction.setValue(myRequest);
PokerTHMessage outMsg = new PokerTHMessage(); PokerTHMessage outMsg = new PokerTHMessage();
@@ -247,14 +246,14 @@ public class RunRankingGameTest extends TestBase {
} }
else if (inMsg.isEndOfHandMessageSelected()) { else if (inMsg.isEndOfHandMessageSelected()) {
if (inMsg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandHideCardsSelected()) { 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()) { } else if (inMsg.getEndOfHandMessage().getValue().getEndOfHandType().isEndOfHandShowCardsSelected()) {
Collection<PlayerResult> result = inMsg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandShowCards().getPlayerResults(); Collection<PlayerResult> result = inMsg.getEndOfHandMessage().getValue().getEndOfHandType().getEndOfHandShowCards().getPlayerResults();
assertFalse(result.isEmpty()); assertFalse(result.isEmpty());
long maxPlayerMoney = 0; long maxPlayerMoney = 0;
for (Iterator<PlayerResult> it = result.iterator(); it.hasNext(); ) { for (Iterator<PlayerResult> it = result.iterator(); it.hasNext(); ) {
PlayerResult r = it.next(); PlayerResult r = it.next();
long curMoney = r.getPlayerMoney(); long curMoney = r.getPlayerMoney().getValue();
if (curMoney > maxPlayerMoney) { if (curMoney > maxPlayerMoney) {
maxPlayerMoney = curMoney; maxPlayerMoney = curMoney;
} }
@@ -35,7 +35,7 @@ public class StartNormalGameTest extends TestBase {
public void testGameStartMessage() throws Exception { public void testGameStartMessage() throws Exception {
guestInit(); 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); NetGameInfo gameInfo = createGameInfo(10, EndRaiseModeEnumType.EnumType.doubleBlinds, 0, 100, GuestUser + " start normal game", l, 10, 0, 11, 20000);
sendMessage(createGameRequestMsg( sendMessage(createGameRequestMsg(
gameInfo, 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, 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(); NetGameInfo gameInfo = new NetGameInfo();
EndRaiseModeEnumType endRaise = new EndRaiseModeEnumType(); EndRaiseModeEnumType endRaise = new EndRaiseModeEnumType();
endRaise.setValue(endMode); endRaise.setValue(endMode);
gameInfo.setDelayBetweenHands(delayBetweenHands); gameInfo.setDelayBetweenHands(delayBetweenHands);
gameInfo.setEndRaiseMode(endRaise); gameInfo.setEndRaiseMode(endRaise);
gameInfo.setEndRaiseSmallBlindValue(endRaiseValue); gameInfo.setEndRaiseSmallBlindValue(new InitialAmountOfMoney(endRaiseValue));
gameInfo.setFirstSmallBlind(sb); gameInfo.setFirstSmallBlind(sb);
gameInfo.setGameName(gameName); gameInfo.setGameName(gameName);
gameInfo.setManualBlinds(manualBlinds); gameInfo.setManualBlinds(manualBlinds);
@@ -307,7 +307,7 @@ public abstract class TestBase {
raiseInterval.selectRaiseEveryHands(raiseEveryHands); raiseInterval.selectRaiseEveryHands(raiseEveryHands);
} }
gameInfo.setRaiseIntervalMode(raiseInterval); gameInfo.setRaiseIntervalMode(raiseInterval);
gameInfo.setStartMoney(startMoney); gameInfo.setStartMoney(new InitialNonZeroAmountOfMoney(startMoney));
return gameInfo; return gameInfo;
} }