Commit 7a389a5f authored by Corentin Guillevic's avatar Corentin Guillevic
Browse files

Create module not-alone-database and move some classes in

parent 50c92125
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/>
</parent>
<groupId>fr.univnantes.alma</groupId>
<artifactId>not-alone-database</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Not Alone Server</name>
<description>Spring Boot Not Alone database</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package fr.univnantes.alma.data.item;
package fr.univnantes.alma.data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class AccessingDataJpaApplication {
......
package fr.univnantes.alma.data.item;
import java.util.List;
import fr.univnantes.alma.data.item.User;
import org.springframework.data.repository.CrudRepository;
......
package fr.univnantes.alma.data.item;
package data;
import static org.assertj.core.api.Assertions.assertThat;
import fr.univnantes.alma.data.item.User;
import fr.univnantes.alma.data.item.UserRepository;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -22,16 +25,16 @@ public class DataStoreTest {
@Test
public void no_User(){
Iterable<User> customers = repository.findAll();
assertThat(customers).isEmpty();
Assertions.assertThat(customers).isEmpty();
}
@Test
public void should_store(){
User u = new User("ok","Jetecarryenadc","ok");
User user = repository.save(new User("JackyLove@world.net", "Jetecarryenadc","JackyLove"));
assertThat(user).hasFieldOrPropertyWithValue("mail","JackyLove@world.net");
Assertions.assertThat(user).hasFieldOrPropertyWithValue("mail","JackyLove@world.net");
// assertThat(user).hasFieldOrPropertyWithValue("password",u.getPasswordHash());
assertThat(user).hasFieldOrPropertyWithValue("pseudo","JackyLove");
Assertions.assertThat(user).hasFieldOrPropertyWithValue("pseudo","JackyLove");
}
}
\ No newline at end of file
......@@ -17,21 +17,17 @@
<description>Spring Boot Not Alone server</description>
<dependencies>
<dependency>
<groupId>fr.univnantes.alma</groupId>
<artifactId>not-alone-database</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.3.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>fr.univnantes.alma</groupId>
<artifactId>not-alone-core</artifactId>
......@@ -59,12 +55,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
......
package fr.univnantes.alma.common;
import fr.univnantes.alma.game.item.board.Board;
import fr.univnantes.alma.game.item.planet.Planet;
import fr.univnantes.alma.server.game.item.board.Board;
import fr.univnantes.alma.server.game.item.planet.Planet;
import fr.univnantes.alma.thrift.InvalidOperationException;
import fr.univnantes.alma.thrift.Response;
......
package fr.univnantes.alma.data;
package fr.univnantes.alma.common;
import fr.univnantes.alma.data.item.User;
import fr.univnantes.alma.game.item.card.*;
import fr.univnantes.alma.server.game.item.card.*;
import java.util.List;
......
package fr.univnantes.alma.data;
import fr.univnantes.alma.common.NotAloneDatabase;
public class DatabaseFactory {
public static NotAloneDatabase getDatabase(){
......
package fr.univnantes.alma.data;
import fr.univnantes.alma.common.NotAloneDatabase;
import fr.univnantes.alma.data.item.User;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.card.CardName;
import fr.univnantes.alma.game.item.card.PlaceCard;
import fr.univnantes.alma.game.item.card.SurvivalCard;
import fr.univnantes.alma.game.item.card.TrackingCard;
import fr.univnantes.alma.game.item.power.PowerType;
import fr.univnantes.alma.server.game.item.Phase;
import fr.univnantes.alma.server.game.item.card.CardName;
import fr.univnantes.alma.server.game.item.card.PlaceCard;
import fr.univnantes.alma.server.game.item.card.SurvivalCard;
import fr.univnantes.alma.server.game.item.card.TrackingCard;
import java.util.*;
......
package fr.univnantes.alma;
package fr.univnantes.alma.server;
import fr.univnantes.alma.handler.GameServiceHandler;
import fr.univnantes.alma.server.handler.GameServiceHandler;
import fr.univnantes.alma.thrift.GameServerService;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocolFactory;
......@@ -14,7 +14,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan
@ComponentScan(basePackages = {"fr.univnantes.alma.server"})
public class NotAloneApplication {
public static void main(String[] args) {
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import fr.univnantes.alma.data.DatabaseFactory;
import fr.univnantes.alma.data.NotAloneDatabase;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.Reserve;
import fr.univnantes.alma.game.item.action.*;
import fr.univnantes.alma.game.item.board.Board;
import fr.univnantes.alma.game.item.card.*;
import fr.univnantes.alma.game.item.jeton.JetonSymbol;
import fr.univnantes.alma.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.game.item.pioche.Pioche;
import fr.univnantes.alma.game.item.planet.Place;
import fr.univnantes.alma.game.item.planet.Planet;
import fr.univnantes.alma.game.item.player.Creature;
import fr.univnantes.alma.game.item.player.Player;
import fr.univnantes.alma.game.item.player.Traque;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.game.item.power.PowerType;
import fr.univnantes.alma.game.item.power.modificator.PowerModificator;
import fr.univnantes.alma.game.item.power.modificator.PowerModificatorType;
import fr.univnantes.alma.game.item.power.recurrent.PowerRecurrent;
import fr.univnantes.alma.game.utilitary.Conversion;
import fr.univnantes.alma.game.utilitary.Pair;
import fr.univnantes.alma.handler.GameClientHandler;
import fr.univnantes.alma.common.NotAloneDatabase;
import fr.univnantes.alma.server.game.item.Phase;
import fr.univnantes.alma.server.game.item.Reserve;
import fr.univnantes.alma.server.game.item.action.*;
import fr.univnantes.alma.server.game.item.board.Board;
import fr.univnantes.alma.server.game.item.card.*;
import fr.univnantes.alma.server.game.item.jeton.JetonSymbol;
import fr.univnantes.alma.server.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.server.game.item.pioche.Pioche;
import fr.univnantes.alma.server.game.item.planet.Place;
import fr.univnantes.alma.server.game.item.planet.Planet;
import fr.univnantes.alma.server.game.item.player.Creature;
import fr.univnantes.alma.server.game.item.player.Player;
import fr.univnantes.alma.server.game.item.player.Traque;
import fr.univnantes.alma.server.game.item.power.Power;
import fr.univnantes.alma.server.game.item.power.PowerType;
import fr.univnantes.alma.server.game.item.power.modificator.PowerModificator;
import fr.univnantes.alma.server.game.item.power.modificator.PowerModificatorType;
import fr.univnantes.alma.server.game.item.power.recurrent.PowerRecurrent;
import fr.univnantes.alma.server.game.utilitary.Conversion;
import fr.univnantes.alma.server.game.utilitary.Pair;
import fr.univnantes.alma.server.handler.GameClientHandler;
import fr.univnantes.alma.thrift.Response;
import fr.univnantes.alma.thrift.TAskAction;
import fr.univnantes.alma.thrift.TPair;
......@@ -30,13 +30,13 @@ import fr.univnantes.alma.thrift.TPair;
import java.util.*;
import java.util.stream.Collectors;
import static fr.univnantes.alma.game.PowerApplicator.applyPlayerCard;
import static fr.univnantes.alma.game.PowerApplicator.resolvePlace;
import static fr.univnantes.alma.game.item.action.ActionType.*;
import static fr.univnantes.alma.game.item.jeton.JetonSymbol.ARTEMIA;
import static fr.univnantes.alma.game.item.jeton.JetonSymbol.CIBLE;
import static fr.univnantes.alma.game.item.player.PlayerTeam.CREATURE;
import static fr.univnantes.alma.game.item.player.PlayerTeam.TRAQUE;
import static fr.univnantes.alma.server.game.PowerApplicator.applyPlayerCard;
import static fr.univnantes.alma.server.game.PowerApplicator.resolvePlace;
import static fr.univnantes.alma.server.game.item.action.ActionType.*;
import static fr.univnantes.alma.server.game.item.jeton.JetonSymbol.ARTEMIA;
import static fr.univnantes.alma.server.game.item.jeton.JetonSymbol.CIBLE;
import static fr.univnantes.alma.server.game.item.player.PlayerTeam.CREATURE;
import static fr.univnantes.alma.server.game.item.player.PlayerTeam.TRAQUE;
public class Game implements GameInterface {
/**
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.action.Action;
import fr.univnantes.alma.game.item.card.Card;
import fr.univnantes.alma.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.server.game.item.Phase;
import fr.univnantes.alma.server.game.item.action.Action;
import fr.univnantes.alma.server.game.item.card.Card;
import fr.univnantes.alma.server.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.thrift.Response;
import fr.univnantes.alma.thrift.TAction;
import fr.univnantes.alma.thrift.TAskAction;
import org.apache.thrift.TException;
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import java.util.ArrayList;
import java.util.List;
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import fr.univnantes.alma.common.GameService;
import fr.univnantes.alma.game.item.board.Board;
import fr.univnantes.alma.game.item.planet.Planet;
import fr.univnantes.alma.server.game.item.board.Board;
import fr.univnantes.alma.server.game.item.planet.Planet;
import fr.univnantes.alma.thrift.InvalidOperationException;
import fr.univnantes.alma.thrift.Response;
import org.springframework.stereotype.Component;
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import fr.univnantes.alma.data.DatabaseFactory;
import fr.univnantes.alma.data.NotAloneDatabase;
import fr.univnantes.alma.game.item.Reserve;
import fr.univnantes.alma.game.item.board.Board;
import fr.univnantes.alma.game.item.board.BoardColor;
import fr.univnantes.alma.game.item.card.*;
import fr.univnantes.alma.game.item.jeton.Jeton;
import fr.univnantes.alma.game.item.jeton.JetonSymbol;
import fr.univnantes.alma.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.game.item.planet.PawnType;
import fr.univnantes.alma.game.item.planet.Place;
import fr.univnantes.alma.game.item.planet.Planet;
import fr.univnantes.alma.game.item.player.Creature;
import fr.univnantes.alma.game.item.player.Player;
import fr.univnantes.alma.game.item.player.PlayerTeam;
import fr.univnantes.alma.game.item.player.Traque;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.game.item.power.modificator.PowerModificator;
import fr.univnantes.alma.game.item.power.modificator.PowerModificatorType;
import fr.univnantes.alma.game.item.power.recurrent.PowerRecurrent;
import fr.univnantes.alma.game.utilitary.Pair;
import fr.univnantes.alma.common.NotAloneDatabase;
import fr.univnantes.alma.server.game.item.Reserve;
import fr.univnantes.alma.server.game.item.board.Board;
import fr.univnantes.alma.server.game.item.board.BoardColor;
import fr.univnantes.alma.server.game.item.card.*;
import fr.univnantes.alma.server.game.item.jeton.Jeton;
import fr.univnantes.alma.server.game.item.jeton.JetonSymbol;
import fr.univnantes.alma.server.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.server.game.item.planet.PawnType;
import fr.univnantes.alma.server.game.item.planet.Place;
import fr.univnantes.alma.server.game.item.planet.Planet;
import fr.univnantes.alma.server.game.item.player.Creature;
import fr.univnantes.alma.server.game.item.player.Player;
import fr.univnantes.alma.server.game.item.player.PlayerTeam;
import fr.univnantes.alma.server.game.item.player.Traque;
import fr.univnantes.alma.server.game.item.power.Power;
import fr.univnantes.alma.server.game.item.power.modificator.PowerModificator;
import fr.univnantes.alma.server.game.item.power.modificator.PowerModificatorType;
import fr.univnantes.alma.server.game.item.power.recurrent.PowerRecurrent;
import fr.univnantes.alma.server.game.utilitary.Pair;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -30,7 +30,7 @@ import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import static fr.univnantes.alma.game.item.card.CardName.*;
import static fr.univnantes.alma.server.game.item.card.CardName.*;
public class PowerApplicator {
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import fr.univnantes.alma.game.item.board.Board;
import fr.univnantes.alma.game.item.planet.Planet;
import fr.univnantes.alma.game.utilitary.request.GameJoinRequest;
import fr.univnantes.alma.game.utilitary.request.GameRequest;
import fr.univnantes.alma.thrift.GameClientService;
import fr.univnantes.alma.server.game.item.board.Board;
import fr.univnantes.alma.server.game.item.planet.Planet;
import fr.univnantes.alma.server.game.utilitary.request.GameJoinRequest;
import fr.univnantes.alma.server.game.utilitary.request.GameRequest;
import fr.univnantes.alma.thrift.Response;
import org.atlanmod.commons.log.Log;
......
package fr.univnantes.alma.game;
package fr.univnantes.alma.server.game;
import java.util.concurrent.atomic.AtomicInteger;
......
package fr.univnantes.alma.game.item;
package fr.univnantes.alma.server.game.item;
public enum Phase {
PREPHASE_1,
......
package fr.univnantes.alma.game.item;
package fr.univnantes.alma.server.game.item;
import fr.univnantes.alma.game.item.card.CardName;
import fr.univnantes.alma.game.item.card.PlaceCard;
import fr.univnantes.alma.game.utilitary.Pair;
import fr.univnantes.alma.server.game.item.card.CardName;
import fr.univnantes.alma.server.game.item.card.PlaceCard;
import fr.univnantes.alma.server.game.utilitary.Pair;
import javassist.NotFoundException;
import java.util.*;
......
Supports Markdown
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