Skip to content

Commit

Permalink
atelier3 (#107)
Browse files Browse the repository at this point in the history
* atelier3/init

* atelier3: atelier3 renamed

* fix: aterlier3 folder name

* atelier3: auth microservice and environment vars

* atelier3: initialized GameRoom class & tests (#65)

* atelier3: create classes to init game + add tests (#68)

* Atelier3/user service (#69)

* feat: 1st part split into 2 services

* atelier3: user service ok i guess lmao

---------

Co-authored-by: louischarnay <[email protected]>

* atelier3: user utils split

* atelier3: refactor game room init

* atelier3: auth fix

* atelier3: add fight execution

* atelier3: fix energy tests

* atelier3: fix energy lower than 0

* Atelier3/cardserver (#72)

* delete old files + add values for Card

* CardServer

* atelier3: card server fix

---------

Co-authored-by: leo-b <[email protected]>
Co-authored-by: Josse DE OLIVEIRA <[email protected]>

* slicing

* remove old pom + fixe

* fixe ressources

* atelier3: add auth tests and revert game tests (#75)

* atelier3: add auth tests and revert game tests

* atelier3: use User instead of PLayer in game init

* atelier3: remove failed test

* atelier3: add game controller (#76)

* atelier3: create discovery service microservice (#77)

* atelier3: create discovery service microservice

* atelier3: remove set property

* atelier3: add missing requests in game controller (#78)

* atelier3: api ok i guess lmao (#79)

* Atelier3/gateway (#80)

* chore: change docker-compose.yml path

* feat: add nginx project

* chore: remove unused files

* feat: gateway working (only in front)

* feat: remove nginx

* feat: add gateway server

* atelier3: implement discovery service (#81)

Co-authored-by: Louis Charnay <[email protected]>

* atelier3: card integration tests (#83)

* atelier3: card integration tests

* atelier3: pom fix

* Atelier3/fix gateway (#82)

* fix: serve correctly front resources with gateway

* feat: adding path to the correct api

* feat: all paths in gateway

* Create maven.yml (#66)

* Create maven.yml

* Update maven.yml

* Update maven.yml

* Update maven.yml

* Update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* update maven.yml

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

---------

Co-authored-by: Louis Charnay <[email protected]>
Co-authored-by: leo-b <[email protected]>
Co-authored-by: Nogellex <[email protected]>

* Atelier3/card integration tests (#84)

* atelier3: card integration tests

* atelier3: pom fix

* atelier3: usercard integration tests

* atelier3: refactor game & add repo (#86)

* Sonar fixe coverage (#85)

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

---------

Co-authored-by: leo-b <[email protected]>

* Atelier3/sonar (#87)

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

* Sonar

---------

Co-authored-by: leo-b <[email protected]>

* Atelier3/user api integration test + usercard eureka integration (#88)

* atelier3: card integration tests

* atelier3: pom fix

* atelier3: usercard integration tests

* atelier3: user api integration test + usercard eureka

* atelier3: move game entities in common (#89)

* Atelier3: add game page (#90)

* atelier3: create game page

* atelier3: fix import in test

* atelier3: CI update

* Atelier3/fix frontend calls (#92)

* fix: update correct path in front

* fix: issue when login

* atelier3: fix user test

* atelier3: card server better coverage (#91)

* atelier3: fix requests response type

* atelier3: User without s

* fix: wrong path in sell.js

* atelier3: CI verify try

* atelier3: add room page (#93)

Co-authored-by: Louis Charnay <[email protected]>

* fix: error at project init

* get card (#95)

Co-authored-by: leo-b <[email protected]>

* atelier3: add game card selection (#96)

Co-authored-by: Louis Charnay <[email protected]>

* Atelier3/fix frontend calls (#94)

* fix: update correct path in front

* fix: issue when login

* fix: try to add /sell in UserCardController

* fix: sell card working

* atelier3: Orchestrator first step (#97)

* Atelier3/fix buy card (#99)

* fix: create card working

* fix: card displayed correctly in buy page

* fix: process working buy page

* fix: create card working (#98)

* atelier3: Orchestrate user creation (#100)

* Atelier3/orchestrate buy (#101)

* atelier3: Orchestrate user creation

* atelier3: Orchestrate buy transaction

* atelier3: forgot these

* sonar add usercard & auth (#102)

* sonar add usercard & auth

* rename

---------

Co-authored-by: leo-b <[email protected]>

* atelier3: Auth tests fixed (#103)

* atelier3: Auth tests fixed

* atelier3: Sonarcloud host fixed for Usercard

* Update pom.xml

add sonar organization

---------

Co-authored-by: Nogellex <[email protected]>

* add Saga Orchestrator Discovery (#105)

Co-authored-by: leo-b <[email protected]>

* add readme atelier3 (#106)

Co-authored-by: leo-b <[email protected]>

* atelier3: fix game (#104)

* atelier3: j'ai fais des trucs mais ça marche pas trop

* atelier3: fix game

* atelier3: fix winner surname

* Update maven.yml

---------

Co-authored-by: Josse DE OLIVEIRA <[email protected]>
Co-authored-by: Webjosse.com <[email protected]>
Co-authored-by: louischarnay <[email protected]>
Co-authored-by: Louis Charnay <[email protected]>
Co-authored-by: Nogellex <[email protected]>
Co-authored-by: leo-b <[email protected]>
  • Loading branch information
7 people authored Jun 2, 2024
1 parent 38acce5 commit e57ce6d
Show file tree
Hide file tree
Showing 167 changed files with 7,272 additions and 14 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Java CI with Maven

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
attestations: write

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Start MySQL with Docker Compose
run: |
docker-compose -f atelier3/docker-compose.yml up -d
export DB_PASSWORD=$DB_PASSWORD
- name: Install Commons with Maven
run: mvn -B install --file atelier3/commons/pom.xml

- name: Verify Card
env:
SONAR_TOKEN: ${{ secrets.SONAR_CARD_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=j3lcardmarket.atelier3.cardserver --file ./atelier3/card-server/pom.xml

- name: Verify Auth
env:
SONAR_TOKEN: ${{ secrets.SONAR_AUTH_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=j3lcardmarket.atelier3.authserver --file ./atelier3/auth-server/pom.xml

- name: Verify Game
env:
SONAR_TOKEN: ${{ secrets.SONAR_GAME_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=j3lcardmarket.atelier3.gameserver --file ./atelier3/game-server/pom.xml

- name: Verify User
env:
SONAR_TOKEN: ${{ secrets.SONAR_USER_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=j3lcardmarket.atelier3.userserver --file ./atelier3/user-server/pom.xml

- name: Verify Usercard
env:
SONAR_TOKEN: ${{ secrets.SONAR_USERCARD_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=j3lcardmarket.atelier3.usercard --file ./atelier3/usercard-server/pom.xml

- name: Verify Discovery with Maven
run: mvn -B verify --file atelier3/discovery-service/pom.xml

- name: Verify Gateway with Maven
run: mvn -B verify --file atelier3/gateway-server/pom.xml

- name: Verify Saga with Maven
run: mvn -B verify --file atelier3/saga-orchestrator/pom.xml
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,24 @@

## Ateliers
[Atelier 2](./docs/atelier2.md)

| Action | Statut |
|-----------------------------|---------|
| Création d’utilisateur et connexion| <div align="center">✅</div> |
| Création d'une nouvelle carte| <div align="center">✅</div> |
| Page d'achat d'une carte| <div align="center">✅</div> |
| Page de vente d'une carte| <div align="center">✅</div> |
| Page de visualisation des transactions| <div align="center">✅</div> |


## Ateliers
[Atelier 3](./docs/atelier3.md)

| Action | Statut |
|-----------------------------|---------|
| Séparation en microservices | <div align="center">✅</div> |
| Tests | <div align="center">✅</div> |
| Gateway | <div align="center">✅</div> |
| Discovery | <div align="center">✅</div> |
| Orchestrator | <div align="center">✅</div> |
| Game | <div align="center">✅</div> |

This file was deleted.

2 changes: 1 addition & 1 deletion atelier2/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server.port=8080

spring.datasource.url=jdbc:postgresql://localhost:5432/cards
spring.datasource.username=ouaf
spring.datasource.password=${DB_PASSWORD}
spring.datasource.password=ouaf
spring.jpa.hibernate.ddl-auto=create
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

Expand Down
33 changes: 33 additions & 0 deletions atelier3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Binary file added atelier3/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions atelier3/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
143 changes: 143 additions & 0 deletions atelier3/auth-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?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>3.2.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>j3lcardmarket.atelier3</groupId>
<artifactId>authserver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>auth-server</name>
<description>Atelier 3 Auth Server</description>
<properties>
<java.version>17</java.version>
<sonar.organization>j3l-card-market</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</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-cache</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version>
</dependency>

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>8.0.1.Final</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>j3lcardmarket.atelier3</groupId>
<artifactId>commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.4</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>4.1.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<mainClass>com.example.MyMainClass</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package j3lcardmarket.atelier3.authserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@EnableDiscoveryClient
@ComponentScan({"j3lcardmarket.atelier3.authserver","j3lcardmarket.atelier3.commons"})
public class AuthServerApplication {
public static void main(String[] args) {
System.setProperty("spring.profiles.default", "authserver");
SpringApplication.run(AuthServerApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package j3lcardmarket.atelier3.authserver.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class AuthHttpConfig {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package j3lcardmarket.atelier3.authserver.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@Configuration
@EnableJpaRepositories(basePackages = "j3lcardmarket.atelier3.authserver.repositories")
class AuthJPAConfig {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package j3lcardmarket.atelier3.authserver.config;

import j3lcardmarket.atelier3.authserver.models.BasicAuthInfo;
import j3lcardmarket.atelier3.authserver.models.User;
import j3lcardmarket.atelier3.authserver.repositories.UserRepository;
import j3lcardmarket.atelier3.authserver.services.DbLoginChecker;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AuthSetupInitialData {

private final DbLoginChecker registerService;
private final UserRepository uRepo;

@Autowired
public AuthSetupInitialData(DbLoginChecker registerService, UserRepository uRepo) {
this.registerService = registerService;
this.uRepo = uRepo;
}

@PostConstruct
public void initialize() {
if (uRepo.existsById("xavier")) return;
registerService.register(new User(new BasicAuthInfo() {
@Override
public String getUsername() {
return "xavier";
}

@Override
public String getPassword() {
return "xavier";
}

@Override
public String serialize() {
return "xavier:xavier";
}
}, "Xavier", "https://varnam.my/wp-content/uploads/2021/01/FB_IMG_1605666747087-2.jpg"),
false);

}

}
Loading

0 comments on commit e57ce6d

Please sign in to comment.