given files

This commit is contained in:
Guillem George 2026-02-12 12:37:08 +01:00
commit f919d1db7c
32 changed files with 1947 additions and 0 deletions

186
endpoints/pom.xml Normal file
View file

@ -0,0 +1,186 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.epita.assistants</groupId>
<artifactId>endpoints</artifactId>
<version>1.0</version>
<properties>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<versions.maven-surefire-plugin>3.0.0-M5</versions.maven-surefire-plugin>
<versions.maven-jar-plugin>3.4.1</versions.maven-jar-plugin>
<versions.maven-install-plugin>3.1.2</versions.maven-install-plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>3.17.5</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire.reportsDirectory>${project.build.directory}/surefire-reports</surefire.reportsDirectory>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${versions.maven-surefire-plugin}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-api</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${versions.maven-jar-plugin}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${versions.maven-install-plugin}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
<goal>native-image-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${versions.maven-surefire-plugin}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${versions.maven-surefire-plugin}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner
</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,15 @@
package fr.epita.assistants.presentation.rest;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
@Path("/")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
public class HelloWorldEndpoint {
@Path("/")
@GET
public String helloWorld() {
return "Hello World!";
}
}

View file

@ -0,0 +1,7 @@
%dev.quarkus.http.port=8082
%dev.quarkus.swagger-ui.enable=true
quarkus.log.category."org.apache.kafka".level=WARN
quarkus.devservices.enabled=false
quarkus.http.cors=true

View file

@ -0,0 +1,80 @@
---
openapi: 3.1.0
tags:
- name: Greeting
- name: String Operations
servers:
- url: http://localhost:8082/
components:
schemas:
HelloResponse:
type: object
properties:
content:
type: string
example: "hello test"
ReverseRequest:
type: object
properties:
content:
type: string
example: "hello\ntest"
ReverseResponse:
type: object
properties:
original:
type: string
example: "hello\ntest"
reversed:
type: string
example: "tset\nolleh"
paths:
/hello/{name}:
get:
summary: Greet by name
description: "Returns a greeting message in the format `hello {name}` using\
\ the provided name."
tags:
- Greeting
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
"200":
description: Greeting message returned successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/HelloResponse"
"400":
description: "Bad request: The name parameter is null or empty."
/reverse:
post:
summary: Reverse a string
description: "Accepts a JSON request containing a string, reverses the string,\
\ and returns both the original and reversed versions."
tags:
- String Operations
requestBody:
description: JSON object containing the string to be reversed.
content:
application/json:
schema:
$ref: "#/components/schemas/ReverseRequest"
required: true
responses:
"200":
description: Reversed string returned successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/ReverseResponse"
"400":
description: "Bad request: Request body is null or the string content is\
\ null or empty."
info:
title: endpoints API
version: "1.0"