Commit baad8480 authored by Gerson Sunyé's avatar Gerson Sunyé
Browse files

Rename Thrif services to GameService and PlayerService

- This changes should clarify their usage, Client/Server was a bad choice.
- Rename Java classes accordinly.
parent b169bc35
......@@ -2,7 +2,7 @@ package fr.univnantes.alma.common;
import fr.univnantes.alma.common.GameJoinRequest;
public interface GameService {
public interface GameInterface {
/**
* Creates a game for a number of players
......
......@@ -30,7 +30,7 @@ public class Game {
play.start();
}
public int join(GameJoinRequest request) {
public int join(GameJoinRequest request) {
int id = idCounter.getAndIncrement();
requests.offer(request);
return id;
......@@ -57,6 +57,6 @@ public class Game {
}
}
private void handleRequest(GameJoinRequest request) {
private void handleRequest(GameJoinRequest request) {
}
}
......@@ -12,7 +12,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.atlanmod.commons.Preconditions.checkArgument;
@Component
public class GameServiceController implements GameInterface {
public class GameController implements GameInterface {
private final AtomicInteger idCounter = new AtomicInteger(0);
private final Map<Integer, Game> games = new HashMap<>();
......
package fr.univnantes.alma.handler;
import fr.univnantes.alma.common.GameInterface;
import fr.univnantes.alma.common.GameJoinRequest;
import fr.univnantes.alma.thrift.GameNotFound;
import fr.univnantes.alma.thrift.GameServerService;
import fr.univnantes.alma.thrift.GameService;
import fr.univnantes.alma.thrift.JoinRequest;
import fr.univnantes.alma.common.GameService;
import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GameServiceHandler implements GameServerService.Iface {
public class GameServiceHandler implements GameService.Iface {
@Autowired
GameService service;
GameInterface service;
@Override
public int createGame(int numberOfPlayers) throws TException {
......
package fr.univnantes.alma;
import fr.univnantes.alma.thrift.GameServerService;
import fr.univnantes.alma.thrift.GameService;
import fr.univnantes.alma.thrift.JoinRequest;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
......@@ -24,7 +24,7 @@ class NotAloneApplicationTest {
@LocalServerPort
protected int port;
protected GameServerService.Iface client;
protected GameService.Iface client;
@BeforeEach
public void setUp() throws Exception {
......@@ -32,7 +32,7 @@ class NotAloneApplicationTest {
TProtocol protocol = protocolFactory.getProtocol(transport);
client = new GameServerService.Client(protocol);
client = new GameService.Client(protocol);
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment