From c50fd5d7016354fbd462078e7ae296e2bc5ed86e Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Sat, 18 Jun 2011 03:23:30 +0200 Subject: Created IConnectionControl and preliminary MockConnectionControl git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@460 72836036-5685-4462-b002-a69064685172 --- .../control/network/MockConnectionControl.java | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 mock/jrummikub/control/network/MockConnectionControl.java (limited to 'mock/jrummikub/control') 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 gameOfferEvent = new MockEvent1(); + /** */ + public MockEvent1 gameWithdrawalEvent = new MockEvent1(); + /** */ + public MockEvent1 gameJoinEvent = new MockEvent1(); + /** */ + public MockEvent1 gameLeaveEvent = new MockEvent1(); + /** */ + public MockEvent1 gameJoinAckEvent = new MockEvent1(); + /** */ + public MockEvent2 changeColorEvent = new MockEvent2(); + /** */ + 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 getGameOfferEvent() { + return gameOfferEvent; + } + + @Override + public IEvent1 getGameWithdrawalEvent() { + return gameWithdrawalEvent; + } + + @Override + public IEvent1 getGameJoinEvent() { + return gameJoinEvent; + } + + @Override + public IEvent1 getGameLeaveEvent() { + return gameLeaveEvent; + } + + @Override + public IEvent1 getGameJoinAckEvent() { + return gameJoinAckEvent; + } + + @Override + public IEvent2 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 + + } +} -- cgit v1.2.3