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; ...@@ -2,7 +2,7 @@ package fr.univnantes.alma.common;
import fr.univnantes.alma.common.GameJoinRequest; import fr.univnantes.alma.common.GameJoinRequest;
public interface GameService { public interface GameInterface {
/** /**
* Creates a game for a number of players * Creates a game for a number of players
......
...@@ -12,7 +12,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -12,7 +12,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.atlanmod.commons.Preconditions.checkArgument; import static org.atlanmod.commons.Preconditions.checkArgument;
@Component @Component
public class GameServiceController implements GameInterface { public class GameController implements GameInterface {
private final AtomicInteger idCounter = new AtomicInteger(0); private final AtomicInteger idCounter = new AtomicInteger(0);
private final Map<Integer, Game> games = new HashMap<>(); private final Map<Integer, Game> games = new HashMap<>();
......
package fr.univnantes.alma.handler; package fr.univnantes.alma.handler;
import fr.univnantes.alma.common.GameInterface;
import fr.univnantes.alma.common.GameJoinRequest; import fr.univnantes.alma.common.GameJoinRequest;
import fr.univnantes.alma.thrift.GameNotFound; import fr.univnantes.alma.thrift.GameService;
import fr.univnantes.alma.thrift.GameServerService;
import fr.univnantes.alma.thrift.JoinRequest; import fr.univnantes.alma.thrift.JoinRequest;
import fr.univnantes.alma.common.GameService;
import org.apache.thrift.TException; import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class GameServiceHandler implements GameServerService.Iface { public class GameServiceHandler implements GameService.Iface {
@Autowired @Autowired
GameService service; GameInterface service;
@Override @Override
public int createGame(int numberOfPlayers) throws TException { public int createGame(int numberOfPlayers) throws TException {
......
package fr.univnantes.alma; package fr.univnantes.alma;
import fr.univnantes.alma.thrift.GameServerService; import fr.univnantes.alma.thrift.GameService;
import fr.univnantes.alma.thrift.JoinRequest; import fr.univnantes.alma.thrift.JoinRequest;
import org.apache.thrift.TException; import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.protocol.TProtocol;
...@@ -24,7 +24,7 @@ class NotAloneApplicationTest { ...@@ -24,7 +24,7 @@ class NotAloneApplicationTest {
@LocalServerPort @LocalServerPort
protected int port; protected int port;
protected GameServerService.Iface client; protected GameService.Iface client;
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {
...@@ -32,7 +32,7 @@ class NotAloneApplicationTest { ...@@ -32,7 +32,7 @@ class NotAloneApplicationTest {
TProtocol protocol = protocolFactory.getProtocol(transport); TProtocol protocol = protocolFactory.getProtocol(transport);
client = new GameServerService.Client(protocol); client = new GameService.Client(protocol);
} }
@Test @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