summaryrefslogtreecommitdiffstats
path: root/mock
diff options
context:
space:
mode:
Diffstat (limited to 'mock')
-rw-r--r--mock/jrummikub/control/network/MockConnectionControl.java147
1 files changed, 147 insertions, 0 deletions
diff --git a/mock/jrummikub/control/network/MockConnectionControl.java b/mock/jrummikub/control/network/MockConnectionControl.java
new file mode 100644
index 0000000..5dec5e2
--- /dev/null
+++ b/mock/jrummikub/control/network/MockConnectionControl.java
@@ -0,0 +1,147 @@
+package jrummikub.control.network;
+
+import java.awt.Color;
+import java.util.UUID;
+
+import jrummikub.util.GameData;
+import jrummikub.util.IEvent;
+import jrummikub.util.IEvent1;
+import jrummikub.util.IEvent2;
+import jrummikub.util.MockEvent;
+import jrummikub.util.MockEvent1;
+import jrummikub.util.MockEvent2;
+
+public class MockConnectionControl implements IConnectionControl {
+ /** */
+ public String nickname;
+ /** */
+ public MockEvent connectedEvent = new MockEvent();
+ /** */
+ public MockEvent connectionFailedEvent = new MockEvent();
+ /** */
+ public MockEvent1<GameData> gameOfferEvent = new MockEvent1<GameData>();
+ /** */
+ public MockEvent1<UUID> gameWithdrawalEvent = new MockEvent1<UUID>();
+ /** */
+ public MockEvent1<String> gameJoinEvent = new MockEvent1<String>();
+ /** */
+ public MockEvent1<String> gameLeaveEvent = new MockEvent1<String>();
+ /** */
+ public MockEvent1<Boolean> gameJoinAckEvent = new MockEvent1<Boolean>();
+ /** */
+ public MockEvent2<String, Color> changeColorEvent = new MockEvent2<String, Color>();
+ /** */
+ public GameData currentGame;
+ /** */
+ public GameData offeredGame;
+ /** */
+ public boolean connected;
+ /** */
+ public boolean failOnConnect;
+
+ @Override
+ public String getNickname() {
+ return nickname;
+ }
+
+ @Override
+ public void connect() {
+ if (failOnConnect) {
+ connectionFailedEvent.emit();
+ } else {
+ connected = true;
+ connectedEvent.emit();
+ }
+ }
+
+ @Override
+ public void disconnect() {
+ connected = false;
+ }
+
+ @Override
+ public IEvent getConnectedEvent() {
+ return connectedEvent;
+ }
+
+ @Override
+ public IEvent getConnectionFailedEvent() {
+ return connectionFailedEvent;
+ }
+
+ @Override
+ public IEvent1<GameData> getGameOfferEvent() {
+ return gameOfferEvent;
+ }
+
+ @Override
+ public IEvent1<UUID> getGameWithdrawalEvent() {
+ return gameWithdrawalEvent;
+ }
+
+ @Override
+ public IEvent1<String> getGameJoinEvent() {
+ return gameJoinEvent;
+ }
+
+ @Override
+ public IEvent1<String> getGameLeaveEvent() {
+ return gameLeaveEvent;
+ }
+
+ @Override
+ public IEvent1<Boolean> getGameJoinAckEvent() {
+ return gameJoinAckEvent;
+ }
+
+ @Override
+ public IEvent2<String, Color> getChangeColorEvent() {
+ return changeColorEvent;
+ }
+
+ @Override
+ public void offerGame(GameData data) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void withdrawGame() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public GameData getCurrentGame() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setCurrentGame(GameData game) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void joinGame(GameData game) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void leaveGame() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void ackJoinGame(String recipient, boolean ack) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void changeColor(Color color) {
+ // TODO Auto-generated method stub
+
+ }
+}