tested spring boot
This commit is contained in:
@@ -55,13 +55,6 @@
|
|||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-docker-compose</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package hackathon.FrisbYEE.jpa.metier;
|
|||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -16,17 +17,19 @@ import jakarta.persistence.Enumerated;
|
|||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Getter @Setter @NoArgsConstructor
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
@Access(AccessType.FIELD)
|
@Access(AccessType.FIELD)
|
||||||
|
@Table(name = "app_user")
|
||||||
public class User implements Serializable {
|
public class User implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@Column(unique = true, nullable = false) //pas possible d'avoir le même nom
|
@Column(unique = true, nullable = false) // pas possible d'avoir le même nom
|
||||||
private String name;
|
private String name;
|
||||||
@Column (nullable = false)
|
@Column(nullable = false)
|
||||||
private String motDePasse;
|
private String motDePasse;
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/frisbyee
|
spring.datasource.url=jdbc:postgresql://localhost:5432/frisbyee
|
||||||
spring.datasource.username=postgres
|
spring.datasource.username=frisbyee_user
|
||||||
spring.datasource.password=postgres
|
spring.datasource.password=secret
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.show-sql=true
|
spring.jpa.show-sql=true
|
||||||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/frisbyee
|
server.port=8081
|
||||||
spring.datasource.username=frisbyee_user
|
|
||||||
spring.datasource.password=secret
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package hackathon.FrisbYEE;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.test.web.servlet.client.RestTestClient;
|
|
||||||
|
|
||||||
import hackathon.FrisbYEE.rest.AthleteResource;
|
|
||||||
|
|
||||||
|
|
||||||
class FrisbYEEApplicationTests {
|
|
||||||
|
|
||||||
//Controller
|
|
||||||
private AthleteResource athleteResource;
|
|
||||||
private RestTestClient mockMvc;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
void setUp() {
|
|
||||||
athleteResource = new AthleteResource();
|
|
||||||
mockMvc = RestTestClient.bindToController(athleteResource).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void shouldReturnUsers() throws Exception {
|
|
||||||
//mockMvc.perform(get("/api/users"))
|
|
||||||
// .andExpect(status().isOk());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,12 +3,12 @@ services:
|
|||||||
container_name: baeldung-keycloak.openid-provider
|
container_name: baeldung-keycloak.openid-provider
|
||||||
image: quay.io/keycloak/keycloak:26.4
|
image: quay.io/keycloak/keycloak:26.4
|
||||||
command:
|
command:
|
||||||
- start-dev
|
- start-dev
|
||||||
- --import-realm
|
- --import-realm
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
volumes:
|
volumes:
|
||||||
- ./keycloak/:/opt/keycloak/data/import/
|
- ./keycloak/:/opt/keycloak/data/import/
|
||||||
environment:
|
environment:
|
||||||
KEYCLOAK_ADMIN: admin
|
KEYCLOAK_ADMIN: admin
|
||||||
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
|
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
|
||||||
@@ -21,9 +21,42 @@ services:
|
|||||||
KC_HEALTH_ENABLED: true
|
KC_HEALTH_ENABLED: true
|
||||||
KC_METRICS_ENABLED: true
|
KC_METRICS_ENABLED: true
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD-SHELL', '[ -f /tmp/HealthCheck.java ] || echo "public class HealthCheck { public static void main(String[] args) throws java.lang.Throwable { System.exit(java.net.HttpURLConnection.HTTP_OK == ((java.net.HttpURLConnection)new java.net.URL(args[0]).openConnection()).getResponseCode() ? 0 : 1); } }" > /tmp/HealthCheck.java && java /tmp/HealthCheck.java http://localhost:8080/auth/health/live']
|
test: ['CMD-SHELL', '[ -f /tmp/HealthCheck.java ] || echo "public class HealthCheck { public static void main(String[] args) throws java.lang.Throwable { System.exit(java.net.HttpURLConnection.HTTP_OK == ((java.net.HttpURLConnection)new java.net.URL(args[0]).openConnection()).getResponseCode() ? 0 : 1); } }" > /tmp/HealthCheck.java && java /tmp/HealthCheck.java http://localhost:8080/auth/health/live']
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
container_name: frisbyee-postgres
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: frisbyee
|
||||||
|
POSTGRES_USER: frisbyee_user
|
||||||
|
POSTGRES_PASSWORD: secret
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
|
||||||
|
version: "3.9"
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
container_name: frisbyee-postgres
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: frisbyee
|
||||||
|
POSTGRES_USER: frisbyee_user
|
||||||
|
POSTGRES_PASSWORD: secret
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
|
||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user