From d00bd96511bd089247207401b858db7e6a86db2c Mon Sep 17 00:00:00 2001 From: lotodore Date: Thu, 27 Oct 2011 19:20:08 +0000 Subject: [PATCH] Fixing test cases. --- tests/src/pokerth_protocol/RejoinEvent.java | 35 ++++++++ tests/src/pokerth_protocol/StartEvent.java | 53 +++++++++++ .../pokerth_protocol/StartEventMessage.java | 87 +++++++++++++++++-- tests/src/pokerth_test/RunNormalGameTest.java | 8 +- .../src/pokerth_test/StartNormalGameTest.java | 7 +- 5 files changed, 181 insertions(+), 9 deletions(-) create mode 100644 tests/src/pokerth_protocol/RejoinEvent.java create mode 100644 tests/src/pokerth_protocol/StartEvent.java diff --git a/tests/src/pokerth_protocol/RejoinEvent.java b/tests/src/pokerth_protocol/RejoinEvent.java new file mode 100644 index 00000000..d3d38c4b --- /dev/null +++ b/tests/src/pokerth_protocol/RejoinEvent.java @@ -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; + } + + + } + \ No newline at end of file diff --git a/tests/src/pokerth_protocol/StartEvent.java b/tests/src/pokerth_protocol/StartEvent.java new file mode 100644 index 00000000..64a8cbad --- /dev/null +++ b/tests/src/pokerth_protocol/StartEvent.java @@ -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; + } + + + } + \ No newline at end of file diff --git a/tests/src/pokerth_protocol/StartEventMessage.java b/tests/src/pokerth_protocol/StartEventMessage.java index 93e77d52..e69daa53 100644 --- a/tests/src/pokerth_protocol/StartEventMessage.java +++ b/tests/src/pokerth_protocol/StartEventMessage.java @@ -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; } diff --git a/tests/src/pokerth_test/RunNormalGameTest.java b/tests/src/pokerth_test/RunNormalGameTest.java index dbc0beba..2ff1aca1 100644 --- a/tests/src/pokerth_test/RunNormalGameTest.java +++ b/tests/src/pokerth_test/RunNormalGameTest.java @@ -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(); diff --git a/tests/src/pokerth_test/StartNormalGameTest.java b/tests/src/pokerth_test/StartNormalGameTest.java index 4ee777a5..60e5173a 100644 --- a/tests/src/pokerth_test/StartNormalGameTest.java +++ b/tests/src/pokerth_test/StartNormalGameTest.java @@ -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();