Fixing test cases.

This commit is contained in:
lotodore
2011-10-27 19:20:08 +00:00
parent aaeef120a7
commit d00bd96511
5 changed files with 181 additions and 9 deletions
@@ -0,0 +1,35 @@
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
@ASN1Sequence ( name = "RejoinEvent", isSet = false )
public class RejoinEvent implements IASN1PreparedElement {
public void initWithDefaults() {
}
private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(RejoinEvent.class);
public IASN1PreparedElementData getPreparedData() {
return preparedData;
}
}
@@ -0,0 +1,53 @@
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
@ASN1Sequence ( name = "StartEvent", isSet = false )
public class StartEvent implements IASN1PreparedElement {
@ASN1Boolean( name = "" )
@ASN1Element ( name = "fillWithComputerPlayers", isOptional = false , hasTag = false , hasDefaultValue = false )
private Boolean fillWithComputerPlayers = null;
public Boolean getFillWithComputerPlayers () {
return this.fillWithComputerPlayers;
}
public void setFillWithComputerPlayers (Boolean value) {
this.fillWithComputerPlayers = value;
}
public void initWithDefaults() {
}
private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(StartEvent.class);
public IASN1PreparedElementData getPreparedData() {
return preparedData;
}
}
@@ -29,11 +29,84 @@ import org.bn.types.*;
private NonZeroId gameId = null;
@ASN1Boolean( name = "" )
@ASN1PreparedElement
@ASN1Choice ( name = "startEventType" )
public static class StartEventTypeChoiceType implements IASN1PreparedElement {
@ASN1Element ( name = "startEvent", isOptional = false , hasTag = true, tag = 0 , hasDefaultValue = false )
@ASN1Element ( name = "fillWithComputerPlayers", isOptional = false , hasTag = false , hasDefaultValue = false )
private StartEvent startEvent = null;
@ASN1Element ( name = "rejoinEvent", isOptional = false , hasTag = true, tag = 1 , hasDefaultValue = false )
private Boolean fillWithComputerPlayers = null;
private RejoinEvent rejoinEvent = null;
public StartEvent getStartEvent () {
return this.startEvent;
}
public boolean isStartEventSelected () {
return this.startEvent != null;
}
private void setStartEvent (StartEvent value) {
this.startEvent = value;
}
public void selectStartEvent (StartEvent value) {
this.startEvent = value;
setRejoinEvent(null);
}
public RejoinEvent getRejoinEvent () {
return this.rejoinEvent;
}
public boolean isRejoinEventSelected () {
return this.rejoinEvent != null;
}
private void setRejoinEvent (RejoinEvent value) {
this.rejoinEvent = value;
}
public void selectRejoinEvent (RejoinEvent value) {
this.rejoinEvent = value;
setStartEvent(null);
}
public void initWithDefaults() {
}
public IASN1PreparedElementData getPreparedData() {
return preparedData_StartEventTypeChoiceType;
}
private static IASN1PreparedElementData preparedData_StartEventTypeChoiceType = CoderFactory.getInstance().newPreparedElementData(StartEventTypeChoiceType.class);
}
@ASN1Element ( name = "startEventType", isOptional = false , hasTag = false , hasDefaultValue = false )
private StartEventTypeChoiceType startEventType = null;
@@ -49,14 +122,14 @@ import org.bn.types.*;
public Boolean getFillWithComputerPlayers () {
return this.fillWithComputerPlayers;
public StartEventTypeChoiceType getStartEventType () {
return this.startEventType;
}
public void setFillWithComputerPlayers (Boolean value) {
this.fillWithComputerPlayers = value;
public void setStartEventType (StartEventTypeChoiceType value) {
this.startEventType = value;
}
@@ -31,6 +31,7 @@ import pokerth_protocol.NetGameInfo;
import pokerth_protocol.NonZeroId;
import pokerth_protocol.PlayerResult;
import pokerth_protocol.PokerTHMessage;
import pokerth_protocol.StartEvent;
import pokerth_protocol.StartEventAckMessage;
import pokerth_protocol.StartEventMessage;
import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
@@ -38,6 +39,7 @@ import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.StartEventAckMessage.StartEventAckMessageSequenceType;
import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType;
import pokerth_protocol.InitialNonZeroAmountOfMoney;
import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType.StartEventTypeChoiceType;
public class RunNormalGameTest extends TestBase {
@@ -92,9 +94,13 @@ public class RunNormalGameTest extends TestBase {
fail("Invalid message.");
}
StartEvent startEvent = new StartEvent();
startEvent.setFillWithComputerPlayers(true);
StartEventTypeChoiceType eventType = new StartEventTypeChoiceType();
eventType.selectStartEvent(startEvent);
StartEventMessageSequenceType gameStartType = new StartEventMessageSequenceType();
gameStartType.setGameId(new NonZeroId(gameId));
gameStartType.setFillWithComputerPlayers(true);
gameStartType.setStartEventType(eventType);
StartEventMessage startMsg = new StartEventMessage();
startMsg.setValue(gameStartType);
msg = new PokerTHMessage();
@@ -28,6 +28,7 @@ import pokerth_protocol.*;
import pokerth_protocol.NetGameInfo.EndRaiseModeEnumType;
import pokerth_protocol.NetGameInfo.NetGameTypeEnumType;
import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType;
import pokerth_protocol.StartEventMessage.StartEventMessageSequenceType.StartEventTypeChoiceType;
public class StartNormalGameTest extends TestBase {
@@ -71,9 +72,13 @@ public class StartNormalGameTest extends TestBase {
}
long gameId = msg.getJoinGameReplyMessage().getValue().getGameId().getValue();
StartEvent startEvent = new StartEvent();
startEvent.setFillWithComputerPlayers(true);
StartEventTypeChoiceType eventType = new StartEventTypeChoiceType();
eventType.selectStartEvent(startEvent);
StartEventMessageSequenceType gameStartType = new StartEventMessageSequenceType();
gameStartType.setGameId(new NonZeroId(gameId));
gameStartType.setFillWithComputerPlayers(true);
gameStartType.setStartEventType(eventType);
StartEventMessage startMsg = new StartEventMessage();
startMsg.setValue(gameStartType);
msg = new PokerTHMessage();